HARD-CODED = fix data or parameter that cannot be altered without modifying the program
ORTHOGONAL
the Instructions associated fields have a standard size, this favors the alignment of the instructions in the
memory and the speed of the microprocessor.
LITTLE ENDIAN
MEMORY LOCATION = 1 Byte = 2 Nibble = 2 Hex Digit
eg: the decimal number 999 corresponds to the hexadecimal number 3E7.
How does 3E7 is inserted into a little-endian memory?
More sgnificant digit, id est 3, must be inserted in higher location of the memory, while the less
significant double digit=1 byte, id est E7, must be in a lower location. Since
the memory address grows with each insertion, 03 is inserted first, then E7 is inserted.
The result is bizarre: the number E703 is actually the hexadecimal 3E7!
LIST FILE
LITTLE ENDIAN
FUNCTION , PROCEDURE
Difference:
Function can return a value
Procedure does not return a value
LEAF function does not call other functions.
Leaf function is always at the end of the calling sequence
the Compiler takes advantage of this information!
Else it is a NON-LEAF function!
IA32
processor
For each operation that is performed in the processor, there must be a mechanism to determine whether
the operation was successful or not. The processor flags are used to perform this function.
The control bus is used to synchronize the functions between the processor and the individual system
elements.
C7 45 FC 01 00 00 00
defines the opcode C7, which is the instruction to move a value to a memory location.
The memory location
is defined by the 45 FC modifier (which defines –4 bytes (the FC value) from the memory location
pointed to by the value in the EBP register (the 45 value).
The final 4 bytes define the integer value that is
placed in that memory location (in this case, the value 1).
the value 1 was written as the 4-byte hexadecimal value 01 00 00 00.
The order of the bytes in the data stream depends on the type of processor used. The IA-32 platform processors
use “little-endian” notation, whereby the lower-value bytes appear first in order (when reading
left to right).
Then the blocks of 4 bytes ( ia32) or 8 byte ( ia64 or amd64) are placed from low address to high address.
Instead, exceptionally not so in Stack memory, where this order is reversed ( the first block 32 or 62 block is inserted on the higher address , then it flows to the lower address)
Other processors use “big-endian” order, whereby the higher-value bytes appear first in
order.
OPCODE
DATA
DIRECTIVES
x &var
print $reg
cpuid0.s , cpuidc.s
When the value of zero is placed in the EAX register, and the CPUID instruction
is executed, the processor returns the Vendor ID string in the EBX, EDX , and ECX registers as follows:
❑ EBX contains the low 4 bytes of the string.
❑ EDX contains the middle 4 bytes of the string.
❑ ECX contains the last 4 bytes of the string.
The string values are placed in the registers in LITTLE ENDIAN format; thus, the first part of the string is
placed in the lower bits of the register.
cpuid0 , cpuid1 , cpuid3
c.s , c
ph.c , ph.exe , c.as.c , c.as.exe ,
exa.c , exa.exe
.type area, @function # in linux
.def @function # in windows