小编Dru*_*ker的帖子

Linux x86 bootloader

我试图在nasm中构建一个简单的x86 Linux引导程序.

Linux bzImage从第一个扇区开始存储在磁盘分区sda1上.

我从bzImage(15个扇区)读取实际模式代码到0x7E00开始的内存中.但是,当我跳入代码时,它只是挂起,没有任何反应.

我已经在sda上为主启动记录创建了代码.如果我只是附上整件事,我可能是最好的.我想知道为什么它只是在跳远指令后挂起.

[BITS 16]

%define BOOTSEG 0x7C0 
%define BOOTADDR (BOOTSEG * 0x10)

%define HDRSEG (BOOTSEG + 0x20)
%define HDRADDR (HDRSEG * 0x10)

%define KERNSEG (HDRSEG + 0x20)

[ORG BOOTADDR]
entry_section:
    cli
    jmp     start
start:
    ; Clear segments
    xor     ax, ax
    mov     ds, ax  
    mov     es, ax
    mov     gs, ax
    mov     fs, ax
    mov     ss, ax
    mov     sp, BOOTADDR    ; Lots of room for it to grow down from here

    ; Read all 15 sectors of realmode …
Run Code Online (Sandbox Code Playgroud)

linux assembly kernel nasm 16-bit

5
推荐指数
1
解决办法
1167
查看次数

标签 统计

16-bit ×1

assembly ×1

kernel ×1

linux ×1

nasm ×1