From d7c1781d2fd357f844e3159775a3dc64aa6237fc Mon Sep 17 00:00:00 2001 From: Nero <41307858+nero@users.noreply.github.com> Date: Thu, 18 Feb 2021 20:20:40 +0000 Subject: [PATCH] mbr: set up first 7 bytes of kernel PSP --- boot/mbr.asm | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/boot/mbr.asm b/boot/mbr.asm index 432f8ee..135763f 100644 --- a/boot/mbr.asm +++ b/boot/mbr.asm @@ -6,10 +6,12 @@ init: cli mov ax, seg - mov ss, ax mov ds, ax mov es, ax + mov ss, ax xor sp, sp + mov ax, sp + push ax .retry: mov ax, 0x0208 mov cx, 2 @@ -19,6 +21,18 @@ init: cli int 0x13 jc .retry + xor di, di + mov ax, 0x18CD + stosw + int 0x12 + mov cl, 6 + shl ax, cl + stosw + mov al, 2 + stosb + mov ax, 0x18CD + stosw + jmp seg:0x100 times (0x1BE - ($-$$)) db 0