2
我对这个引导加载程序非常陌生和困惑。我使用QEMU引导程序。我真的遇到了如何在NASM中加载内核或某些.asm文件的问题。我已经实现了我的内核文件,我想把它加载到我的启动文件中。在引导程序中加载内核
我只要按照互联网有什么用建立一个引导扇区说,我想出了这个:
[BITS 16]
[ORG 0x7C00]
mov [bootdrv], dl ;put drive number
;disable interrupt, set stack, enable interrupt
cli
mov ax, 0x9000
mov ss, ax
mov sp, 0
sti
...
*some code here nothing to do with loading
...
.load_kernel:
call read_kernel ; Load stuff from the bootdrive
jmp dword KERNEL_SEGMENT:0
read_kernel:
push ds
.reset:
mov ax, 0 ;reset disk
mov dl, [bootdrv] ;drive to reset
int 13h
jc .reset ;try again if fail
pop ds
.read:
*this is where I became confused and lost. I read that you should
locate your kernel and pass around using the bootdrv(drive number)
and return. I can't seem to understand.
任何答案将是非常有益因为我是真的失去了。
不错,看起来很简单。我可以一点一点地理解。重置已经实现并且堆栈设置良好。但是,它仍然不加载我的内核文件。什么似乎是问题?你能教我更多吗?如果您需要更清晰的信息,我可以将我的启动扇区编辑为整个nasm代码。 – ThisGuy
尝试使用一些调试环境。 – user35443