duskos

dusk os fork
git clone git://git.alexwennerberg.com/duskos
Log | Files | Refs | README | LICENSE

commit 7ace281ae6f33e2fb3187798aa38fb79a77e4b2f
parent 680f048fdcac752079cc1894bad964ca02cef385
Author: Virgil Dupras <hsoft@hardcoded.net>
Date:   Wed,  1 Jun 2022 13:51:40 -0400

nasm branch: first steps

The CVM-like approach is a dead end. Calling C code from within it is probably
possible, but it would be kludgy and, in any case, wouldn't be the way we do
things when Dusk OS is bare metal. It's better to start with a more solid base,
that is, boot code in assembly so that we have more control over how stacks
and registers work.

Diffstat:
Adusk.asm | 17+++++++++++++++++
Awords/boot.asm | 13+++++++++++++
Awords/bye.asm | 5+++++
3 files changed, 35 insertions(+), 0 deletions(-)

diff --git a/dusk.asm b/dusk.asm @@ -0,0 +1,17 @@ +BITS 32 +%define PS_SZ 4096 +%define RS_SZ 4096 +SECTION .bss + resd RS_SZ +rs_top: + resd PS_SZ +ps_top: +SECTION .text + GLOBAL _start + EXTERN word_boot + EXTERN word_bye + +_start: + cld + call word_boot + call word_bye diff --git a/words/boot.asm b/words/boot.asm @@ -0,0 +1,13 @@ +GLOBAL word_boot +SECTION .data +hello: db 'Hello world!',10 +len: equ $-hello + +SECTION .text +word_boot: + mov eax,4 ; 'write' syscall + mov ebx,1 ; stdout + mov ecx,hello + mov edx,len + int 80h + ret diff --git a/words/bye.asm b/words/bye.asm @@ -0,0 +1,5 @@ +GLOBAL word_bye +word_bye: + mov eax,1 ; 'exit' system call + mov ebx,0 ; exit with error code 0 + int 80h ; call the kernel