Kernel/x86_64 - Debugging iret->CPL3 crash
authorJohn Hodge <[email protected]>
Mon, 26 Sep 2011 05:07:19 +0000 (13:07 +0800)
committerJohn Hodge <[email protected]>
Mon, 26 Sep 2011 05:07:19 +0000 (13:07 +0800)
Kernel/arch/x86_64/desctab.asm
Kernel/arch/x86_64/mm_virt.c

index 694672c..739b219 100644 (file)
@@ -374,6 +374,7 @@ SchedulerIRQ:
        pop gs
        POP_GPR
        add rsp, 2*8    ; Dummy error code and IRQ num
+;      xchg bx, bx
        iretq
 
 [extern ci_offsetof_tThread_KernelStack]
@@ -416,6 +417,10 @@ SyscallStub:
        pop r11
        pop rcx
        pop rsp         ; Change back to user stack
+       ; TODO: Determine if user is 64 or 32 bit
+
+;      xchg bx, bx     
+       db 0x48 ; REX, nasm doesn't have a sysretq opcode
        sysret
 
 [section .data]
index a34c6ad..1640586 100644 (file)
@@ -90,11 +90,11 @@ void MM_PageFault(tVAddr Addr, Uint ErrorCode, tRegs *Regs)
 {
        // TODO: Implement Copy-on-Write
        #if 1
-       if( PAGEMAPLVL4(Addr>39) & PF_PRESENT
-        && PAGEDIRPTR(Addr>>30) & PF_PRESENT
-        && PAGEDIR(Addr>>21) & PF_PRESENT
-        && PAGETABLE(Addr>>12) & PF_PRESENT
-        && PAGETABLE(Addr>>12) & PF_COW )
+       if( PAGEMAPLVL4(Addr>>39) & PF_PRESENT
+        && PAGEDIRPTR (Addr>>30) & PF_PRESENT
+        && PAGEDIR    (Addr>>21) & PF_PRESENT
+        && PAGETABLE  (Addr>>12) & PF_PRESENT
+        && PAGETABLE  (Addr>>12) & PF_COW )
        {
                tPAddr  paddr;
                if(MM_GetRefCount( PAGETABLE(Addr>>12) & PADDR_MASK ) == 1)

UCC git Repository :: git.ucc.asn.au