processor.h: save rflags
authorPierre-Marc Fournier <pierre-marc.fournier@polymtl.ca>
Mon, 2 Nov 2009 21:16:53 +0000 (16:16 -0500)
committerPierre-Marc Fournier <pierre-marc.fournier@polymtl.ca>
Tue, 3 Nov 2009 23:43:15 +0000 (18:43 -0500)
include/ust/processor.h

index 1eb584365e1116883c1605d3a4f9e9fb54feef1b..b9a2f64e7b5caabb9b5cefb38051e7716cb9f073 100644 (file)
@@ -53,6 +53,7 @@ struct registers {
        unsigned long r15;
        int cs;
        int ss;
+       unsigned long rflags;
 };
 
 #define save_registers(regsptr) \
@@ -74,6 +75,9 @@ struct registers {
             "movq %%r15,%c[r15_off](%[regs])\n\t" \
             "movw %%cs,%c[cs_off](%[regs])\n\t" \
             "movw %%ss,%c[ss_off](%[regs])\n\t" \
+            /* deal with rflags */ \
+            "pushfq\n\t" /* push rflags on stack */ \
+            "popq %c[rflags_off](%[regs])\n\t" \
        : \
        : [regs] "r" (regsptr), \
          [rax_off] "i" (offsetof(struct registers, rax)), \
@@ -93,7 +97,8 @@ struct registers {
          [r14_off] "i" (offsetof(struct registers, r14)), \
          [r15_off] "i" (offsetof(struct registers, r15)), \
          [cs_off] "i" (offsetof(struct registers, cs)), \
-         [ss_off] "i" (offsetof(struct registers, ss)) \
+         [ss_off] "i" (offsetof(struct registers, ss)), \
+         [rflags_off] "i" (offsetof(struct registers, rflags)) \
        );
 
 /* Macro to insert the address of a relative jump in an assembly stub,
This page took 0.023788 seconds and 4 git commands to generate.