The default value for registers and segments when loading the x86 machine

I found that usually programmers fix registers (and sometimes segments) on their first lines of bootloaders, and they usually advise for this. For instance:

inc cx
dec bx
inc bp
dec di
xor ax, ax

Interestingly, I know: the BIOS clears all registers during the boot procedure.

Is it good to initialize registers and segments in the bootloader? If so, what are the default values ​​for registers, segments, and pointers (perhaps dependent on the chipset)?

+4
source share
1 answer

, 16- , , IBM-PC (PC-BIOS), (EFI/UEFI). , , .

, PC-BIOS , , , . ( 100% BIOS) 80- 90- , DL , BIOS. Int 13h .

SS: SP, , - , , BIOS BIOS. (SS SP), . , .

, CS: IP 0x0000: 0x7c00 (CS = 0x0000, IP = 0x7c00), ( FAR JMP). , . , 0x07c0: 0x0000, 0x07c00 (0x07c0 < 4 + 0x0000). , : (, 0x07c00). fooobar.com/questions/1013758/..., , CS 0x0000 .

(DF FLAGS), (, CMPS MOVS) . (DF = 0), , , BIOS , . - CLD STD .

DL-, , - . , , . .

.

+3

Source: https://habr.com/ru/post/1674619/


All Articles