preserve %edi in all primitive operations
This commit is contained in:
parent
cc0a8ead19
commit
c9be49b8a9
95
jumpforth.S
95
jumpforth.S
|
|
@ -57,6 +57,7 @@ _start:
|
||||||
cmpl %eax,(data_BRK)
|
cmpl %eax,(data_BRK)
|
||||||
jne 0f
|
jne 0f
|
||||||
mov $cold_start,%esi
|
mov $cold_start,%esi
|
||||||
|
xor %edi,%edi
|
||||||
NEXT
|
NEXT
|
||||||
0: movl $254,%ebx
|
0: movl $254,%ebx
|
||||||
movl $__NR_exit,%eax
|
movl $__NR_exit,%eax
|
||||||
|
|
@ -392,13 +393,15 @@ defcode PICK
|
||||||
defcode ROLL
|
defcode ROLL
|
||||||
pop %ecx
|
pop %ecx
|
||||||
movl (%esp,%ecx,4),%ebx
|
movl (%esp,%ecx,4),%ebx
|
||||||
mov %esi,%edx
|
mov %esi,%eax
|
||||||
|
mov %edi,%edx
|
||||||
lea -4(%esp,%ecx,4),%esi
|
lea -4(%esp,%ecx,4),%esi
|
||||||
lea (%esp,%ecx,4),%edi
|
lea (%esp,%ecx,4),%edi
|
||||||
std
|
std
|
||||||
rep movsd
|
rep movsd
|
||||||
cld
|
cld
|
||||||
mov %edx,%esi
|
mov %eax,%esi
|
||||||
|
mov %edx,%edi
|
||||||
movl %ebx,(%esp)
|
movl %ebx,(%esp)
|
||||||
NEXT
|
NEXT
|
||||||
|
|
||||||
|
|
@ -690,11 +693,11 @@ defcode DRSHIFT
|
||||||
.macro defzcmp label,ncc,name="\label",flags=0
|
.macro defzcmp label,ncc,name="\label",flags=0
|
||||||
defcode \label,"\name",0,\flags
|
defcode \label,"\name",0,\flags
|
||||||
pop %eax
|
pop %eax
|
||||||
xor %edi,%edi
|
xor %edx,%edx
|
||||||
test %eax,%eax
|
test %eax,%eax
|
||||||
j\ncc 0f
|
j\ncc 0f
|
||||||
dec %edi
|
dec %edx
|
||||||
0: push %edi
|
0: push %edx
|
||||||
NEXT
|
NEXT
|
||||||
.endm
|
.endm
|
||||||
|
|
||||||
|
|
@ -712,12 +715,12 @@ defzcmp ZGE,nge,"0>="
|
||||||
defcode \label,"\name",0,\flags
|
defcode \label,"\name",0,\flags
|
||||||
pop %ebx
|
pop %ebx
|
||||||
pop %eax
|
pop %eax
|
||||||
xor %edi,%edi
|
xor %edx,%edx
|
||||||
sub $0,%ebx
|
sub $0,%ebx
|
||||||
sbb $0,%eax
|
sbb $0,%eax
|
||||||
j\ncc 0f
|
j\ncc 0f
|
||||||
dec %edi
|
dec %edx
|
||||||
0: push %edi
|
0: push %edx
|
||||||
NEXT
|
NEXT
|
||||||
.endm
|
.endm
|
||||||
|
|
||||||
|
|
@ -735,11 +738,11 @@ defdzcmp DZGE,nge,"D0>="
|
||||||
defcode \label,"\name",0,\flags
|
defcode \label,"\name",0,\flags
|
||||||
pop %eax
|
pop %eax
|
||||||
pop %ebx
|
pop %ebx
|
||||||
xor %edi,%edi
|
xor %edx,%edx
|
||||||
cmp %eax,%ebx
|
cmp %eax,%ebx
|
||||||
j\ncc 0f
|
j\ncc 0f
|
||||||
dec %edi
|
dec %edx
|
||||||
0: push %edi
|
0: push %edx
|
||||||
NEXT
|
NEXT
|
||||||
.endm
|
.endm
|
||||||
|
|
||||||
|
|
@ -761,6 +764,7 @@ defcmp UGE,nae,"U>="
|
||||||
|
|
||||||
.macro defdcmp label,ncc,name="\label",flags=0
|
.macro defdcmp label,ncc,name="\label",flags=0
|
||||||
defcode \label,"\name",0,\flags
|
defcode \label,"\name",0,\flags
|
||||||
|
PUSHRSP %edi
|
||||||
pop %edx
|
pop %edx
|
||||||
pop %ecx
|
pop %ecx
|
||||||
pop %ebx
|
pop %ebx
|
||||||
|
|
@ -771,6 +775,7 @@ defcode \label,"\name",0,\flags
|
||||||
j\ncc 0f
|
j\ncc 0f
|
||||||
dec %edi
|
dec %edi
|
||||||
0: push %edi
|
0: push %edi
|
||||||
|
POPRSP %edi
|
||||||
NEXT
|
NEXT
|
||||||
.endm
|
.endm
|
||||||
|
|
||||||
|
|
@ -890,24 +895,29 @@ defcode TWOXCHG,"2XCHG"
|
||||||
defcode FILL
|
defcode FILL
|
||||||
pop %eax
|
pop %eax
|
||||||
pop %ecx
|
pop %ecx
|
||||||
|
mov %edi,%edx
|
||||||
pop %edi
|
pop %edi
|
||||||
rep stosb
|
rep stosb
|
||||||
|
mov %edx,%edi
|
||||||
NEXT
|
NEXT
|
||||||
|
|
||||||
/* ( xu ... x1 n a-addr -- ) Store x1 through xn in ascending cells at a-addr */
|
/* ( xu ... x1 n a-addr -- ) Store x1 through xn in ascending cells at a-addr */
|
||||||
defcode NSTORE,"N!"
|
defcode NSTORE,"N!"
|
||||||
mov %esi,%edx
|
mov %esi,%eax
|
||||||
|
mov %edi,%edx
|
||||||
pop %edi
|
pop %edi
|
||||||
pop %ecx
|
pop %ecx
|
||||||
mov %esp,%esi
|
mov %esp,%esi
|
||||||
lea (%esp,%ecx,4),%esp
|
lea (%esp,%ecx,4),%esp
|
||||||
rep movsd
|
rep movsd
|
||||||
mov %edx,%esi
|
mov %eax,%esi
|
||||||
|
mov %edx,%edi
|
||||||
NEXT
|
NEXT
|
||||||
|
|
||||||
/* ( n a-addr -- xu ... x1 ) Load x1 through xn from ascending cells at a-addr */
|
/* ( n a-addr -- xu ... x1 ) Load x1 through xn from ascending cells at a-addr */
|
||||||
defcode NFETCH,"N@"
|
defcode NFETCH,"N@"
|
||||||
mov %esi,%edx
|
mov %esi,%eax
|
||||||
|
mov %edi,%edx
|
||||||
pop %esi
|
pop %esi
|
||||||
pop %ecx
|
pop %ecx
|
||||||
mov %ecx,%ebx
|
mov %ecx,%ebx
|
||||||
|
|
@ -915,22 +925,26 @@ defcode NFETCH,"N@"
|
||||||
lea (%esp,%ebx,4),%esp
|
lea (%esp,%ebx,4),%esp
|
||||||
mov %esp,%edi
|
mov %esp,%edi
|
||||||
rep movsd
|
rep movsd
|
||||||
mov %edx,%esi
|
mov %eax,%esi
|
||||||
|
mov %edx,%edi
|
||||||
NEXT
|
NEXT
|
||||||
|
|
||||||
/* ( src dst n -- ) Block copy n bytes from src to dst (ascending addresses) */
|
/* ( src dst n -- ) Block copy n bytes from src to dst (ascending addresses) */
|
||||||
defcode CMOVE
|
defcode CMOVE
|
||||||
mov %esi,%edx
|
mov %esi,%eax
|
||||||
|
mov %edi,%edx
|
||||||
pop %ecx
|
pop %ecx
|
||||||
pop %edi
|
pop %edi
|
||||||
pop %esi
|
pop %esi
|
||||||
rep movsb
|
rep movsb
|
||||||
mov %edx,%esi
|
mov %eax,%esi
|
||||||
|
mov %edx,%edi
|
||||||
NEXT
|
NEXT
|
||||||
|
|
||||||
/* ( src dst n -- ) Block copy n bytes from src to dst (descending addresses) */
|
/* ( src dst n -- ) Block copy n bytes from src to dst (descending addresses) */
|
||||||
defcode CMOVE_UP,"CMOVE>"
|
defcode CMOVE_UP,"CMOVE>"
|
||||||
mov %esi,%edx
|
mov %esi,%eax
|
||||||
|
mov %edi,%edx
|
||||||
pop %ecx
|
pop %ecx
|
||||||
pop %edi
|
pop %edi
|
||||||
pop %esi
|
pop %esi
|
||||||
|
|
@ -939,11 +953,13 @@ defcode CMOVE_UP,"CMOVE>"
|
||||||
std
|
std
|
||||||
rep movsb
|
rep movsb
|
||||||
cld
|
cld
|
||||||
mov %edx,%esi
|
mov %eax,%esi
|
||||||
|
mov %edx,%edi
|
||||||
NEXT
|
NEXT
|
||||||
|
|
||||||
/* ( c-addr1 u1 c-addr2 u2 -- -1 | 0 | 1 ) Lexically compare two strings */
|
/* ( c-addr1 u1 c-addr2 u2 -- -1 | 0 | 1 ) Lexically compare two strings */
|
||||||
defcode COMPARE
|
defcode COMPARE
|
||||||
|
PUSHRSP %edi
|
||||||
mov %esi,%edx
|
mov %esi,%edx
|
||||||
mov (%esp),%ecx
|
mov (%esp),%ecx
|
||||||
mov 8(%esp),%ebx
|
mov 8(%esp),%ebx
|
||||||
|
|
@ -964,6 +980,7 @@ defcode COMPARE
|
||||||
4: add $16,%esp
|
4: add $16,%esp
|
||||||
push %eax
|
push %eax
|
||||||
mov %edx,%esi
|
mov %edx,%esi
|
||||||
|
POPRSP %edi
|
||||||
NEXT
|
NEXT
|
||||||
|
|
||||||
/* ( a -- ) ( R: -- a ) */
|
/* ( a -- ) ( R: -- a ) */
|
||||||
|
|
@ -1013,7 +1030,8 @@ defcode TWORFETCH,"2R@"
|
||||||
|
|
||||||
/* ( xu ... x1 u -- ) ( R: -- xu ... x1 u ) */
|
/* ( xu ... x1 u -- ) ( R: -- xu ... x1 u ) */
|
||||||
defcode NTOR,"N>R"
|
defcode NTOR,"N>R"
|
||||||
mov %esi,%edx
|
mov %esi,%eax
|
||||||
|
mov %edi,%edx
|
||||||
movl (%esp),%ecx
|
movl (%esp),%ecx
|
||||||
add $1,%ecx
|
add $1,%ecx
|
||||||
mov %ecx,%ebx
|
mov %ecx,%ebx
|
||||||
|
|
@ -1023,12 +1041,14 @@ defcode NTOR,"N>R"
|
||||||
mov %ebp,%edi
|
mov %ebp,%edi
|
||||||
rep movsd
|
rep movsd
|
||||||
mov %esi,%esp
|
mov %esi,%esp
|
||||||
mov %edx,%esi
|
mov %eax,%esi
|
||||||
|
mov %edx,%edi
|
||||||
NEXT
|
NEXT
|
||||||
|
|
||||||
/* ( R: xu ... x1 u -- ) ( -- xu ... x1 u ) */
|
/* ( R: xu ... x1 u -- ) ( -- xu ... x1 u ) */
|
||||||
defcode NFROMR,"NR>"
|
defcode NFROMR,"NR>"
|
||||||
mov %esi,%edx
|
mov %esi,%eax
|
||||||
|
mov %edi,%edx
|
||||||
movl (%ebp),%ecx
|
movl (%ebp),%ecx
|
||||||
add $1,%ecx
|
add $1,%ecx
|
||||||
mov %ecx,%ebx
|
mov %ecx,%ebx
|
||||||
|
|
@ -1038,12 +1058,14 @@ defcode NFROMR,"NR>"
|
||||||
mov %esp,%edi
|
mov %esp,%edi
|
||||||
rep movsd
|
rep movsd
|
||||||
mov %esi,%ebp
|
mov %esi,%ebp
|
||||||
mov %edx,%esi
|
mov %eax,%esi
|
||||||
|
mov %edx,%edi
|
||||||
NEXT
|
NEXT
|
||||||
|
|
||||||
/* ( R: xu ... x1 u -- xu ... x1 u ) ( -- xu ... x1 u ) */
|
/* ( R: xu ... x1 u -- xu ... x1 u ) ( -- xu ... x1 u ) */
|
||||||
defcode NRFETCH,"NR@"
|
defcode NRFETCH,"NR@"
|
||||||
mov %esi,%edx
|
mov %esi,%eax
|
||||||
|
mov %edi,%edx
|
||||||
movl (%ebp),%ecx
|
movl (%ebp),%ecx
|
||||||
add $1,%ecx
|
add $1,%ecx
|
||||||
mov %ecx,%ebx
|
mov %ecx,%ebx
|
||||||
|
|
@ -1052,7 +1074,8 @@ defcode NRFETCH,"NR@"
|
||||||
mov %ebp,%esi
|
mov %ebp,%esi
|
||||||
mov %esp,%edi
|
mov %esp,%edi
|
||||||
rep movsd
|
rep movsd
|
||||||
mov %edx,%esi
|
mov %eax,%esi
|
||||||
|
mov %edx,%edi
|
||||||
NEXT
|
NEXT
|
||||||
|
|
||||||
/* ( -- a-addr ) */
|
/* ( -- a-addr ) */
|
||||||
|
|
@ -1168,45 +1191,49 @@ defcode HASHCELL
|
||||||
|
|
||||||
/* ( ebx ecx edx esi edi ebp eax/sc -- eax/result ) */
|
/* ( ebx ecx edx esi edi ebp eax/sc -- eax/result ) */
|
||||||
defcode SYSCALL6
|
defcode SYSCALL6
|
||||||
mov %ebp,%ecx
|
mov %ebp,%edx
|
||||||
|
mov %edi,%ecx
|
||||||
mov %esi,%ebx
|
mov %esi,%ebx
|
||||||
pop %eax
|
pop %eax
|
||||||
pop %ebp
|
pop %ebp
|
||||||
pop %edi
|
pop %edi
|
||||||
pop %esi
|
pop %esi
|
||||||
pop %edx
|
xchg %edx,(%esp)
|
||||||
xchg %ecx,(%esp)
|
xchg %ecx,4(%esp)
|
||||||
xchg %ebx,4(%esp)
|
xchg %ebx,8(%esp)
|
||||||
int $0x80
|
int $0x80
|
||||||
pop %ebp
|
pop %ebp
|
||||||
|
pop %edi
|
||||||
pop %esi
|
pop %esi
|
||||||
push %eax
|
push %eax
|
||||||
NEXT
|
NEXT
|
||||||
|
|
||||||
/* ( ebx ecx edx esi edi eax/sc -- eax/result ) */
|
/* ( ebx ecx edx esi edi eax/sc -- eax/result ) */
|
||||||
defcode SYSCALL5
|
defcode SYSCALL5
|
||||||
|
mov %edi,%ecx
|
||||||
mov %esi,%ebx
|
mov %esi,%ebx
|
||||||
pop %eax
|
pop %eax
|
||||||
pop %edi
|
pop %edi
|
||||||
pop %esi
|
pop %esi
|
||||||
pop %edx
|
pop %edx
|
||||||
pop %ecx
|
xchg %ecx,(%esp)
|
||||||
xchg %ebx,(%esp)
|
xchg %ebx,4(%esp)
|
||||||
int $0x80
|
int $0x80
|
||||||
|
pop %edi
|
||||||
pop %esi
|
pop %esi
|
||||||
push %eax
|
push %eax
|
||||||
NEXT
|
NEXT
|
||||||
|
|
||||||
/* ( ebx ecx edx esi eax/sc -- eax/result ) */
|
/* ( ebx ecx edx esi eax/sc -- eax/result ) */
|
||||||
defcode SYSCALL4
|
defcode SYSCALL4
|
||||||
mov %esi,%edi
|
mov %esi,%ebx
|
||||||
pop %eax
|
pop %eax
|
||||||
pop %esi
|
pop %esi
|
||||||
pop %edx
|
pop %edx
|
||||||
pop %ecx
|
pop %ecx
|
||||||
pop %ebx
|
xchg %ebx,(%esp)
|
||||||
int $0x80
|
int $0x80
|
||||||
mov %edi,%esi
|
pop %esi
|
||||||
push %eax
|
push %eax
|
||||||
NEXT
|
NEXT
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue