Computer
Systems

Fall 2010
course
navigation

Isaac Byte Memory Assembler

Did `gcc -m32 -save-temps -O2 byte.c -o byte` (on my linux). It looks like even the disassembler *does* have to specify movzbl from memory and movb to memory, when you are really only storing/loading exactly one byte (and not an "l" i.e. 4 bytes).
Look at code and assember.
byte.s (with -O2) contains poof: pushl %ebp movzbl 3309603, %eax movl %esp, %ebp movb $9, 3309603 popl %ebp ret
(gdb) disass poof Dump of assembler code for function poof: 0x08048390 <+0>: push %ebp 0x08048391 <+1>: movzbl 0x328023,%eax 0x08048398 <+8>: mov %esp,%ebp 0x0804839a <+10>: movb $0x9,0x328023 0x080483a1 <+17>: pop %ebp 0x080483a2 <+18>: ret
for variety, also `objdump -d byte` contains 08048390 <poof>: 8048390: 55 push %ebp 8048391: 0f b6 05 23 80 32 00 movzbl 0x328023,%eax 8048398: 89 e5 mov %esp,%ebp 804839a: c6 05 23 80 32 00 09 movb $0x9,0x328023 80483a1: 5d pop %ebp 80483a2: c3 ret
http://cs.marlboro.edu/ courses/ fall2010/systems/ wiki/ Isaac_Byte_Memory_Assembler
last modified Thursday April 5 2012 11:10 am EDT

attachments [paper clip]

     name last modified size
[COD]byte.c Oct 5 2010 12:48 pm 141B    byte.s Oct 5 2010 12:48 pm 547B