Question: how many bytes will be written into sum? Will everything crash?
int sum; mov [sum],10; add [sum],50;
Answer: no idea. This is very bad situation, because “10″ is 1 byte, so mov/add will use only lower 1 byte of sum variable.
How to properly do it:
mov [sum],64bit 10; add [sum],64bit 50;
HybriC assembler isn’t smart. You are.
32bit int var; int sum;
mov [var],r0; //ERROR: R0 is 8 bytes, not 4
mov [var],r0.32[0]; //R0.32 are 4-byte registers
mov [var],[sum]; //UNDEFINED SITUATION. if "sum" pointer is 64-bit, then 8 bytes
are copied. if "sum" pointer is 32-bit, then 4 bytes are copied. Etc.
These are some dangers waiting for those who wish code on low level of virutal machine. Standart opcodes always assume size of operation equals to size of second operand.
Recent comments