diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2020-03-29 17:13:12 +0200 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2020-03-29 17:13:12 +0200 |
commit | 4d79b40a53d855c41137fa44bcafa62f5ae9f55d (patch) | |
tree | 71abc7f8dca9b62de1459925132d6679f13bce2a /i386/i386/ldt.c | |
parent | 7d26734f9144243f1fa5a0dfbc57a21be4a59472 (diff) |
Fix 64bit TSS/LDT system descriptors
* i386/i386/seg.h (real_descriptor64): New structure.
(fill_descriptor64): New function.
* i386/i386/gdt.h [__x86_64__] (KERNEL_TSS): Set to 0x40 instead of
0x20.
[__x86_64__] (USER_TSS): Set to 0x58 instead of 0x30.
[__x86_64__] (GDTSZ): Set to 12 instead of 11.
(_fill_gdt_descriptor): New macro.
(_fill_gdt_descriptor64, fill_gdt_descriptor64): New macros.
(_fill_gdt_sys_descriptor, fill_gdt_sys_descriptor): New macros.
* i386/i386/ktss.c (ktss_init): Use fill_gdt_sys_descriptor instead of
fill_gdt_descriptor to set KERNEL_TSS GDT entry.
* i386/i386/ldt.c (ldt_init): Likewise for KERNEL_LDT GDT entry.
* i386/i386/ldt.h (fill_ldt_descriptor, fill_ldt_gate): Use sel_idx
instead of reimplementing it.
* i386/i386/mp_desc.c (mp_desc_init): Use _fill_gdt_sys_descriptor
instead of reimplementing it.
Diffstat (limited to 'i386/i386/ldt.c')
-rw-r--r-- | i386/i386/ldt.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/i386/i386/ldt.c b/i386/i386/ldt.c index 99d2f7fe..261df93a 100644 --- a/i386/i386/ldt.c +++ b/i386/i386/ldt.c @@ -47,22 +47,18 @@ struct real_descriptor ldt[LDTSZ]; void ldt_init(void) { -#ifdef __x86_64__ -#warning FIXME -#endif - #ifdef MACH_PV_DESCRIPTORS #ifdef MACH_PV_PAGETABLES pmap_set_page_readwrite(ldt); #endif /* MACH_PV_PAGETABLES */ #else /* MACH_PV_DESCRIPTORS */ /* Initialize the master LDT descriptor in the GDT. */ - fill_gdt_descriptor(KERNEL_LDT, - kvtolin(&ldt), sizeof(ldt)-1, - ACC_PL_K|ACC_LDT, 0); + fill_gdt_sys_descriptor(KERNEL_LDT, + kvtolin(&ldt), sizeof(ldt)-1, + ACC_PL_K|ACC_LDT, 0); #endif /* MACH_PV_DESCRIPTORS */ - /* Initialize the LDT descriptors. */ + /* Initialize the 32bit LDT descriptors. */ fill_ldt_gate(USER_SCALL, (vm_offset_t)&syscall, KERNEL_CS, ACC_PL_U|ACC_CALL_GATE, 0); |