For unsigned numbers you can zero extend it by adding any number of 0s in front of it. So RSI
here is 0x0000000000000004
. SI
is the lower 16 bit of RSI
so it is 0x0004
.
RDI is 000000000000FFFE
EDI is 0000FFFE
DI is FFFE
RSI is 0000000000000004
ESI is 00000004
SI is 0004
All the registers store the number and don't contain any flag. In fact, the CPU cannot even tell whether a number is signed or unsigned.
The CPU has only one flags register, and it normally can only be set according to the result of an arithmetic or comparison operation. For example, moving 0xFFFE
to DI
has no effect on the flags. You have to use testw %di, %di
to compare DI
to itself and then the flags will be changed accordingly.
MOV DI, 0xFFFE ; flags are not changed
TEST DI, DI ; flags are changed according to the result of TEST
JZ .A ; will not jump because ZF (Zero Flag) is not set because DI is not zero
JS .B ; will jump because SF (Sign Flag) is set because the highest bit of DI is 1