BZ #62: ARM Linux kernels compiled with EABI + OABI_COMPAT breaks swi EABI call

Status fields:

creation_ts:2008-04-10 13:19
component:jit
version:default branch
rep_platform:arm
op_sys:Linux
bug_status:RESOLVED
resolution:FIXED
reporter:xerxes@zafena.se
If new Linux kernels are compiled with EABI + OABI_COMPAT then EABI swi calls breaks.
With OABI_COMPAT included (it gets enabled default when enabeling EABI in linux kernel
configuration) The kernel looks on the adress passed with the swi instruction to
determine if it is a EABI or OABI call.

If swi passes 0 then the kernel thinks it is a EABI call

With an adress passed with swi the kernel thinks it is a OABI call and this breaks the
code on EABI systems since the jit cacheflush code allways passes an adress with the swi
instruction.

A quick fix is to disable OABI_COMPAT support and recompile the linux kernel since this
disables the swi check in the kernel.

Comment #1 by twisti@complang.tuwien.ac.at on 2008-04-10 14:59:37

Is the problem fixed for you when you apply the following patch:

diff -r 3ac1ce7dadb2 src/vm/jit/arm/asmpart.S
--- a/src/vm/jit/arm/asmpart.S  Wed Apr 02 15:34:17 2008 +0200
+++ b/src/vm/jit/arm/asmpart.S  Thu Apr 10 14:59:00 2008 +0200
@@ -323,7 +323,7 @@ asm_cacheflush:
        mov   a1, #0xff000000
 #endif

-       swi   sys_cacheflush
+       swi   0x0000

 #if defined(__ARM_EABI__)
        ldmfd sp!, {r7}

Comment #2 by thebohemian@gmx.net on 2008-04-10 16:39:25

Created an attachment (id=38)
fix

I am using this patch for a while on the OM-GTA01 and Nokia N770/800 which run EABI
kernels.

It executes 'swi 0' to let the kernel think it is EABI. I think I got the idea from
libffi.

Comment #3 by twisti@complang.tuwien.ac.at on 2008-04-10 16:59:43

Robert, thanks for posting again and verifying this.  I'll commit this fix.

Comment #4 by twisti@complang.tuwien.ac.at on 2008-04-10 17:59:45

This changeset should fix the bug:

http://mips.complang.tuwien.ac.at/hg/cacao/rev/ec144df42ca1

Attachment id=38

date:2008-04-10 16:39
desc:fix
type:text/x-diff
download:cacao-fix-cacheflush.diff