Re: [maemo-developers] automatic byte order check
Hi, I also tried to search for tools that could identify alignment problems automatically, but did not find anything useful. Probably the most easy way to make such tool is to modify valgrind to track alignment for each memory access operation. But don't know, I ended up finding and fixing such problems in my code manually without the help of any tools :) GCC can help, at least to an extent. See man gcc: ... -Wcast-align Warn whenever a pointer is cast such that the required alignment of the target is increased. For example, warn if a char * is cast to an int * on machines where integers can only be accessed at two- or four-byte boundaries. - Eero ___ maemo-developers mailing list maemo-developers@maemo.org https://maemo.org/mailman/listinfo/maemo-developers
Re: [maemo-developers] automatic byte order check
On Wed, Aug 23, 2006 at 10:52:58PM +0300, Siarhei Siamashka wrote: But ARM is alignment sensitive, so you may have problems because of bad alighment, I started making a page on wiki describing this issue (still very incomplete): http://maemo.org/maemowiki/PortingFromX86ToARM Thank you for that. I've added a couple of bits of information to that page. I was trying to port makeztxt when I encountered this issue. http://sourceforge.net/tracker/index.php?func=detailaid=1544995group_id=9595atid=109595 I also tried to search for tools that could identify alignment problems automatically, but did not find anything useful. Probably the most easy way to make such tool is to modify valgrind to track alignment for each memory access operation. But don't know, I ended up finding and fixing such problems in my code manually without the help of any tools :) That works better if you know the code. ;) I'll try -Wcast-align on makeztxt. Marius Gedminas -- Microsoft has performed an illegal operation and will be shut down. -- Judge Jackson signature.asc Description: Digital signature ___ maemo-developers mailing list maemo-developers@maemo.org https://maemo.org/mailman/listinfo/maemo-developers
Re: [maemo-developers] automatic byte order check
On Monday 21 August 2006 10:45, Detlef Schmicker wrote: I had a look at the vncviewer and saw, that it is working in the sandbox in connection with vino (gnome vnc server). On the device the CoRRE encoding does not work. Probably it is a byte order problem. The code has a lot of byte order (e.g. GUINT16_TO_BE). Is there a way to automaticaly warn critical points at compilation? Are there any tools? I'm not completely sure if understood your post correctly, but cpu used in Nokia 770 is little endian (the same as x86). So it is unlikely to have byte order or endian problems here. But ARM is alignment sensitive, so you may have problems because of bad alighment, I started making a page on wiki describing this issue (still very incomplete): http://maemo.org/maemowiki/PortingFromX86ToARM I also tried to search for tools that could identify alignment problems automatically, but did not find anything useful. Probably the most easy way to make such tool is to modify valgrind to track alignment for each memory access operation. But don't know, I ended up finding and fixing such problems in my code manually without the help of any tools :) ___ maemo-developers mailing list maemo-developers@maemo.org https://maemo.org/mailman/listinfo/maemo-developers
[maemo-developers] automatic byte order check
Hello, I had a look at the vncviewer and saw, that it is working in the sandbox in connection with vino (gnome vnc server). On the device the CoRRE encoding does not work. Probably it is a byte order problem. The code has a lot of byte order (e.g. GUINT16_TO_BE). Is there a way to automaticaly warn critical points at compilation? Are there any tools? Thanks a lot Detlef -- Detlef Schmicker [EMAIL PROTECTED] ___ maemo-developers mailing list maemo-developers@maemo.org https://maemo.org/mailman/listinfo/maemo-developers
Re: [maemo-developers] automatic byte order check
Hello, The (linux) kernel has endianess-aware integer types (__be_u16 or something similar) which allow the access to be checked for endianess problems (basically reading an endianess-annotated type into a non-endianess-specified (ie native endianess) type must go through a byte order macro). You have to annotate by hand all shared structures with these types. In your case, this would be all network-shared structures. I'm not sure the compiler does the check though, it may be an external tool. It could be however very interesting to generalize this outside of the kernel. JB -- Jean-Baptiste Note ___ maemo-developers mailing list maemo-developers@maemo.org https://maemo.org/mailman/listinfo/maemo-developers