2 ;; GNU-compatible stack allocation function for Xenix/386.
3 ;; Written by Chip Salzenberg at ComDev.
4 ;; Last modified 90/01/11
5 ;;> Is your alloca clearly better than the one in i386-alloca.s? I haven't
8 ;;They're different because Xenix/386 has a different assembler. SCO
9 ;;Xenix has the Microsoft C compiler and the Microsoft macro assembler,
10 ;;called "masm". MASM's assembler syntax is quite different from AT&T's
11 ;;in all sorts of ways. Xenix people can't use the AT&T version.
13 ;;Chip Salzenberg at ComDev/TCT <chip@tct.uucp>, <uunet!ateng!tct!chip>
18 DGROUP GROUP CONST, _BSS, _DATA
19 _DATA SEGMENT DWORD USE32 PUBLIC 'DATA'
21 _BSS SEGMENT DWORD USE32 PUBLIC 'BSS'
23 CONST SEGMENT DWORD USE32 PUBLIC 'CONST'
25 _TEXT SEGMENT DWORD USE32 PUBLIC 'CODE'
26 ASSUME CS: _TEXT, DS: DGROUP, SS: DGROUP, ES: DGROUP
32 pop edx ; edx -> return address
33 pop eax ; eax = amount to allocate
35 ; Validate allocation amount.
43 ; Allocate stack space.
44 mov ecx,esp ; ecx -> old stack pointer
45 sub esp,eax ; perform allocation
46 mov eax,esp ; eax -> new stack pointer
48 ; Copy the three saved register variables from old stack top to new stack top.
49 ; They may not be there. So we waste twelve bytes. Big fat hairy deal.
54 ; Push something so the caller can pop it off.