Converted ctojr32 to use macro-local defines.

committer: mfx <mfx> 1075806803 +0000
This commit is contained in:
Markus F.X.J. Oberhumer
2004-02-03 11:13:23 +00:00
parent b8e698bde3
commit 5c567c5a76
+50 -48
View File
@@ -282,6 +282,7 @@ reloc_endx:
;; MRUBYTEn 256 entries in wheel (smallest code) ;; MRUBYTEn 256 entries in wheel (smallest code)
%macro ctojr32 0 %macro ctojr32 0
%push ctojr32
CPU 486 ; FIXME: ctojr32 uses bswap CPU 486 ; FIXME: ctojr32 uses bswap
@@ -327,24 +328,24 @@ decompr0:
;; These %define are only if 0!=n_mru; ;; These %define are only if 0!=n_mru;
;; else 0x0F==bl && cto8==bh==dh && 0xE8==dl && addvalue==esi . ;; else 0x0F==bl && cto8==bh==dh && 0xE8==dl && addvalue==esi .
%define n_mru [esi] %define %$n_mru [esi]
%define n_mru1 [esi] %define %$n_mru1 [esi]
%define tail [esi + 4*1] %define %$tail [esi + 4*1]
%define cto8_e8e9 [esi + 4*2] %define %$cto8_e8e9 [esi + 4*2]
%define cto8_0f [esi + 4*3] %define %$cto8_0f [esi + 4*3]
%define addvalue [esi + 4*4] %define %$addvalue [esi + 4*4]
%define tmp ebp %define %$tmp ebp
%define hand ebx %define %$hand ebx
%define hand_l bl %define %$hand_l bl
%define kh edx %define %$kh edx
%define kh_l dl %define %$kh_l dl
;__LXJCC010__ ;__LXJCC010__
lxunf2: ; have seen 0x80..0x8f of possible recoded 6-byte Jcc <d32> lxunf2: ; have seen 0x80..0x8f of possible recoded 6-byte Jcc <d32>
movzx ebp, word [edi] ; 2 bytes, zero-extended movzx ebp, word [edi] ; 2 bytes, zero-extended
;__LXMRU045__ 0!=n_mru ;__LXMRU045__ 0!=n_mru
sub ebp, cto8_0f sub ebp, %$cto8_0f
;__LXMRU046__ 0==n_mru ;__LXMRU046__ 0==n_mru
sub ebp, ebx sub ebp, ebx
@@ -361,7 +362,7 @@ lxunf2: ; have seen 0x80..0x8f of possible recoded 6-byte Jcc <d32>
inc edi ; preserve Carry inc edi ; preserve Carry
;__LXUNF037__ ;__LXUNF037__
%define jc eax %define %$jc eax
lxunf: ; in: Carry set iff we should apply mru and 0!=n_mru lxunf: ; in: Carry set iff we should apply mru and 0!=n_mru
mov eax, [edi] ; BE32 displacement with cto8 in low 8 bits mov eax, [edi] ; BE32 displacement with cto8 in low 8 bits
@@ -383,74 +384,74 @@ lxunf: ; in: Carry set iff we should apply mru and 0!=n_mru
jnc unf_store ; do not apply mru jnc unf_store ; do not apply mru
;__LXMRU065__ 0!=n_mru ;__LXMRU065__ 0!=n_mru
shr jc, 1 ; eax= jc, or mru index shr %$jc, 1 ; eax= jc, or mru index
jnc mru4 ; not 1st time for this jc jnc mru4 ; not 1st time for this jc
;__MRUBYTE3__ ;__MRUBYTE3__
dec hand_l dec %$hand_l
;__MRUARB30__ ;__MRUARB30__
dec hand dec %$hand
;__MRUBITS3__ ;__MRUBITS3__
and hand, n_mru1 and %$hand, %$n_mru1
;__MRUARB40__ ;__MRUARB40__
jge mru3 jge mru3
add hand, n_mru add %$hand, %$n_mru
mru3: mru3:
;__LXMRU070__ ;__LXMRU070__
mov [esp + 4*hand], jc ; 1st time: mru[hand] = jc mov [esp + 4*%$hand], %$jc ; 1st time: mru[hand] = jc
jmps unf_store jmps unf_store
mru4: ; not 1st time for this jc mru4: ; not 1st time for this jc
lea kh, [jc + hand] ; kh = jc + hand lea %$kh, [%$jc + %$hand] ; kh = jc + hand
;__MRUBYTE4__ ;__MRUBYTE4__
movzx kh, kh_l movzx %$kh, %$kh_l
;__MRUBITS4__ ;__MRUBITS4__
and kh, n_mru1 and %$kh, %$n_mru1
;__MRUARB50__ ;__MRUARB50__
cmp kh, n_mru cmp %$kh, %$n_mru
jb mru5 jb mru5
sub kh, n_mru sub %$kh, %$n_mru
mru5: mru5:
;__LXMRU080__ ;__LXMRU080__
mov jc, [esp + 4*kh] ; jc = mru[kh] mov %$jc, [esp + 4*%$kh] ; jc = mru[kh]
;__MRUBYTE5__ ;__MRUBYTE5__
dec hand_l dec %$hand_l
;__MRUARB60__ ;__MRUARB60__
dec hand dec %$hand
;__MRUBITS5__ ;__MRUBITS5__
and hand, n_mru1 and %$hand, %$n_mru1
;__MRUARB70__ ;__MRUARB70__
jge mru6 jge mru6
add hand, n_mru add %$hand, %$n_mru
mru6: mru6:
;__LXMRU090__ ;__LXMRU090__
mov tmp, [esp + 4*hand] ; tmp = mru[hand] mov %$tmp, [esp + 4*%$hand] ; tmp = mru[hand]
test tmp,tmp test %$tmp,%$tmp
jnz mru8 jnz mru8
push jc ; ran out of registers push %$jc ; ran out of registers
mov eax, tail mov eax, %$tail
;__MRUBYTE6__ ;__MRUBYTE6__
dec al dec al
;__MRUARB80__ ;__MRUARB80__
dec eax dec eax
;__MRUBITS6__ ;__MRUBITS6__
and eax, n_mru1 and eax, %$n_mru1
;__MRUARB90__ ;__MRUARB90__
jge mru7 jge mru7
add eax, n_mru add eax, %$n_mru
mru7: mru7:
;__LXMRU100__ ;__LXMRU100__
xor tmp,tmp xor %$tmp,%$tmp
mov tail, eax mov %$tail, eax
xchg [4+ esp + 4*eax], tmp ; tmp = mru[tail]; mru[tail] = 0 xchg [4+ esp + 4*eax], %$tmp ; tmp = mru[tail]; mru[tail] = 0
pop jc pop %$jc
mru8: mru8:
mov [esp + 4*kh ], tmp ; mru[kh] = tmp mov [esp + 4*%$kh ], %$tmp ; mru[kh] = tmp
mov [esp + 4*hand], jc ; mru[hand] = jc mov [esp + 4*%$hand], %$jc ; mru[hand] = jc
;__LXUNF040__ ;__LXUNF040__
unf_store: unf_store:
sub eax, edi sub eax, edi
@@ -458,7 +459,7 @@ unf_store:
; one of the next2 ; one of the next2
;__LXMRU110__ 0!=n_mru ;__LXMRU110__ 0!=n_mru
add eax, addvalue add eax, %$addvalue
;__LXMRU111__ 0==n_mru ;__LXMRU111__ 0==n_mru
add eax, esi ; addvalue (same as initial pointer) add eax, esi ; addvalue (same as initial pointer)
@@ -493,16 +494,16 @@ lxunf0: ;; continuation of entry prolog for unfilter
;__MRUBITS1__ ;__MRUBITS1__
inc hand ; n_mru1 ==> n_mru inc %$hand ; n_mru1 ==> n_mru
;__LXMRU030__ ;__LXMRU030__
lxunf1: ; allocate and clear mru[] lxunf1: ; allocate and clear mru[]
push byte 0 push byte 0
; one of the next 2, if n_mru ; one of the next 2, if n_mru
;__MRUBYTE1__ ;__MRUBYTE1__
dec hand_l dec %$hand_l
;__MRUARB10__ ;__MRUARB10__
dec hand dec %$hand
;__LXMRU040__ 0!=n_mru ;__LXMRU040__ 0!=n_mru
jnz lxunf1 ; leaves 0=='hand' jnz lxunf1 ; leaves 0=='hand'
@@ -521,7 +522,7 @@ lxct1:
;__LXCJ0MRU__ 0==n_mru ;__LXCJ0MRU__ 0==n_mru
sub eax, edx sub eax, edx
;__LXCJ1MRU__ 0!=n_mru ;__LXCJ1MRU__ 0!=n_mru
sub eax, cto8_e8e9 sub eax, %$cto8_e8e9
; both CALL and JMP are filtered ; both CALL and JMP are filtered
;__LXCALJMP__ ;__LXCALJMP__
@@ -558,10 +559,10 @@ unfcount:
;__MRUBYTE2__ ;__MRUBYTE2__
mov ecx, 4+ 256 ; unused, tail, cto8_e8e9, cto8_0f mov ecx, 4+ 256 ; unused, tail, cto8_e8e9, cto8_0f
;__MRUBITS2__ ;__MRUBITS2__
mov ecx, n_mru1 mov ecx, %$n_mru1
add ecx, byte 1+ 4 ; n_mru1, tail, cto8_e8e9, cto8_0f add ecx, byte 1+ 4 ; n_mru1, tail, cto8_e8e9, cto8_0f
;__MRUARB20__ ;__MRUARB20__
mov ecx, n_mru mov ecx, %$n_mru
add ecx, byte 4 ; n_mru, tail, cto8_e8e9, cto8_0f add ecx, byte 4 ; n_mru, tail, cto8_e8e9, cto8_0f
;__LXMRU057__ ;__LXMRU057__
xor eax, eax xor eax, eax
@@ -580,6 +581,7 @@ unfcount:
ret ret
CPU 386 CPU 386
%pop
%endmacro %endmacro
; vi:ts=8:et:nowrap ; vi:ts=8:et:nowrap