ack/mach/i386/libem/csa8.s
George Koehler 0b0c3d5b60 Add csa 8, csb 8 for i386, m68020.
This allows `long long x; switch (x) {...}` in C.  Add test in C.

This adapts the code for csa 8 and csb 8 from the existing code for
csa 4 and csb 4, for both i386 and m68020.
2019-09-27 12:15:10 -04:00

36 lines
587 B
ArmAsm

.sect .text; .sect .rom; .sect .data; .sect .bss
.define .csa8
.sect .text
.csa8:
! ebx, descriptor address
! edx:eax, index
mov ecx,(ebx) ! default
sub eax,4(ebx)
sbb edx,8(ebx) ! index - lower bound
push edx
push eax
mov eax,12(ebx)
mov edx,16(ebx) ! upper bound - lower bound
sub eax,(esp)
sbb edx,4(esp) ! upper bound - index
pop eax
pop edx
jb 1f ! jump if upper bound < index
! assuming edx:eax < 2**30
mov ebx,20(ebx)(eax*4)
test ebx,ebx
jnz 2f
1:
mov ebx,ecx
test ebx,ebx
jnz 2f
.extern ECASE
.extern .fat
mov eax,ECASE
push eax
jmp .fat
2:
jmp ebx