Re: memcpy(): alignment error

ba_f <[email protected]>
Newsgroups gmane.comp.micro-kernel.l4.devel
Organization Student TU-Darmstadt
Message-ID <[email protected]>
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-alignment-exceptions
> 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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.