Hello L4-Hackers,
i get an "alignment error" when trying to memcpy().
The error occurs in a raw L4-Task (how do u "officially" name that?), no L4Linux.
However, the error comes with the following line:
memcpy(0x80006e80, 0x80006e84, 4);
And this is the message:
KERNEL0: alignment error at 80006ece (PC: 00079be8, SP: 80006b08, FSR: 410801, PSR: 60000010) No signal handler found
Any idea?
Thanks, again.
PS: I don't know if the Fiasco Debugger would help for this problem, but i didn't have time to learn working with it, yet. Sorry for that.
Hi,
On Tue Oct 14, 2014 at 20:48:59 +0200, ba_f wrote:
i get an "alignment error" when trying to memcpy().
The error occurs in a raw L4-Task (how do u "officially" name that?), no L4Linux.
However, the error comes with the following line:
memcpy(0x80006e80, 0x80006e84, 4);
And this is the message:
KERNEL0: alignment error at 80006ece (PC: 00079be8, SP: 80006b08, FSR: 410801, PSR: 60000010) No signal handler found
Any idea?
The alignment fault address is different (80006ece) from those mentioned in the memcpy (0x80006e80-0x80006e88). Are you sure it is the memcpy?
Adam
Hi,
Am 2014-10-19 23:48, schrieb Adam Lackorzynski:
The alignment fault address is different (80006ece) from those mentioned in the memcpy (0x80006e80-0x80006e88). Are you sure it is the memcpy?
Adam
oh sorry, that was a typo,
I do printf()-debugging.
#define STORE32N(buffer,offset,value) { printf("memcpy(%x, %x, 4);\n",&buffer[offset], &value); memcpy(&buffer[offset], &value, 4); printf("No error, yet???\n");}
And output is the following:
client | memcpy(80004e8e, 80004e3c, 4); KERNEL0: alignment error at 80004e8e (PC: 00077a00, SP: 80004ac0, FSR: 410801, PSR: 60000010) client | No signal handler found
printf("No error, yet???\n") is not reached. Client is broken, then.
Is there something special to consider, since running an l4re-App? Something like request_mem(), or editing a configuration file?
ba_f
Hi,
On Mon Oct 20, 2014 at 20:32:20 +0200, ba_f wrote:
Am 2014-10-19 23:48, schrieb Adam Lackorzynski:
The alignment fault address is different (80006ece) from those mentioned in the memcpy (0x80006e80-0x80006e88). Are you sure it is the memcpy?
Adam
I do printf()-debugging.
#define STORE32N(buffer,offset,value) { printf("memcpy(%x, %x, 4);\n",&buffer[offset], &value); memcpy(&buffer[offset], &value, 4); printf("No error, yet???\n");}
And output is the following:
client | memcpy(80004e8e, 80004e3c, 4); KERNEL0: alignment error at 80004e8e (PC: 00077a00, SP: 80004ac0, FSR: 410801, PSR: 60000010) client | No signal handler found
printf("No error, yet???\n") is not reached. Client is broken, then.
Ok, so there's an unaligned address for the destination. Maybe you're running into something like this: http://stackoverflow.com/questions/24883410/armcc-problems-with-memcpy-align... Assuming your buffer array is properly aligned on the stack, its data type size seems to be != 4 (smaller?), why copy 4 bytes there? And, why not just buffer[offset] = value? I'm sure the compiler would do it just right.
Is there something special to consider, since running an l4re-App? Something like request_mem(), or editing a configuration file?
No, it just has to work. You could switch off alignment checking in the Fiasco config to allow such unaligned accesses. Still, with the checking on, such alignment issues should not happen.
Adam
Thank you so much. This was exactly the fault.
Am 2014-10-21 23:31, schrieb Adam Lackorzynski:
Hi,
On Mon Oct 20, 2014 at 20:32:20 +0200, ba_f wrote:
Am 2014-10-19 23:48, schrieb Adam Lackorzynski:
The alignment fault address is different (80006ece) from those mentioned in the memcpy (0x80006e80-0x80006e88). Are you sure it is the memcpy?
Adam
I do printf()-debugging.
#define STORE32N(buffer,offset,value) { printf("memcpy(%x, %x, 4);\n",&buffer[offset], &value); memcpy(&buffer[offset], &value, 4); printf("No error, yet???\n");}
And output is the following:
client | memcpy(80004e8e, 80004e3c, 4); KERNEL0: alignment error at 80004e8e (PC: 00077a00, SP: 80004ac0, FSR: 410801, PSR: 60000010) client | No signal handler found
printf("No error, yet???\n") is not reached. Client is broken, then.
Ok, so there's an unaligned address for the destination. Maybe you're running into something like this: http://stackoverflow.com/questions/24883410/armcc-problems-with-memcpy-align... Assuming your buffer array is properly aligned on the stack, its data type size seems to be != 4 (smaller?), why copy 4 bytes there? And, why not just buffer[offset] = value? I'm sure the compiler would do it just right.
Is there something special to consider, since running an l4re-App? Something like request_mem(), or editing a configuration file?
No, it just has to work. You could switch off alignment checking in the Fiasco config to allow such unaligned accesses. Still, with the checking on, such alignment issues should not happen.
Adam
l4-hackers@os.inf.tu-dresden.de