From 951b20149d1cc4954863a76469ce152c1f453958 Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Wed, 13 Dec 2023 12:07:43 -0500 Subject: kernel/amd64: tss: Fix broken TSS code This commit fixes some horribly broken TSS code. It is unclear how it got this broken. Signed-off-by: Ian Moffett --- sys/arch/amd64/tss.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'sys/arch/amd64') diff --git a/sys/arch/amd64/tss.c b/sys/arch/amd64/tss.c index 3463291..ba1b0f6 100644 --- a/sys/arch/amd64/tss.c +++ b/sys/arch/amd64/tss.c @@ -70,13 +70,15 @@ write_tss(struct cpu_info *cpu, struct tss_desc *desc) * to decide how to use it... As of now, it is useless * to us and shall remain 0. */ + desc->seglimit = sizeof(struct tss_entry); desc->p = 1; /* Must be present to be valid! */ desc->g = 0; /* Granularity -> 0 */ desc->avl = 0; /* Not used */ desc->dpl = 0; /* Descriptor Privilege Level -> 0 */ desc->type = 0x9; /* For TSS -> 0x9 (0b1001) */ - desc->base_lo16 = __SHIFTOUT(tss_base, __MASK(16)); - desc->base_mid24 = __SHIFTOUT(tss_base, __MASK(8) << 24); - desc->base_mid32 = __SHIFTOUT(tss_base, __MASK(32) << 32); + desc->base_lo16 = __SHIFTOUT(tss_base, __MASK(16)); + desc->base_mid8 = __SHIFTOUT(tss_base, __MASK(8) << 16); + desc->base_hi_mid8 = __SHIFTOUT(tss_base, __MASK(8) << 24); + desc->base_hi32 = __SHIFTOUT(tss_base, __MASK(32) << 32); } -- cgit v1.2.3