Does anyone see the bus error? I hate writing 32-bit assembly on a 64-bit machine:
It runs fine for small arrays, but once I try doing one over 1000, it starts throwing bus errors.Code:inline void Assembly(){ __asm__ __volatile__( " movl $1000000, %%ecx ;\n" //put the size of the table in here, don't reference it " myloop: ;\n" //beginning of my loop " movb 12(%0), %%ah ;\n" //char 4 " movb 8(%0), %%al ;\n" //char 3 " shl $16, %%eax ;\n" //can't access high bits directly, so shift these there for now " movb 4(%0), %%ah ;\n" //char 2 " movb (%0), %%al ;\n" //char 1 " movl %%eax, (%1) ;\n" //push it out to the destination " add $4, %1 ;\n" //move the dst ptr by 4 because we did 4 ata time " add $16, %0 ;\n" //move the src ptr by 16 " loop myloop ;\n" //loop until ecx is zero : //No output : "r" (src), //Let CGG decide what registers to assign these to "r" (dst) //Let GCC decide what registers to assign these to : "eax", "ecx" //these two get explicitly clobbred ); }




Reply With Quote