mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-04-06 22:31:13 -07:00
Change.dylan.kinglet.160270: added source for set of callee-saved registers.
Comment on assumptions about __asm__ and code movement/stack discipline. Copied from Perforce Change: 20889 ServerID: perforce.ravenbrook.com
This commit is contained in:
parent
432efc0f5c
commit
b4594f2d5e
1 changed files with 23 additions and 8 deletions
|
|
@ -1,6 +1,6 @@
|
|||
/* impl.c.sslii3: LINUX/INTEL STACK SCANNING
|
||||
*
|
||||
* $HopeName: $
|
||||
* $HopeName: MMsrc!sslii3.c(trunk.1) $
|
||||
* Copyright (C) 1999. Harlequin Group plc. All rights reserved.
|
||||
*
|
||||
* This scans the stack and fixes the registers which may contain
|
||||
|
|
@ -10,17 +10,31 @@
|
|||
* across function calls and therefore may contain roots.
|
||||
* These are pushed on the stack for scanning.
|
||||
*
|
||||
* SOURCES
|
||||
*
|
||||
* .source.callees.saves: Set of callee-saved registers taken from
|
||||
* CALL_USED_REGISTERS in <gcc-sources>/config/i386/i386.h.
|
||||
*
|
||||
* ASSUMPTIONS
|
||||
*
|
||||
* .align: The stack pointer is assumed to be aligned on a word
|
||||
* .assume.align: The stack pointer is assumed to be aligned on a word
|
||||
* boundary.
|
||||
*
|
||||
* .assume.asm.stack: The compiler must not do wacky things with the
|
||||
* stack pointer around a call since we need to ensure that the
|
||||
* callee-save regs are visible during TraceScanArea.
|
||||
*
|
||||
* .assume.asm.order: The volatile modifier should prevent movement
|
||||
* of code, which might break .assume.asm.stack.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include "mpm.h"
|
||||
|
||||
SRCID(sslii3, "$HopeName: $");
|
||||
SRCID(sslii3, "$HopeName: MMsrc!sslii3.c(trunk.1) $");
|
||||
|
||||
/* .assume.asm.order */
|
||||
#define ASMV(x) __asm__ volatile (x)
|
||||
|
||||
|
||||
|
|
@ -29,15 +43,16 @@ Res StackScan(ScanState ss, Addr *stackBot)
|
|||
Addr *stackTop;
|
||||
Res res;
|
||||
|
||||
ASMV("push %ebx"); /* these registers are the save registers */
|
||||
/* .assume.asm.stack */
|
||||
ASMV("push %ebx"); /* These registers are callee-saved */
|
||||
ASMV("push %esi"); /* and so may contain roots. They are pushed */
|
||||
ASMV("push %edi"); /* for scanning */
|
||||
ASMV("mov %%esp, %0" : "=r" (stackTop) :); /* stack pointer */
|
||||
ASMV("push %edi"); /* for scanning. See .source.callees.saves. */
|
||||
ASMV("mov %%esp, %0" : "=r" (stackTop) :); /* stackTop = esp */
|
||||
|
||||
AVER(AddrIsAligned((Addr)stackTop, sizeof(Addr))); /* .align */
|
||||
AVER(AddrIsAligned((Addr)stackTop, sizeof(Addr))); /* .assume.align */
|
||||
res = TraceScanArea(ss, stackTop, stackBot);
|
||||
|
||||
ASMV("add $12, %esp"); /* pop 3 registers to restore the stack pointer */
|
||||
ASMV("add $12, %esp"); /* pop 3 regs to restore the stack pointer */
|
||||
|
||||
return res;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue