x86_64: kernel trap/interrupt handling
[akaros.git] / kern / arch / x86 / trap64.h
index 88e3476..4098902 100644 (file)
@@ -43,21 +43,21 @@ static inline void save_kernel_ctx(struct kernel_ctx *ctx)
 
 static inline uintptr_t x86_get_ip_hw(struct hw_trapframe *hw_tf)
 {
-       return hw_tf->tf_eip;
+       return hw_tf->tf_rip;
 }
 
 static inline void x86_advance_ip(struct hw_trapframe *hw_tf, size_t bytes)
 {
-               hw_tf->tf_eip += bytes;
+               hw_tf->tf_rip += bytes;
 }
 
 static inline void x86_fake_rdtscp(struct hw_trapframe *hw_tf)
 {
        uint64_t tsc_time = read_tsc();
-       hw_tf->tf_eip += 3;
-       hw_tf->tf_regs.reg_eax = tsc_time & 0xffffffff;
-       hw_tf->tf_regs.reg_edx = tsc_time >> 32;
-       hw_tf->tf_regs.reg_ecx = core_id();
+       hw_tf->tf_rip += 3;
+       hw_tf->tf_rax = tsc_time & 0xffffffff;
+       hw_tf->tf_rdx = tsc_time >> 32;
+       hw_tf->tf_rcx = core_id();
 }
 
 static inline void x86_set_sysenter_stacktop(uintptr_t stacktop)
@@ -67,12 +67,12 @@ static inline void x86_set_sysenter_stacktop(uintptr_t stacktop)
 
 static inline long x86_get_sysenter_arg0(struct hw_trapframe *hw_tf)
 {
-       return hw_tf->tf_regs.reg_eax;
+       return hw_tf->tf_rax;   // XXX probably wrong
 }
 
 static inline long x86_get_sysenter_arg1(struct hw_trapframe *hw_tf)
 {
-       return hw_tf->tf_regs.reg_esi;
+       return hw_tf->tf_rsi;   // XXX probably wrong
 }
 
 static inline uintptr_t x86_get_stacktop_tss(struct taskstate *tss)