jan 07 2013 21:24:26 <awulms> its in BitmapConverter function
jan 07 2013 21:25:34 <wouter__> some misaligned read error?
jan 07 2013 21:26:50 <awulms> yes, its in some asm code
jan 07 2013 21:27:10 <awulms> Its line 156 of src/video/BitmapConverter.cc
jan 07 2013 21:27:33 <awulms> which is the close statement for some arm asm block
jan 07 2013 21:28:59 <wouter__> both vramPtr0 and pixelPtr must be 4-byte aligned for this asm function
jan 07 2013 21:54:38 <wouter__> mips and arm are two cpu architectures (like x86 is another one) .... so indeed the asm code is not used on mips, but even the c++ code contains misaslined accesses
jan 07 2013 21:55:06 <awulms> the C++ compiler will probably handle it when generating the asm code
jan 07 2013 21:55:40 <wouter__> no, we explicitly cast a pointer to 16-bit data to a ptr to 32-bit data
jan 07 2013 21:55:42 <awulms> by generating aligned instructions like 'do an aligned read, update correct bits in the register, do an aligned write'
jan 07 2013 21:56:23 <wouter__> when dereferencing a 32-bit pointer, the compiler will not add extra code for the case it might be misaligned
jan 07 2013 21:56:29 <awulms> maybe the C-compiler is smart enough to see through it
jan 07 2013 21:57:24 <wouter__> 'normally' the c++ compiler doesn't allow to do such unsafe ptr conversions, but we used a 'reinterpret_cast'. So basically telling the compiler "trust me i know what i'm doing"
jan 07 2013 21:57:42 <wouter__> (but apparently i didn't really know ;-)
jan 07 2013 21:58:17 <Vampier> hahaha
jan 07 2013 21:58:23 <awulms> assertion "(reinterpret_cast<long>(pixelPtr) & 3) == 0" failed
jan 07 2013 22:00:44 <wouter__> the c++ is code is wrong .. even if it happens to work on this combination of cpu/compiler/platform (which i don't think it will), it may still go wrong on a slightly different combination
jan 07 2013 22:05:46 <wouter__> ah .. i see what's going on ... starting from ARMv6, the ARM architecture CAN perform misaligned load/stores, but only single word load/stores ... the asm version uses the 'stm' instruction (store-multiple)
jan 07 2013 22:07:12 <wouter__> so the c++ is technically still wrong, but it happens to work on x86 and on armv6 with this version of gcc (when gcc optimizes harder and uses stm instructioms, it will also crash)