Subversion Repositories shark

Rev

Rev 353 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 pj 1
/* Project:     OSLib
2
 * Description: The OS Construction Kit
3
 * Date:                1.6.2000
4
 * Idea by:             Luca Abeni & Gerardo Lamastra
5
 *
6
 * OSLib is an SO project aimed at developing a common, easy-to-use
7
 * low-level infrastructure for developing OS kernels and Embedded
8
 * Applications; it partially derives from the HARTIK project but it
9
 * currently is independently developed.
10
 *
11
 * OSLib is distributed under GPL License, and some of its code has
12
 * been derived from the Linux kernel source; also some important
13
 * ideas come from studying the DJGPP go32 extender.
14
 *
15
 * We acknowledge the Linux Community, Free Software Foundation,
16
 * D.J. Delorie and all the other developers who believe in the
17
 * freedom of software and ideas.
18
 *
19
 * For legalese, check out the included GPL license.
20
 */
21
 
22
/*      Context switch code     */
23
 
24
#include <ll/i386/hw-data.h>
25
#include <ll/i386/hw-func.h>
26
#include <ll/i386/tss-ctx.h>
27
 
353 giacomo 28
#include <tracer.h>
29
 
40 pj 30
FILE(Context-Switch);
2 pj 31
 
32
extern unsigned short int currCtx;
33
#ifdef __VIRCSW__
34
extern int activeInt;
35
#endif
36
 
37
extern void context_load(CONTEXT c);
38
 
39
void ll_context_to(CONTEXT c)
40
{
41
#ifdef __VIRCSW__
40 pj 42
        currCtx = c;
43
        if (activeInt == 0) {
502 giacomo 44
                TRACER_LOGEVENT(FTrace_EVT_context_switch, (unsigned short int)c, 0);
40 pj 45
                context_load(c);
46
        }
47
#else
48
        currCtx = c;
2 pj 49
        context_load(c);
50
#endif
51
}
52
CONTEXT ll_context_from(void)
53
{
54
#ifdef __VIRCSW__
40 pj 55
        return currCtx;
2 pj 56
#else
40 pj 57
        return context_save();
2 pj 58
#endif
59
}
60
 
61
CONTEXT ll_context_save(void)
62
{
40 pj 63
        return currCtx;
2 pj 64
}
65
 
66
void ll_context_load(CONTEXT c)
67
{
40 pj 68
        currCtx = c;
502 giacomo 69
        TRACER_LOGEVENT(FTrace_EVT_context_switch, (unsigned short int)c, 0);
40 pj 70
        context_load(c);
2 pj 71
}