Forwarding here just in case someone stumbles on this thread. Forgot to reply-all :(
---------- Forwarded message ---------- From: Alexander Tarasikov alexander.tarasikov@gmail.com Date: Mon, Feb 1, 2016 at 10:28 PM Subject: Re: 'Illegal Instruction' on L4Linux To: ba_f ba_f@rbg.informatik.tu-darmstadt.de
On Mon, Feb 1, 2016 at 8:53 PM, ba_f ba_f@rbg.informatik.tu-darmstadt.de wrote:
Hello,
i have an issue with apps running on L4Linux.
/usr/bin # ./helloWorld Illegal instruction
Actually, on the current l4re-snapshot-2015123115 my apps run without problem. But, on l4re-snapshot-2014022818 or l4re-snapshot-2014092821 the same app don't works. All apps say 'Illegal instruction'.
I've built for Zynq.
Any idea what's wrong?
You have not provided enough information. For example, how you compile Fiasco, L4Re and L4Linux. My experience with L4Re tells me you probably forgot to enable VFP/NEON in configuration options - check the menuconfig for Fiasco, L4Re and L4Linux. Most likely what happened is that the newer toolchain is by default using the "hardfloat" ABI and the compiler generates VFP/NEON instructions.
If that fails, I suggest that you try debugging it yourself Therefore, there are several places you should look at:
1) First, you could try running the app under gdb. It will then print the stack trace and point to the offending instruction.
2) You could also install a SIGILL handler in your app and see what's the actual instruction causing the fault. I have an example code here - https://gist.github.com/astarasikov/9369538#file-arm-sigill-example-L71. It's actually a complicated example that patches the code at runtime. What you need to look at is at the following lines in "my_sh": # ucontext_t *uc = (ucontext_t*)data; # struct sigcontext *ctx = &(((ucontext_t*)uc)->uc_mcontext); # ctx->arm_pc; //this is the address of the instruction. You can printf it (as an unsigned integer) and decode the instruction.
3) If that fails, you could patch the invalid opcode handler in kernel to print the instruction. You should grep "arch/arm" and "arch/l4" for "SIGILL". Then, you can add the code to the trap handler. Alternatively, if you build kernel with CONFIG_DEBUG and CONFIG_DEBUG_USER, you will be able to see the stack trace and the hex dump of the instruction in the "dmesg" (or on the serial port console).
(My project is stable on the old snapshots, that's why i try to avoid migrating to current snapshot.)
thanks, ba_f
l4-hackers mailing list l4-hackers@os.inf.tu-dresden.de http://os.inf.tu-dresden.de/mailman/listinfo/l4-hackers
-- Regards, Alexander
Thanks,
indeed VFP wasn't enabled in CONFIG. I thought ARMv6 doesn't support VFP, and my L4Linux is built for ARMv6. Anyway...
ba_f
Am 2016-02-01 20:29, schrieb Alexander Tarasikov:
Forwarding here just in case someone stumbles on this thread. Forgot to reply-all :(
---------- Forwarded message ---------- From: Alexander Tarasikov alexander.tarasikov@gmail.com Date: Mon, Feb 1, 2016 at 10:28 PM Subject: Re: 'Illegal Instruction' on L4Linux To: ba_f ba_f@rbg.informatik.tu-darmstadt.de
On Mon, Feb 1, 2016 at 8:53 PM, ba_f ba_f@rbg.informatik.tu-darmstadt.de wrote:
Hello,
i have an issue with apps running on L4Linux.
/usr/bin # ./helloWorld Illegal instruction
Actually, on the current l4re-snapshot-2015123115 my apps run without problem. But, on l4re-snapshot-2014022818 or l4re-snapshot-2014092821 the same app don't works. All apps say 'Illegal instruction'.
I've built for Zynq.
Any idea what's wrong?
You have not provided enough information. For example, how you compile Fiasco, L4Re and L4Linux. My experience with L4Re tells me you probably forgot to enable VFP/NEON in configuration options - check the menuconfig for Fiasco, L4Re and L4Linux. Most likely what happened is that the newer toolchain is by default using the "hardfloat" ABI and the compiler generates VFP/NEON instructions.
If that fails, I suggest that you try debugging it yourself Therefore, there are several places you should look at:
- First, you could try running the app under gdb. It will then print
the stack trace and point to the offending instruction.
- You could also install a SIGILL handler in your app and see what's
the actual instruction causing the fault. I have an example code here
https://gist.github.com/astarasikov/9369538#file-arm-sigill-example-L71. It's actually a complicated example that patches the code at runtime. What you need to look at is at the following lines in "my_sh": # ucontext_t *uc = (ucontext_t*)data; # struct sigcontext *ctx = &(((ucontext_t*)uc)->uc_mcontext); # ctx->arm_pc; //this is the address of the instruction. You can printf it (as an unsigned integer) and decode the instruction.
- If that fails, you could patch the invalid opcode handler in kernel
to print the instruction. You should grep "arch/arm" and "arch/l4" for "SIGILL". Then, you can add the code to the trap handler. Alternatively, if you build kernel with CONFIG_DEBUG and CONFIG_DEBUG_USER, you will be able to see the stack trace and the hex dump of the instruction in the "dmesg" (or on the serial port console).
(My project is stable on the old snapshots, that's why i try to avoid migrating to current snapshot.)
thanks, ba_f
l4-hackers mailing list l4-hackers@os.inf.tu-dresden.de http://os.inf.tu-dresden.de/mailman/listinfo/l4-hackers
-- Regards, Alexander
Hello again,
as mentioned before i'm writing a char module for L4linux.
I want the L4Linux driver to communicate over l4_ipc to another L4-Task.
Well, there's a compiler error:
Building modules, stage 2. MODPOST 1 modules ERROR: "l4_utcb_wrap" [drivers/char/myDrv.ko] undefined!
This appears, when trying to write in mr[].
l4_msg_regs_t* mregs = l4_utcb_mr_u(utcb); mregs->mr[0] = 23; // if i comment this line, build works.
I doesn't crash at runtime, it just don't compile. Any idea?
BTW: Adam made a hint to use L4XV_FN* wrappers. When to use them, and what are they for?
Thanks, ba_f
Am 2016-02-03 18:40, schrieb ba_f:
I want the L4Linux driver to communicate over l4_ipc to another L4-Task.
Well, there's a compiler error:
Building modules, stage 2. MODPOST 1 modules ERROR: "l4_utcb_wrap" [drivers/char/myDrv.ko] undefined!
This appears, when trying to write in mr[].
l4_msg_regs_t* mregs = l4_utcb_mr_u(utcb); mregs->mr[0] = 23; // if i comment this line, build works.
Ok, this seems to be a Bug in the old l4re-snapshot-2014022818.
Building the L4Linux module works on the current snapshot, though.
Damn, I don't want to migrate...
Greets,
ba_f
l4-hackers@os.inf.tu-dresden.de