Rev 1702 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 1702 | Rev 1780 | ||
|---|---|---|---|
| Line 83... | Line 83... | ||
| 83 | #include <arch/types.h> |
83 | #include <arch/types.h> |
| 84 | #include <typedefs.h> |
84 | #include <typedefs.h> |
| 85 | #include <arch/context.h> |
85 | #include <arch/context.h> |
| 86 | 86 | ||
| 87 | struct ptr_16_32 { |
87 | struct ptr_16_32 { |
| 88 | __u16 limit; |
88 | uint16_t limit; |
| 89 | __u32 base; |
89 | uint32_t base; |
| 90 | } __attribute__ ((packed)); |
90 | } __attribute__ ((packed)); |
| 91 | typedef struct ptr_16_32 ptr_16_32_t; |
91 | typedef struct ptr_16_32 ptr_16_32_t; |
| 92 | 92 | ||
| 93 | struct descriptor { |
93 | struct descriptor { |
| 94 | unsigned limit_0_15: 16; |
94 | unsigned limit_0_15: 16; |
| Line 112... | Line 112... | ||
| 112 | unsigned offset_16_31: 16; |
112 | unsigned offset_16_31: 16; |
| 113 | } __attribute__ ((packed)); |
113 | } __attribute__ ((packed)); |
| 114 | typedef struct idescriptor idescriptor_t; |
114 | typedef struct idescriptor idescriptor_t; |
| 115 | 115 | ||
| 116 | struct tss { |
116 | struct tss { |
| 117 | __u16 link; |
117 | uint16_t link; |
| 118 | unsigned : 16; |
118 | unsigned : 16; |
| 119 | __u32 esp0; |
119 | uint32_t esp0; |
| 120 | __u16 ss0; |
120 | uint16_t ss0; |
| 121 | unsigned : 16; |
121 | unsigned : 16; |
| 122 | __u32 esp1; |
122 | uint32_t esp1; |
| 123 | __u16 ss1; |
123 | uint16_t ss1; |
| 124 | unsigned : 16; |
124 | unsigned : 16; |
| 125 | __u32 esp2; |
125 | uint32_t esp2; |
| 126 | __u16 ss2; |
126 | uint16_t ss2; |
| 127 | unsigned : 16; |
127 | unsigned : 16; |
| 128 | __u32 cr3; |
128 | uint32_t cr3; |
| 129 | __u32 eip; |
129 | uint32_t eip; |
| 130 | __u32 eflags; |
130 | uint32_t eflags; |
| 131 | __u32 eax; |
131 | uint32_t eax; |
| 132 | __u32 ecx; |
132 | uint32_t ecx; |
| 133 | __u32 edx; |
133 | uint32_t edx; |
| 134 | __u32 ebx; |
134 | uint32_t ebx; |
| 135 | __u32 esp; |
135 | uint32_t esp; |
| 136 | __u32 ebp; |
136 | uint32_t ebp; |
| 137 | __u32 esi; |
137 | uint32_t esi; |
| 138 | __u32 edi; |
138 | uint32_t edi; |
| 139 | __u16 es; |
139 | uint16_t es; |
| 140 | unsigned : 16; |
140 | unsigned : 16; |
| 141 | __u16 cs; |
141 | uint16_t cs; |
| 142 | unsigned : 16; |
142 | unsigned : 16; |
| 143 | __u16 ss; |
143 | uint16_t ss; |
| 144 | unsigned : 16; |
144 | unsigned : 16; |
| 145 | __u16 ds; |
145 | uint16_t ds; |
| 146 | unsigned : 16; |
146 | unsigned : 16; |
| 147 | __u16 fs; |
147 | uint16_t fs; |
| 148 | unsigned : 16; |
148 | unsigned : 16; |
| 149 | __u16 gs; |
149 | uint16_t gs; |
| 150 | unsigned : 16; |
150 | unsigned : 16; |
| 151 | __u16 ldtr; |
151 | uint16_t ldtr; |
| 152 | unsigned : 16; |
152 | unsigned : 16; |
| 153 | unsigned : 16; |
153 | unsigned : 16; |
| 154 | __u16 iomap_base; |
154 | uint16_t iomap_base; |
| 155 | __u8 iomap[TSS_IOMAP_SIZE]; |
155 | uint8_t iomap[TSS_IOMAP_SIZE]; |
| 156 | } __attribute__ ((packed)); |
156 | } __attribute__ ((packed)); |
| 157 | typedef struct tss tss_t; |
157 | typedef struct tss tss_t; |
| 158 | 158 | ||
| 159 | extern ptr_16_32_t gdtr; |
159 | extern ptr_16_32_t gdtr; |
| 160 | extern ptr_16_32_t bootstrap_gdtr; |
160 | extern ptr_16_32_t bootstrap_gdtr; |
| Line 163... | Line 163... | ||
| 163 | 163 | ||
| 164 | extern descriptor_t gdt[]; |
164 | extern descriptor_t gdt[]; |
| 165 | 165 | ||
| 166 | extern void pm_init(void); |
166 | extern void pm_init(void); |
| 167 | 167 | ||
| 168 | extern void gdt_setbase(descriptor_t *d, __address base); |
168 | extern void gdt_setbase(descriptor_t *d, uintptr_t base); |
| 169 | extern void gdt_setlimit(descriptor_t *d, __u32 limit); |
169 | extern void gdt_setlimit(descriptor_t *d, uint32_t limit); |
| 170 | 170 | ||
| 171 | extern void idt_init(void); |
171 | extern void idt_init(void); |
| 172 | extern void idt_setoffset(idescriptor_t *d, __address offset); |
172 | extern void idt_setoffset(idescriptor_t *d, uintptr_t offset); |
| 173 | 173 | ||
| 174 | extern void tss_initialize(tss_t *t); |
174 | extern void tss_initialize(tss_t *t); |
| 175 | extern void set_tls_desc(__address tls); |
175 | extern void set_tls_desc(uintptr_t tls); |
| 176 | 176 | ||
| 177 | #endif /* __ASM__ */ |
177 | #endif /* __ASM__ */ |
| 178 | 178 | ||
| 179 | #endif |
179 | #endif |
| 180 | 180 | ||