ref: b6b72565ea3e349ba7de143112bd8dbd8403709b
parent: 7a4f034db548fd023698c091f81905bbe22ea96b
author: glenda <glenda@cirno>
date: Wed May 8 18:10:42 EDT 2024
idt is maybe right, finally. will now try the real thing after this.
--- a/sys/src/nix/pc64/devnix.c
+++ b/sys/src/nix/pc64/devnix.c
@@ -58,19 +58,29 @@
print("lidt with %#p\n", &((ushort*)&ptr[1])[-1]);
if (0)
lidt(&((ushort*)&ptr[1])[-1]);
+ ((ushort*)&ptr[1])[-1] = sizeof(Segdesc)*512-1;
+ ptr[1] = IDTADDR;
+ print("boot lidt %#p %#p\n", ptr[0], ptr[1]);
+ print("lim is %#x\n", ((ushort*)&ptr[1])[-1]);
+ lidt(&((ushort*)&ptr[1])[-1]);
+ p[0] = 0;
+ ((ushort*)&p[1])[-1] = sizeof(Segdesc)*512-1;
+ p[1] = IDTADDR;
}
static void
nixreset(void)
{
+ Segdesc *idt;
DEVNIX *nix;
u32int d1, v;
uintptr vaddr;
extern char acidthandlers[];
- acidt = (Segdesc*)mallocalign(4096,4096,0, 0);
- print("acidt %#p\n", acidt);
- //acidt = (Segdesc*)REBOOTADDR;print("acidt %#p\n", acidt);
+ idt = (Segdesc*)mallocalign(4096,4096,0, 0);
+ acidt = idt;
+ print("idt %#p\n", idt);
+ //idt = (Segdesc*)REBOOTADDR;print("idt %#p\n", idt);
vaddr = (uintptr)acidthandlers;
for(v = 0; v < 256; v++){
@@ -89,13 +99,13 @@
break;
}
- acidt->d0 = (vaddr & 0xFFFF)|(KESEL<<16);
- acidt->d1 = d1;
- acidt++;
+ idt->d0 = (vaddr & 0xFFFF)|(KESEL<<16);
+ idt->d1 = d1;
+ idt++;
- acidt->d0 = (vaddr >> 32);
- acidt->d1 = 0;
- acidt++;
+ idt->d0 = (vaddr >> 32);
+ idt->d1 = 0;
+ idt++;
vaddr += 6;
}