base/asm-common.h (x86), and knock-on: Add macros for full-size regs.
[catacomb] / base / regdump.h
index db96864..3ada7ea 100644 (file)
@@ -381,32 +381,32 @@ DO8(REGDEF_SIMD)
 
        // Stash r/eax.  This is bletcherous: hope we don't get a signal in
        // the next few instructions.
-       mov     [R_sp(r) - REGDUMP_SPADJ + (REGIX_AX - 1)*WORDSZ], R_a(r)
+       mov     [SP - REGDUMP_SPADJ + (REGIX_AX - 1)*WORDSZ], AX
 
   .ifnes "\addr", "nil"
        // Collect the effective address for the following dump, leaving it
        // in the `addr' slot of the dump.
-       lea     R_a(r), \addr
-       mov     [R_sp(r) - REGDUMP_SPADJ + (REGIX_ADDR - 1)*WORDSZ], R_a(r)
+       lea     AX, \addr
+       mov     [SP - REGDUMP_SPADJ + (REGIX_ADDR - 1)*WORDSZ], AX
   .endif
 
        // Make space for the register save area.  On AMD64 with System/V
        // ABI, also skip the red zone.  Use `lea' here to preserve the
        // flags.
-       lea     R_sp(r), [R_sp(r) - REGDUMP_SPADJ]
+       lea     SP, [SP - REGDUMP_SPADJ]
 
        // Save flags and general-purpose registers.  On 32-bit x86, we save
        // ebx here and establish a GOT pointer here for the benefit of the
        // PLT-indirect calls made later on.
        pushf
 #  if CPUFAM_X86
-       mov     [esp + 4*REGIX_BX], ebx
+       mov     [SP + 4*REGIX_BX], ebx
        ldgot
 #  endif
        callext F(regdump_gpsave)
 
        // Make space for the extended registers.
-       sub     R_sp(r), R_c(r)
+       sub     SP, CX
        callext F(regdump_xtsave)
 
        // Prepare for calling back into C.  On 32-bit x86, leave space for
@@ -414,11 +414,11 @@ DO8(REGDEF_SIMD)
        // the `shadow space' for the called-function's arguments.  Also,
        // forcibly align the stack pointer to a 16-byte boundary.
 #  if CPUFAM_X86
-       sub     esp, 16
+       sub     SP, 16
 #  elif ABI_WIN
-       sub     rsp, 32
+       sub     SP, 32
 #  endif
-       and     R_sp(r), ~15
+       and     SP, ~15
 .endm
 
 .macro _rstrregs
@@ -426,27 +426,27 @@ DO8(REGDEF_SIMD)
 
        // We assume r/ebp still points to the register map.
        callext F(regdump_xtrstr)
-       mov     R_sp(r), R_bp(r)
+       mov     SP, BP
        callext F(regdump_gprstr)
        popf
-       lea     R_sp(r), [R_sp(r) + REGDUMP_SPADJ]
+       lea     SP, [SP + REGDUMP_SPADJ]
 .endm
 
 .macro _regbase
 #  if CPUFAM_X86
-       mov     [esp + 0], ebp
+       mov     [SP + 0], BP
 #  elif ABI_SYSV
-       mov     rdi, rbp
+       mov     rdi, BP
 #  elif ABI_WIN
-       mov     rcx, rbp
+       mov     rcx, BP
 #  endif
 .endm
 
 .macro _membase
-       mov     R_a(r), [R_bp(r) + regmap_gp]
+       mov     AX, [BP + regmap_gp]
 #  if CPUFAM_X86
        mov     eax, [eax + REGIX_ADDR*WORDSZ]
-       mov     [esp + 0], eax
+       mov     [SP + 0], eax
 #  elif ABI_SYSV
        mov     rdi, [rax + REGIX_ADDR*WORDSZ]
 #  elif ABI_WIN
@@ -457,7 +457,7 @@ DO8(REGDEF_SIMD)
 .macro _reglbl msg
   .ifeqs "\msg", ""
 #  if CPUFAM_X86
-       mov     dword ptr [esp + 4], 0
+       mov     dword ptr [SP + 4], 0
 #  elif ABI_SYSV
        xor     esi, esi
 #  elif ABI_WIN
@@ -466,7 +466,7 @@ DO8(REGDEF_SIMD)
   .else
 #  if CPUFAM_X86
        lea     eax, [INTADDR(.L$_reglbl$\@)]
-       mov     [esp + 4], eax
+       mov     [SP + 4], eax
 #  elif ABI_SYSV
        lea     rsi, [INTADDR(.L$_reglbl$\@)]
 #  elif ABI_WIN
@@ -481,7 +481,7 @@ DO8(REGDEF_SIMD)
 
 .macro _regfmt arg
 #  if CPUFAM_X86
-       mov     dword ptr [esp + 8], \arg
+       mov     dword ptr [SP + 8], \arg
 #  elif ABI_SYSV
        mov     edx, \arg
 #  elif ABI_WIN