From eadebc1e6d1f206500f7afd9531c18ba36dae17e Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Sun, 18 Mar 2012 20:40:26 +0100 Subject: Do not hardcode structure offset * i386/i386/i386asm.sym (R_EDI): Define macro. * i386/i386/locore.S (t_page_fault): Use R_CR2-R_EDI instead of hardcoded 12. --- i386/i386/i386asm.sym | 1 + i386/i386/locore.S | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/i386/i386/i386asm.sym b/i386/i386/i386asm.sym index 39dbcaf9..94493705 100644 --- a/i386/i386/i386asm.sym +++ b/i386/i386/i386asm.sym @@ -78,6 +78,7 @@ offset i386_saved_state r err offset i386_saved_state r efl R_EFLAGS offset i386_saved_state r eip offset i386_saved_state r cr2 +offset i386_saved_state r edi offset i386_interrupt_state i eip offset i386_interrupt_state i cs diff --git a/i386/i386/locore.S b/i386/i386/locore.S index 440435bc..0e1462cb 100644 --- a/i386/i386/locore.S +++ b/i386/i386/locore.S @@ -437,7 +437,7 @@ ENTRY(t_page_fault) #else /* MACH_XEN */ movl %cr2,%eax /* get the faulting address */ #endif /* MACH_XEN */ - movl %eax,12(%esp) /* save in esp save slot */ + movl %eax,R_CR2-R_EDI(%esp) /* save in esp save slot */ jmp trap_push_segs /* continue fault */ /* -- cgit v1.2.3