Commit Diff


commit - 0ef78b60eb6409897f2bd36ec8382ffd7a4ca3ec
commit + e3a0381485bcc96a55ade7cb0130c6fa1295a20c
blob - 884330b6194faf72eaf12a1617d8742be1236b92
blob + 6edee2456449c766628b1d757ad82a9c86321223
--- sys/kernel.asm
+++ sys/kernel.asm
@@ -114,9 +114,6 @@ _entry:
 	lea dx, [i_timer]
 	call set_irq
 
-	lea bp, [hello]
-	call puts
-
 	lea bp, [convmsg]
 	call puts
 	mov ax, word [convmem]
@@ -133,8 +130,17 @@ _entry:
 
 	call floppy_init
 
-	sti
-	jmp $
+	; enter userspace, TODO: enter ring 3
+	mov ax, 0x10
+	mov ds, ax
+	mov es, ax,
+	mov ax, sp
+	push 0x10	; ss
+	push ax		; sp
+	push 0x202	; flags (EI | 0x02)
+	push 0x08	; cs
+	push task1	; ip
+	iret
 
 i_timer:
 	pusha
@@ -145,6 +151,11 @@ i_timer:
 	popa
 	iret
 
+task1:
+	lea bp, [hello]
+	call puts
+	jmp $
+
 ; al - num
 ; ah - attr
 ; dx - offset