From 9fc1cd006421fa1f615c0e1a62012b8782adcb23 Mon Sep 17 00:00:00 2001 From: Jarkko Toivanen Date: Mon, 24 Jul 2023 05:17:57 +0300 Subject: [PATCH] Passing the strings to string prints through stack --- src/serial.asm | 5 ++++- src/start32.asm | 11 ++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/serial.asm b/src/serial.asm index a7a1440..4f6585e 100644 --- a/src/serial.asm +++ b/src/serial.asm @@ -58,9 +58,11 @@ serialinit: ret serialwrite: + push ebp + mov ebp, esp pushad cld - mov esi, stuff.bootmsg + mov esi, [ebp+8] .loop: mov dx, SERIAL_PORT+5 .wait: @@ -75,6 +77,7 @@ serialwrite: jmp .loop .done: popad + pop ebp ret serialiniterror: diff --git a/src/start32.asm b/src/start32.asm index dbc14a0..fc19dc0 100644 --- a/src/start32.asm +++ b/src/start32.asm @@ -38,10 +38,11 @@ start: mov byte [0xb8000], '!' - mov esi, stuff.bootmsg - call serialinit + push stuff.bootmsg call printbootmsg + call serialinit call serialwrite + add esp, 4 jmp hang @@ -66,7 +67,10 @@ multibootnomagic: .msg db "No multiboot magic", 0 printbootmsg: + push ebp + mov ebp, esp pushad + mov esi, [ebp+8] mov edi, 0xb8000 cld .loop: @@ -78,12 +82,13 @@ printbootmsg: jmp .loop .done: popad + pop ebp ret include "src/serial.asm" stuff: - .bootmsg db "=== KoalemOS ===", 0 + .bootmsg db "=== KoalemOS ===", 10, 0 stack_bottom: