home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Datafile PD-CD 4
/
DATAFILE_PDCD4.iso
/
unix
/
unixlib36d
/
src
/
sys
/
s
/
_alloca
next >
Wrap
Text File
|
1994-02-26
|
1KB
|
62 lines
; /* _alloca.s (c) Copyright 1991 H.Rogers */
GET @.src.sys.s.asm_dec
AREA |C$$code|,CODE,READONLY
IMPORT malloc
IMPORT free
EXPORT |__alloca|
EXPORT alloca
NAME |__alloca|
alloca ; just in case
|__alloca|
CMP a1,#0
MOVEQS pc,lr
ADD a1,a1,#8
STMFD sp!,{lr}
BL malloc
CMP a1,#0
CMPNE fp,#0
LDMEQFD sp!,{pc}^
LDR a2,[fp,#-4]
LDR a3,[pc,#|__alloca_list_ptr|-.-8]
LDR a4,[a3,#0]
STR a4,[a1,#0]
STR a2,[a1,#4]
STR a1,[a3,#0]
AND a2,a2,#&fc000003
ADR a3,|__alloca_free|
BIC a3,a3,#&fc000003
ORR a2,a2,a3
STR a2,[fp,#-4]
ADD a1,a1,#8
LDMFD sp!,{pc}^
|__alloca_free|
STMFD sp!,{a1,a2,v1}
LDR a3,[pc,#|__alloca_list_ptr|-.-8]
LDR a1,[a3,#0]
LDR a4,[a1,#0]
LDR v1,[a1,#4]
STR a4,[a3,#0]
BL free
MOV a3,v1
LDMFD sp!,{a1,a2,v1}
MOVS pc,a3
|__alloca_list_ptr|
DCD |__alloca_list|
AREA |C$$data|
EXPORT |__alloca_list|
|__alloca_list|
DCD 0
END