summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2012-03-18 20:40:26 +0100
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2012-03-18 20:40:26 +0100
commiteadebc1e6d1f206500f7afd9531c18ba36dae17e (patch)
treeb35942c8a91813539abe4ad2d9a2a092f78599da
parent853730f7faa8f59795e8e0e811864deae279314f (diff)
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.
-rw-r--r--i386/i386/i386asm.sym1
-rw-r--r--i386/i386/locore.S2
2 files changed, 2 insertions, 1 deletions
diff --git a/i386/i386/i386asm.sym b/i386/i386/i386asm.sym
index 39dbcaf..9449370 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 440435b..0e1462c 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 */
/*