diff --git a/VKernel/Kernel/drivers/core/cpu/apic.vp b/VKernel/Kernel/drivers/core/cpu/apic.vp index eb7b729..748afbc 100644 --- a/VKernel/Kernel/drivers/core/cpu/apic.vp +++ b/VKernel/Kernel/drivers/core/cpu/apic.vp @@ -152,7 +152,9 @@ _trampoline_bin: t.CArray[uint8, AP_TRAMPOLINE_LEN] = [ 0x0F, 0x22, 0xD8, # mov cr3, eax 0xB9, 0x80, 0x00, 0x00, 0xC0, # mov ecx, 0xC0000080 (EFER) 0x0F, 0x32, # rdmsr - 0x83, 0xC8, 0x00, 0x01, 0x00, 0x00, # or eax, 0x100 (LME) + # 0x83 C8 只能编码 1 字节立即数;0x100 须用 0x81 C8 imm32(6 字节)。 + # 原写 0x83 会把后 4 字节 00 01 00 00 当作下一条指令执行(N7)。 + 0x81, 0xC8, 0x00, 0x01, 0x00, 0x00, # or eax, 0x100 (LME) 0x0F, 0x79, # wrmsr 0x0F, 0x20, 0xC0, # mov eax, cr0 0x0D, 0x00, 0x00, 0x00, 0x80, # or eax, 0x80000000 (PG) diff --git a/VKernel/Kernel/drivers/core/cpu/cpu.vp b/VKernel/Kernel/drivers/core/cpu/cpu.vp index f3b2e1d..c9bfc4f 100644 --- a/VKernel/Kernel/drivers/core/cpu/cpu.vp +++ b/VKernel/Kernel/drivers/core/cpu/cpu.vp @@ -49,7 +49,11 @@ class cpu_info(t.CStruct): @c.Attribute(t.attr.packed) class _tss: - reserved0: uint64 + # x86_64 TSS 布局:偏移 0 为 4 字节保留字段(对齐 gdt.vp:32 的 + # "reserved0(4) rsp0(8) ..." 与 tss_buf: t.CArray[uint8, 104])。 + # 此前写作 uint64 使 RSP0 落在偏移 8、结构体 108B —— 与硬件 104B 布局 + # 及 gdt 的 tss_buf(104B) 不一致(N6)。 + reserved0: uint32 rsp0: uint64 rsp1: uint64 rsp2: uint64