1 |
/* GDT/LDT/IDT segment header. |
/* GDT/LDT/IDT segment header. |
2 |
Copyright 1999, 2000, 2001 Johan Rydberg, jrydberg@opencores.org. |
Copyright 1999, 2000, 2001, 2002 Johan Rydberg, jrydberg@rtmk.org. |
3 |
|
|
4 |
This program is free software; you can redistribute it and/or modify |
This program is free software; you can redistribute it and/or modify |
5 |
it under the terms of the GNU General Public License as published by |
it under the terms of the GNU General Public License as published by |
18 |
#ifndef __i386_segments_h |
#ifndef __i386_segments_h |
19 |
#define __i386_segments_h 1 |
#define __i386_segments_h 1 |
20 |
|
|
21 |
#define SZGDT (8 + NCPUS) |
#define SZGDT (8 + (NCPUS * 2)) |
22 |
#define SZIDT 256 |
#define SZIDT 256 |
23 |
#define SZLDT 3 |
#define SZLDT 3 |
24 |
|
|
33 |
|
|
34 |
#if !defined(ASSEMBLER) |
#if !defined(ASSEMBLER) |
35 |
|
|
36 |
|
#include <rtmk/kern-return.h> |
37 |
|
#include <rtmk/i386/thread-state.h> |
38 |
|
|
39 |
/* The segment descriptor is represented with a quad word with |
/* The segment descriptor is represented with a quad word with |
40 |
the following layout: |
the following layout: |
41 |
|
|
56 |
unsigned long ldt, tracetrap, bmoffset; |
unsigned long ldt, tracetrap, bmoffset; |
57 |
}; |
}; |
58 |
|
|
|
extern struct tss_segment ktss [NCPUS]; |
|
|
|
|
59 |
struct segment_pointer |
struct segment_pointer |
60 |
{ |
{ |
61 |
unsigned short limit; |
unsigned short limit; |
73 |
base_high : 8; /* base 24..31 */ |
base_high : 8; /* base 24..31 */ |
74 |
}; |
}; |
75 |
|
|
|
|
|
76 |
struct segment_callgate |
struct segment_callgate |
77 |
{ |
{ |
78 |
unsigned long offset_low :16, |
unsigned long offset_low :16, |
146 |
return (int) cs; |
return (int) cs; |
147 |
} |
} |
148 |
|
|
|
#if NCPUS > 1 |
|
149 |
extern struct segment_descriptor gdt [SZGDT]; |
extern struct segment_descriptor gdt [SZGDT]; |
150 |
#endif |
extern struct tss_segment ktss [NCPUS]; |
151 |
|
|
152 |
|
struct pcb; |
153 |
extern void segments_init (void); |
extern void segments_init (void); |
154 |
|
|
155 |
|
/* Convert psuedo descriptors in FAKE to real descriptors. |
156 |
|
Put the converted descriptors in DESC. N is the number of descriptors. |
157 |
|
If N is zero, we run until we find an empty descriptor. */ |
158 |
|
extern void convert_descriptors (struct segment_descriptor *desc, |
159 |
|
struct segment_pseudo *fake, int n); |
160 |
|
|
161 |
|
/* Initialize user LDT segment specified with LDT_STATE. */ |
162 |
|
extern kern_return_t |
163 |
|
initialize_user_segment (struct pcb *pcb, |
164 |
|
struct thread_state_i386_ldt *ldt_state); |
165 |
|
|
166 |
|
|
167 |
#endif /* ASSEMBLER */ |
#endif /* ASSEMBLER */ |
168 |
|
|