Rev 1184 | Rev 1201 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 1184 | Rev 1187 | ||
|---|---|---|---|
| Line 53... | Line 53... | ||
| 53 | #define AR_TSS (0x9) |
53 | #define AR_TSS (0x9) |
| 54 | 54 | ||
| 55 | #define DPL_KERNEL (PL_KERNEL<<5) |
55 | #define DPL_KERNEL (PL_KERNEL<<5) |
| 56 | #define DPL_USER (PL_USER<<5) |
56 | #define DPL_USER (PL_USER<<5) |
| 57 | 57 | ||
| 58 | #define IO_MAP_BASE (104) |
58 | #define TSS_BASIC_SIZE 104 |
| 59 | 59 | ||
| 60 | #ifndef __ASM__ |
60 | #ifndef __ASM__ |
| 61 | 61 | ||
| 62 | #include <arch/types.h> |
62 | #include <arch/types.h> |
| 63 | #include <typedefs.h> |
63 | #include <typedefs.h> |
| Line 65... | Line 65... | ||
| 65 | 65 | ||
| 66 | struct ptr_16_32 { |
66 | struct ptr_16_32 { |
| 67 | __u16 limit; |
67 | __u16 limit; |
| 68 | __u32 base; |
68 | __u32 base; |
| 69 | } __attribute__ ((packed)); |
69 | } __attribute__ ((packed)); |
| - | 70 | typedef struct ptr_16_32 ptr_16_32_t; |
|
| 70 | 71 | ||
| 71 | struct descriptor { |
72 | struct descriptor { |
| 72 | unsigned limit_0_15: 16; |
73 | unsigned limit_0_15: 16; |
| 73 | unsigned base_0_15: 16; |
74 | unsigned base_0_15: 16; |
| 74 | unsigned base_16_23: 8; |
75 | unsigned base_16_23: 8; |
| Line 78... | Line 79... | ||
| 78 | unsigned unused: 1; |
79 | unsigned unused: 1; |
| 79 | unsigned special: 1; |
80 | unsigned special: 1; |
| 80 | unsigned granularity : 1; |
81 | unsigned granularity : 1; |
| 81 | unsigned base_24_31: 8; |
82 | unsigned base_24_31: 8; |
| 82 | } __attribute__ ((packed)); |
83 | } __attribute__ ((packed)); |
| - | 84 | typedef struct descriptor descriptor_t; |
|
| 83 | 85 | ||
| 84 | struct idescriptor { |
86 | struct idescriptor { |
| 85 | unsigned offset_0_15: 16; |
87 | unsigned offset_0_15: 16; |
| 86 | unsigned selector: 16; |
88 | unsigned selector: 16; |
| 87 | unsigned unused: 8; |
89 | unsigned unused: 8; |
| 88 | unsigned access: 8; |
90 | unsigned access: 8; |
| 89 | unsigned offset_16_31: 16; |
91 | unsigned offset_16_31: 16; |
| 90 | } __attribute__ ((packed)); |
92 | } __attribute__ ((packed)); |
| 91 | - | ||
| - | 93 | typedef struct idescriptor idescriptor_t; |
|
| 92 | 94 | ||
| 93 | struct tss { |
95 | struct tss { |
| 94 | __u16 link; |
96 | __u16 link; |
| 95 | unsigned : 16; |
97 | unsigned : 16; |
| 96 | __u32 esp0; |
98 | __u32 esp0; |
| Line 129... | Line 131... | ||
| 129 | unsigned : 16; |
131 | unsigned : 16; |
| 130 | unsigned : 16; |
132 | unsigned : 16; |
| 131 | __u16 iomap_base; |
133 | __u16 iomap_base; |
| 132 | __u8 iomap[0x10000+1]; /* 64K + 1 terminating byte */ |
134 | __u8 iomap[0x10000+1]; /* 64K + 1 terminating byte */ |
| 133 | } __attribute__ ((packed)); |
135 | } __attribute__ ((packed)); |
| - | 136 | typedef struct tss tss_t; |
|
| 134 | 137 | ||
| 135 | extern struct ptr_16_32 gdtr; |
138 | extern ptr_16_32_t gdtr; |
| 136 | extern struct ptr_16_32 bootstrap_gdtr; |
139 | extern ptr_16_32_t bootstrap_gdtr; |
| 137 | extern struct ptr_16_32 protected_ap_gdtr; |
140 | extern ptr_16_32_t protected_ap_gdtr; |
| 138 | extern struct tss *tss_p; |
141 | extern struct tss *tss_p; |
| 139 | 142 | ||
| 140 | extern struct descriptor gdt[]; |
143 | extern descriptor_t gdt[]; |
| 141 | 144 | ||
| 142 | extern void pm_init(void); |
145 | extern void pm_init(void); |
| 143 | 146 | ||
| 144 | extern void gdt_setbase(struct descriptor *d, __address base); |
147 | extern void gdt_setbase(descriptor_t *d, __address base); |
| 145 | extern void gdt_setlimit(struct descriptor *d, __u32 limit); |
148 | extern void gdt_setlimit(descriptor_t *d, __u32 limit); |
| 146 | 149 | ||
| 147 | extern void idt_init(void); |
150 | extern void idt_init(void); |
| 148 | extern void idt_setoffset(struct idescriptor *d, __address offset); |
151 | extern void idt_setoffset(idescriptor_t *d, __address offset); |
| 149 | 152 | ||
| 150 | extern void tss_initialize(struct tss *t); |
153 | extern void tss_initialize(tss_t *t); |
| 151 | extern void set_tls_desc(__address tls); |
154 | extern void set_tls_desc(__address tls); |
| 152 | 155 | ||
| 153 | #endif /* __ASM__ */ |
156 | #endif /* __ASM__ */ |
| 154 | 157 | ||
| 155 | #endif |
158 | #endif |