I have a problem in my code and I don't know how to fix it. The problem appears only in target device.
Here is the fuction what causes the kern-exec 3 panic in my target device. aBuffer is a message which comes from the socket. It contains variable number of submessages which starts with ** and end with *
(example aBuffer = **submessage***submessage*.. and so on). Every submessage contains a struct and when the submessage is handled the information what is in it is sended to DecodeMessage().
Problem is that, when the execution goes to second round of the while loop and the i happends to be uneven dereferencing of resp causes a panic and that is because the uTotalLength is on the previous round even. When i is even there is no problem. Problem happends because the resp isn't a 32-bit multiple and that's why the code is valid in the emulator.
Yes, it's definitely a memory alignment issue. x86 does not care about alignment (although accessing unaligned addresses is slower due to multiple reads/writes) while the ARM version raises an exception that manifests as KERN-EXEC 3.
Mem::Copy() if done right will help. Please tell what you have tried. Another common way to make it work is to wrap the message object in a TPckgBuf.