annotate src/alloca.s @ 8275:4fdf77f4e45c

type-break-mode: New variable and function. type-break-interval: Increase default to 1 hour. type-break-query-interval: Variable renamed from type-break-delay-interval. type-break-keystroke-interval: Variable deleted. type-break-keystroke-threshold: New variable. type-break-demo-life: Function renamed from type-break-life. type-break-demo-hanoi: Function renamed from type-break-hanoi. type-break-alarm-p: Variable renamed from type-break-p. type-break: Don't query. type-break-query: (New function) query here. type-break-check: Call type-break-query, not type-break. Do nothing if type-break-mode is nil. Increment type-break-keystroke-count with the length of this-command-keys, not just 1. Query for break when keystroke count exceeds cdr of keystroke threshold variable. Query for break after an alarm only if keystroke count exceeds car of keystroke threshold variable. type-break-select: Function deleted. type-break: Move that code here. type-break-cancel-schedule: Function renamed from cancel-type-break. Reset type-break-alarm-p. type-break-alarm: Function renamed from type-break-soon. (top level): Call type-break-mode; don't set up hook explicitly.
author Noah Friedman <friedman@splode.com>
date Mon, 18 Jul 1994 07:37:18 +0000
parents 06174c615055
children d1633aedb9bd
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
6437
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1 /* `alloca' standard 4.2 subroutine for 68000's and 16000's and others.
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2 Also has _setjmp and _longjmp for pyramids.
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3 Copyright (C) 1985, 1986, 1988 Free Software Foundation, Inc.
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5 This program is free software; you can redistribute it and/or modify it
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6 under the terms of the GNU General Public License as published by the
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7 Free Software Foundation; either version 2, or (at your option) any
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8 later version.
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10 This program is distributed in the hope that it will be useful,
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13 GNU General Public License for more details.
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15 You should have received a copy of the GNU General Public License
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16 along with this program; if not, write to the Free Software
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
17 Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
18
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
19 /* Both 68000 systems I have run this on have had broken versions of alloca.
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
20 Also, I am told that non-berkeley systems do not have it at all.
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
21 So replace whatever system-provided alloca there may be
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
22 on all 68000 systems. */
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
23
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
24 #define NOT_C_CODE
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
25 #ifdef emacs
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
26 #include <config.h>
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
27 #else
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
28 #include "config.h"
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
29 #endif
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
30
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
31 #ifndef HAVE_ALLOCA /* define this to use system's alloca */
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
32
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
33 #ifndef hp9000s300
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
34 #ifndef m68k
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
35 #ifndef m68000
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
36 #ifndef WICAT
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
37 #ifndef ns32000
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
38 #ifndef ns16000
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
39 #ifndef sequent
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
40 #ifndef pyramid
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
41 #ifndef ATT3B5
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
42 #ifndef XENIX
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
43 you
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
44 lose!!
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
45 #endif /* XENIX */
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
46 #endif /* ATT3B5 */
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
47 #endif /* pyramid */
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
48 #endif /* sequent */
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
49 #endif /* ns16000 */
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
50 #endif /* ns32000 */
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
51 #endif /* WICAT */
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
52 #endif /* m68000 */
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
53 #endif /* m68k */
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
54 #endif /* hp9000s300 */
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
55
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
56
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
57 #ifdef hp9000s300
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
58 #ifdef OLD_HP_ASSEMBLER
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
59 data
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
60 text
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
61 globl _alloca
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
62 _alloca
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
63 move.l (sp)+,a0 ; pop return addr from top of stack
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
64 move.l (sp)+,d0 ; pop size in bytes from top of stack
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
65 add.l #ROUND,d0 ; round size up to long word
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
66 and.l #MASK,d0 ; mask out lower two bits of size
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
67 sub.l d0,sp ; allocate by moving stack pointer
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
68 tst.b PROBE(sp) ; stack probe to allocate pages
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
69 move.l sp,d0 ; return pointer
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
70 add.l #-4,sp ; new top of stack
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
71 jmp (a0) ; not a normal return
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
72 MASK equ -4 ; Longword alignment
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
73 ROUND equ 3 ; ditto
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
74 PROBE equ -128 ; safety buffer for C compiler scratch
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
75 data
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
76 #else /* new hp assembler syntax */
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
77 /*
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
78 The new compiler does "move.m <registers> (%sp)" to save registers,
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
79 so we must copy the saved registers when we mung the sp.
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
80 The old compiler did "move.m <register> <offset>(%a6)", which
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
81 gave us no trouble
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
82 */
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
83 text
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
84 set PROBE,-128 # safety for C frame temporaries
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
85 set MAXREG,22 # d2-d7, a2-a5, fp2-fp7 may have been saved
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
86 global _alloca
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
87 _alloca:
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
88 mov.l (%sp)+,%a0 # return address
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
89 mov.l (%sp)+,%d0 # number of bytes to allocate
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
90 mov.l %sp,%a1 # save old sp for register copy
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
91 mov.l %sp,%d1 # compute new sp
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
92 sub.l %d0,%d1 # space requested
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
93 and.l &-4,%d1 # round down to longword
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
94 sub.l &MAXREG*4,%d1 # space for saving registers
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
95 mov.l %d1,%sp # save new value of sp
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
96 tst.b PROBE(%sp) # create pages (sigh)
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
97 mov.l %a2,%d1 # save reg a2
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
98 mov.l %sp,%a2
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
99 move.w &MAXREG-1,%d0
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
100 copy_regs_loop: /* save caller's saved registers */
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
101 mov.l (%a1)+,(%a2)+
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
102 dbra %d0,copy_regs_loop
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
103 mov.l %a2,%d0 # return value
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
104 mov.l %d1,%a2 # restore a2
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
105 add.l &-4,%sp # adjust tos
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
106 jmp (%a0) # rts
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
107 #endif /* new hp assembler */
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
108 #else
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
109 #ifdef m68k /* SGS assembler totally different */
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
110 file "alloca.s"
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
111 global alloca
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
112 alloca:
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
113 #ifdef MOTOROLA_DELTA
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
114 /* slightly modified version of alloca to motorola sysV/68 pcc - based
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
115 compiler.
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
116 this compiler saves used registers relative to %sp instead of %fp.
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
117 alright, just make new copy of saved register set whenever we allocate
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
118 new space from stack..
6815
06174c615055 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 6437
diff changeset
119 this is true at last until SVR3V7 . bug has reported to Motorola. */
6437
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
120 set MAXREG,10 # max no of registers to save (d2-d7, a2-a5)
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
121 mov.l (%sp)+,%a1 # pop return addr from top of stack
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
122 mov.l (%sp)+,%d0 # pop size in bytes from top of stack
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
123 mov.l %sp,%a0 # save stack pointer for register copy
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
124 addq.l &3,%d0 # round size up to long word
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
125 andi.l &-4,%d0 # mask out lower two bits of size
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
126 mov.l %sp,%d1 # compute new value of sp to d1
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
127 sub.l %d0,%d1 # pseudo-allocate by moving stack pointer
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
128 sub.l &MAXREG*4,%d1 # allocate more space for saved regs.
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
129 mov.l %d1,%sp # actual allocation.
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
130 move.w &MAXREG-1,%d0 # d0 counts saved regs.
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
131 mov.l %a2,%d1 # preserve a2.
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
132 mov.l %sp,%a2 # make pointer to new reg save area.
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
133 copy_regs_loop: # copy stuff from old save area.
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
134 mov.l (%a0)+,(%a2)+ # save saved register
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
135 dbra %d0,copy_regs_loop
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
136 mov.l %a2,%a0 # now a2 is start of allocated space.
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
137 mov.l %a2,%d0 # return it in both a0 and d0 to play safe.
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
138 mov.l %d1,%a2 # restore a2.
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
139 subq.l &4,%sp # new top of stack
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
140 jmp (%a1) # far below normal return
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
141 #else /* not MOTOROLA_DELTA */
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
142 mov.l (%sp)+,%a1 # pop return addr from top of stack
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
143 mov.l (%sp)+,%d0 # pop size in bytes from top of stack
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
144 add.l &R%1,%d0 # round size up to long word
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
145 and.l &-4,%d0 # mask out lower two bits of size
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
146 sub.l %d0,%sp # allocate by moving stack pointer
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
147 tst.b P%1(%sp) # stack probe to allocate pages
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
148 mov.l %sp,%a0 # return pointer as pointer
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
149 mov.l %sp,%d0 # return pointer as int to avoid disaster
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
150 add.l &-4,%sp # new top of stack
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
151 jmp (%a1) # not a normal return
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
152 set S%1,64 # safety factor for C compiler scratch
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
153 set R%1,3+S%1 # add to size for rounding
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
154 set P%1,-132 # probe this far below current top of stack
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
155 #endif /* not MOTOROLA_DELTA */
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
156
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
157 #else /* not m68k */
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
158
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
159 #ifdef m68000
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
160
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
161 #ifdef WICAT
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
162 /*
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
163 * Registers are saved after the corresponding link so we have to explicitly
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
164 * move them to the top of the stack where they are expected to be.
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
165 * Since we do not know how many registers were saved in the calling function
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
166 * we must assume the maximum possible (d2-d7,a2-a5). Hence, we end up
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
167 * wasting some space on the stack.
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
168 *
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
169 * The large probe (tst.b) attempts to make up for the fact that we have
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
170 * potentially used up the space that the caller probed for its own needs.
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
171 */
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
172 .procss m0
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
173 .config "68000 1"
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
174 .module _alloca
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
175 MAXREG: .const 10
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
176 .sect text
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
177 .global _alloca
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
178 _alloca:
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
179 move.l (sp)+,a1 ; pop return address
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
180 move.l (sp)+,d0 ; pop allocation size
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
181 move.l sp,d1 ; get current SP value
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
182 sub.l d0,d1 ; adjust to reflect required size...
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
183 sub.l #MAXREG*4,d1 ; ...and space needed for registers
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
184 and.l #-4,d1 ; backup to longword boundry
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
185 move.l sp,a0 ; save old SP value for register copy
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
186 move.l d1,sp ; set the new SP value
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
187 tst.b -4096(sp) ; grab an extra page (to cover caller)
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
188 move.l a2,d1 ; save callers register
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
189 move.l sp,a2
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
190 move.w #MAXREG-1,d0 ; # of longwords to copy
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
191 loop: move.l (a0)+,(a2)+ ; copy registers...
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
192 dbra d0,loop ; ...til there are no more
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
193 move.l a2,d0 ; end of register area is addr for new space
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
194 move.l d1,a2 ; restore saved a2.
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
195 addq.l #4,sp ; caller will increment sp by 4 after return.
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
196 move.l d0,a0 ; return value in both a0 and d0.
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
197 jmp (a1)
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
198 .end _alloca
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
199 #else
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
200
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
201 /* Some systems want the _, some do not. Win with both kinds. */
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
202 .globl _alloca
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
203 _alloca:
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
204 .globl alloca
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
205 alloca:
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
206 movl sp@+,a0
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
207 movl a7,d0
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
208 subl sp@,d0
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
209 andl #~3,d0
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
210 movl d0,sp
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
211 tstb sp@(0) /* Make stack pages exist */
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
212 /* Needed on certain systems
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
213 that lack true demand paging */
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
214 addql #4,d0
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
215 jmp a0@
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
216
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
217 #endif /* not WICAT */
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
218 #endif /* m68000 */
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
219 #endif /* not m68k */
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
220 #endif /* not hp9000s300 */
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
221
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
222 #if defined (ns16000) || defined (ns32000)
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
223
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
224 .text
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
225 .align 2
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
226 /* Some systems want the _, some do not. Win with both kinds. */
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
227 .globl _alloca
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
228 _alloca:
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
229 .globl alloca
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
230 alloca:
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
231
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
232 /* Two different assembler syntaxes are used for the same code
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
233 on different systems. */
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
234
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
235 #ifdef sequent
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
236 #define IM
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
237 #define REGISTER(x) x
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
238 #else
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
239 #ifdef NS5 /* ns SysV assembler */
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
240 #define IM $
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
241 #define REGISTER(x) x
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
242 #else
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
243 #define IM $
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
244 #define REGISTER(x) 0(x)
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
245 #endif
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
246 #endif
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
247
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
248 /*
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
249 * The ns16000 is a little more difficult, need to copy regs.
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
250 * Also the code assumes direct linkage call sequence (no mod table crap).
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
251 * We have to copy registers, and therefore waste 32 bytes.
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
252 *
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
253 * Stack layout:
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
254 * new sp -> junk
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
255 * registers (copy)
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
256 * r0 -> new data
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
257 * | (orig retval)
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
258 * | (orig arg)
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
259 * old sp -> regs (orig)
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
260 * local data
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
261 * fp -> old fp
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
262 */
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
263
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
264 movd tos,r1 /* pop return addr */
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
265 negd tos,r0 /* pop amount to allocate */
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
266 sprd sp,r2
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
267 addd r2,r0
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
268 bicb IM/**/3,r0 /* 4-byte align */
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
269 lprd sp,r0
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
270 adjspb IM/**/36 /* space for regs, +4 for caller to pop */
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
271 movmd 0(r2),4(sp),IM/**/4 /* copy regs */
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
272 movmd 0x10(r2),0x14(sp),IM/**/4
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
273 jump REGISTER(r1) /* funky return */
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
274 #endif /* ns16000 or ns32000 */
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
275
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
276 #ifdef pyramid
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
277
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
278 .globl _alloca
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
279
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
280 _alloca: addw $3,pr0 # add 3 (dec) to first argument
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
281 bicw $3,pr0 # then clear its last 2 bits
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
282 subw pr0,sp # subtract from SP the val in PR0
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
283 andw $-32,sp # keep sp aligned on multiple of 32.
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
284 movw sp,pr0 # ret. current SP
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
285 ret
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
286
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
287 #ifdef PYRAMID_OLD /* This isn't needed in system version 4. */
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
288 .globl __longjmp
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
289 .globl _longjmp
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
290 .globl __setjmp
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
291 .globl _setjmp
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
292
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
293 __longjmp: jump _longjmp
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
294 __setjmp: jump _setjmp
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
295 #endif
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
296
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
297 #endif /* pyramid */
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
298
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
299 #ifdef ATT3B5
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
300
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
301 .align 4
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
302 .globl alloca
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
303
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
304 alloca:
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
305 movw %ap, %r8
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
306 subw2 $9*4, %r8
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
307 movw 0(%r8), %r1 /* pc */
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
308 movw 4(%r8), %fp
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
309 movw 8(%r8), %sp
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
310 addw2 %r0, %sp /* make room */
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
311 movw %sp, %r0 /* return value */
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
312 jmp (%r1) /* continue... */
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
313
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
314 #endif /* ATT3B5 */
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
315
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
316 #ifdef XENIX
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
317
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
318 .386
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
319
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
320 _TEXT segment dword use32 public 'CODE'
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
321 assume cs:_TEXT
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
322
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
323 ;-------------------------------------------------------------------------
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
324
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
325 public _alloca
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
326 _alloca proc near
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
327
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
328 pop ecx ; return address
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
329 pop eax ; amount to alloc
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
330 add eax,3 ; round it to 32-bit boundary
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
331 and al,11111100B ;
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
332 mov edx,esp ; current sp in edx
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
333 sub edx,eax ; lower the stack
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
334 xchg esp,edx ; start of allocation in esp, old sp in edx
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
335 mov eax,esp ; return ptr to base in eax
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
336 push [edx+8] ; save poss. stored reg. values (esi,edi,ebx)
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
337 push [edx+4] ; on lowered stack
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
338 push [edx] ;
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
339 sub esp,4 ; allow for 'add esp, 4'
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
340 jmp ecx ; jump to return address
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
341
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
342 _alloca endp
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
343
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
344 _TEXT ends
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
345
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
346 end
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
347
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
348 #endif /* XENIX */
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
349
f9920b777c65 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
350 #endif /* not HAVE_ALLOCA */