Why is the boot loader stack segment at 0x3FF (end of Real Mode IVT)?

"0x500 address is the last used BIOS" that Wikipedia   is

"00000000-000003FF Real IVT Mode (Vector Interrupt Table)" is the osdev.org article on the BIOS memory card.

So can you tell me why NASM puts my .com file stack pointer at 0x3FF, while my command pointer starts at 0x7C00? For me, the most intuitive place for an SP would be right below 0x7C00.

+3
source share
4 answers

, (, , ) , BIOS.

, 3FFh BIOS. , IVT, , BIOS. .

BIOS
BIOS 30: 0000h - 30: 00FFh ( ). BIOS . INTs C0h FFh, AMIBIOS, .

AMIBIOS 1993, . 181

+3

, BIOSs . . :

[BITS 16]
[ORG 0x7C00]
xor ax,ax ;AX=0
mov ds,ax
mov es,ax ;can be omitted
mov ss,ax
mov sp,0x7000 ;or replace with some other nice valid piece of memory
jmp word 0:begin ;BIOSes are sometimes buggy and load you initially with CS=7C0
begin:
;....

NASM , , . . , , 1:1. , BIOS , , , . Nasm .

+1

NASM, , (- 0), SS: SP - .

: , 03FF?

0

, () ( , ).

Intel, , SP, . http://www.intel.com/design/pentiumii/manuals/243192.htm

, , SP ( ) - BIOS. , BIOSes " ", "" . Coreboot at http://www.coreboot.org/Welcome_to_coreboot , , , Coreboot, , , BIOS..

0

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


All Articles