summaryrefslogtreecommitdiff
path: root/sys/arch/amd64/tss.c
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2023-12-13 12:07:43 -0500
committerIan Moffett <ian@osmora.org>2023-12-13 12:07:43 -0500
commit951b20149d1cc4954863a76469ce152c1f453958 (patch)
treeb735f33d2f6736c3723fd120fb36364a5352c9c4 /sys/arch/amd64/tss.c
parentcbb1bccdeb98b8bdd80f5334f03bf45961d2a0f8 (diff)
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 <ian@osmora.org>
Diffstat (limited to 'sys/arch/amd64/tss.c')
-rw-r--r--sys/arch/amd64/tss.c8
1 files changed, 5 insertions, 3 deletions
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);
}