Initial revision

This commit is contained in:
ceriel 1988-02-18 10:08:42 +00:00
parent 07a378fffe
commit bab801171f
9 changed files with 207 additions and 0 deletions

5
mach/arm/libem/.distr Normal file
View file

@ -0,0 +1,5 @@
LIST
Makefile
end.s
head_em.s
tail_em.a

4
mach/arm/libem/LIST Normal file
View file

@ -0,0 +1,4 @@
los.s
sts.s
dvi.s
mli.s

21
mach/arm/libem/Makefile Normal file
View file

@ -0,0 +1,21 @@
all:
install:
../../install head_em.s head_em
../../install libem_s.a tail_em
../../install end.s end_em
cmp:
-../../compare head_em.s head_em
-../../compare libem_s.a tail_em
-../../compare end.s end_em
clean:
opr :
make pr | opr
pr:
@pr `pwd`/head_em.s
@arch pv libem_s.a | pr -h `pwd`/libem_s.a
@pr `pwd`/end.s

31
mach/arm/libem/dvi.s Normal file
View file

@ -0,0 +1,31 @@
.define .dvi
.sect .text
.dvi: LDMFD R12<,{R1,R2}
MOV R3,#0
CMP R1,#0
ADD.MI R3,R3,#1
RSB.MI R1,R1,#0
CMP R2,#0
ADD.MI R3,R3,#2
RSB.MI R2,R2,#0
MOV R0,#1
div1: CMP R1,#0x80000000
CMP.CC R1,R2
MOV.CC R1,R1,ASL #1
MOV.CC R0,R0,ASL #1
BCC div1
MOV R3,#0
div2: CMP R2,R1
SUB.CS R2,R2,R1
ADD.CS R3,R3,R0
MOV.S R0,R0,LSR #1
MOV.NE R1,R1,LSR #1
BNE div2
TST R4, #2
RSB.NE R2,R2,#0
TST R4, #1
TST.NE R4, #1
RSB.NE R3,R3,#0
MOV R15,R14

16
mach/arm/libem/end.s Normal file
View file

@ -0,0 +1,16 @@
.define _endtext,_enddata,_endbss
.sect .text
.align 4
.sect .rom
.align 4
.sect .data
.align 4
.sect .bss
.align 4
.sect .text
_endtext:
.sect .data
_enddata:
.sect .bss
_endbss:

49
mach/arm/libem/head_em.s Normal file
View file

@ -0,0 +1,49 @@
.define begdat, begbss
.define hol0, argv, envp, reghp
.define ignmask, trpreg, rcktrap
.sect .text
.sect .rom
.sect .data
.sect .bss
.sect .text
ADR R0,begbss
ADR R1,_endbss
MOV R2,#0
1:
STR R2,[R0],#4
CMP R0,R1
BGT 1b
MOV R12, #0x100000
ADR R11, envp
STMFD R12<, {R11}
ADR R11, argv
STMFD R12<, {R11}
MOV R11, #1
STMFD R12<, {R11}
BAL.L _m_a_i_n
rcktrap:
SWI 1
.sect .bss
begbss:
.sect .data
begdat:
hol0:
.data4 0
.data4 0
argv:
.data4 2f
envp:
.data4 0
2:
.asciz 'PROGRAM'
reghp:
.data4 _endbss
ignmask:
.data4 0
trpreg:
.data4 0

27
mach/arm/libem/los.s Normal file
View file

@ -0,0 +1,27 @@
.define .los
.sect .text
.los: LDMFD R12<,{R0,R1}
CMP R0, #8
BGE 2F
CMP R0,#1
LDR.EQ.B R2,[R1]
CMP R0,#4
LDR.EQ R2,[R1]
CMP R0,#2
BNE 1F
LDR.EQ.B R2,[R1]
LDR.EQ.B R3,[R1,#1]
ADD R2,R2,R3,LSL #8
1:
STMFD R12<,{R2}
BAL 3F
2:
SUB R0,R0,#4
LDR R11,[R1,R0]
STMFD R12<,{R11}
CMP R0,#0
BNE 2B
3:
MOV R15,R14

27
mach/arm/libem/mli.s Normal file
View file

@ -0,0 +1,27 @@
.define .mli
.sect .text
.mli: LDMFD R12<,{R1,R2}
MOV R3,#0
MOV R0,#0
CMP R1,#0
ADD.MI R3,R3,#1
RSB.MI R1,R1,#0
CMP R2,#0
ADD.MI R3,R3,#1
RSB.MI R2,R2,#0
CMP R1,R2
BLT 1F
MOV R4,R1
MOV R1,R2
MOV R2,R4
1:
TST R1,#1
ADD.NE R0,R0,R2
MOV R2,R2,LSL #1
MOV.S R1,R1,LSR #1
BNE 1B
TST R3,#1
RSB.NE R0,R0,#0
MOV R15,R14

27
mach/arm/libem/sts.s Normal file
View file

@ -0,0 +1,27 @@
.define .sts
.sect .text
.sts: LDMFD R12<,{R0,R1,R2}
CMP R0, #8
BGE 2f
CMP R0, #1
STR.EQ.B R2,[R1]
CMP R0, #4
STR.EQ R2,[R1]
CMP R0,#2
MOV.NE R15,R14
MOV R3,R2,LSR #8
SUB R2,R2,R3,LSL #8
STR.EQ.B R2,[R1]
STR.EQ.B R3,[R1,#1]
MOV R15,R14
2:
ADD R3,R1,R0
1:
STR R2,[R1]
ADD R1,R1,#4
CMP R1,R3
MOV.EQ R15,R14
STMFD R12<,{R2}
BAL 1b