From: ceriel Date: Tue, 10 Oct 1989 11:38:18 +0000 (+0000) Subject: many fixes, found by actually running the code X-Git-Tag: release-5-5~2246 X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=010bade227e3499165397413c64d42f4cb761aec;p=ack.git many fixes, found by actually running the code --- diff --git a/mach/i386/libem/cii.s b/mach/i386/libem/cii.s index 60a3c5bd4..0ad7ce302 100644 --- a/mach/i386/libem/cii.s +++ b/mach/i386/libem/cii.s @@ -9,9 +9,7 @@ ! eax is source cmp edx,1 jne 2f - o16 cbw ! needs operand size toggle to convert - ! from one to two bytes. - cwde + movsxb eax,al mov edx,4 jmp 1f 2: diff --git a/mach/i386/libem/exg.s b/mach/i386/libem/exg.s index d491dffdd..ad693dbaa 100644 --- a/mach/i386/libem/exg.s +++ b/mach/i386/libem/exg.s @@ -5,7 +5,7 @@ .sect .text .exg: push edi - mov esp,edi + mov edi,esp add edi,8 mov ebx,edi add ebx,ecx @@ -14,6 +14,8 @@ mov eax,(ebx) xchg eax,(edi) mov (ebx),eax + add edi,4 + add ebx,4 loop 1b 2: pop edi diff --git a/mach/i386/libem/iaar.s b/mach/i386/libem/iaar.s index af9fd286b..b74dc3fa4 100644 --- a/mach/i386/libem/iaar.s +++ b/mach/i386/libem/iaar.s @@ -8,12 +8,11 @@ cmp edx,4 .extern .unknown jne .unknown - pop ebx ! descriptor address - pop eax ! index - pop edx ! array base + pop ebx ! descriptor address + pop eax ! index sub eax,(ebx) mul 8(ebx) - mov ebx,edx + pop ebx ! array base add ebx,eax push ecx ret diff --git a/mach/i386/libem/ior.s b/mach/i386/libem/ior.s index ac40fb403..3981ff5ae 100644 --- a/mach/i386/libem/ior.s +++ b/mach/i386/libem/ior.s @@ -8,7 +8,7 @@ mov edx,edi mov edi,esp add edi,ecx - sar ecx,1 + sar ecx,2 1: pop eax or eax,(edi) diff --git a/mach/i386/libem/lar4.s b/mach/i386/libem/lar4.s index 4eaa070a1..643ec961f 100644 --- a/mach/i386/libem/lar4.s +++ b/mach/i386/libem/lar4.s @@ -5,18 +5,16 @@ .lar4: ! ebx, descriptor address ! eax, index - pop ecx - pop edx ! base address - push ecx sub eax,(ebx) mov ecx,8(ebx) imul ecx + pop ebx + pop edx ! base address add edx,eax sar ecx,1 jnb 1f xor eax,eax movb al,(edx) - pop ebx push eax jmp ebx 1: @@ -24,13 +22,12 @@ jnb 1f xor eax,eax o16 mov ax,(edx) - pop ebx push eax jmp ebx 1: - mov edx,esi ! saved esi - mov eax,8(ebx) - pop ebx ! return address + xchg edx,esi ! saved esi + mov eax,ecx + sal eax,2 sub esp,eax mov eax,edi ! save edi mov edi,esp diff --git a/mach/i386/libem/loi.s b/mach/i386/libem/loi.s index b1919eedf..c0ed170d5 100644 --- a/mach/i386/libem/loi.s +++ b/mach/i386/libem/loi.s @@ -11,20 +11,20 @@ mov eax,ecx sar ecx,1 jnb 1f - xor eax,eax - movb al,(edx) + movsxb eax,(ebx) push eax jmp edx 1: sar ecx,1 jnb 1f - xor eax,eax - o16 mov ax,(edx) + movsx eax,(ebx) push eax jmp edx 1: - mov ebx,edx + push edx mov edx,esi + mov esi,ebx + pop ebx sub esp,eax jmp 1f diff --git a/mach/i386/libem/nop.s b/mach/i386/libem/nop.s index c0f59f222..46fbbb7ff 100644 --- a/mach/i386/libem/nop.s +++ b/mach/i386/libem/nop.s @@ -3,22 +3,8 @@ .define .nop .extern printd, printc, hol0 -SIO_S = 0xDA -SIO_D = 0xD8 -RXRDY = 0x02 - .nop: mov eax,(hol0) call printd -! movb al,' ' -! call printc -! mov eax,esp -! call printd -!1: -! inb SIO_S -! andb al,RXRDY -! jz 1b -! inb SIO_D -! call printc movb al,'\n' jmp printc diff --git a/mach/i386/libem/sar4.s b/mach/i386/libem/sar4.s index 2cbeef6f2..52a1f6192 100644 --- a/mach/i386/libem/sar4.s +++ b/mach/i386/libem/sar4.s @@ -5,30 +5,24 @@ .sar4: ! ebx, descriptor address ! eax, index - pop ecx - pop edx ! base address - push ecx sub eax,(ebx) mov ecx,8(ebx) - push edx imul ecx - pop edx + pop ebx + pop edx ! base address add edx,eax sar ecx,1 jnb 1f - pop ebx pop eax movb (edx),al jmp ebx 1: sar ecx,1 jnb 1f - pop ebx pop eax o16 mov (edx),ax jmp ebx 1: - pop ebx xchg edi,edx ! edi = base address, edx is saved edi mov eax,esi mov esi,esp diff --git a/mach/i386/libem/set.s b/mach/i386/libem/set.s index 0f334bc37..3493eac52 100644 --- a/mach/i386/libem/set.s +++ b/mach/i386/libem/set.s @@ -13,9 +13,9 @@ push edi mov ebx,esp xor edi,edi - sar ecx,1 + sar ecx,2 1: - mov 4(ebx)(edi),edx + mov 8(ebx)(edi),edx add edi,4 loop 1b !endif diff --git a/mach/i386/libem/sti.s b/mach/i386/libem/sti.s index 4bd0e1a99..12385eedd 100644 --- a/mach/i386/libem/sti.s +++ b/mach/i386/libem/sti.s @@ -20,8 +20,10 @@ o16 mov (ebx),ax jmp edx 1: - mov ebx,edx + push edx mov edx,edi + mov edi,ebx + pop ebx jmp 1f .sti: ! only called with count >> 4 diff --git a/mach/i386/libem/stop.s b/mach/i386/libem/stop.s index fbf0e691e..16d55c612 100644 --- a/mach/i386/libem/stop.s +++ b/mach/i386/libem/stop.s @@ -2,4 +2,4 @@ .sect .text .define .stop .stop: - int 3 + jmp _exit diff --git a/mach/i386/libem/trp.s b/mach/i386/libem/trp.s index 4292fe30c..24af0e6f4 100644 --- a/mach/i386/libem/trp.s +++ b/mach/i386/libem/trp.s @@ -14,4 +14,5 @@ pop eax ret 2: + push eax call .stop