commit - c9ad2767fdfae51606a3b82616d01cac7f95c48f
commit + 0f506373f15f67c731d7b80da73b274c3ff18751
blob - 95e6777aae58e7826cd2dc097e524ad0bdd72eea
blob + 12db8b6bef90a4698f8c52f6f7869d6ff58f2e0f
--- sys/kernel.asm
+++ sys/kernel.asm
smsw ax
or ax, 1
lmsw ax
- jmp 0x08:.reloadcs
+ jmp (gdt.text - gdt):.reloadcs
.reloadcs:
lea sp, [stack]
- mov ax, 0x10
+ lea ax, [gdt.data - gdt]
mov ds, ax
mov es, ax
mov ss, ax
; set up TSS
mov word [tss + TSS.link], 0
mov word [tss + TSS.sp0], stack
- mov word [tss + TSS.ss0], 0x10
+ mov word [tss + TSS.ss0], (gdt.data - gdt)
; load TSS into TR
lea ax, [gdt.tss - gdt]
ltr ax
; enter userspace, TODO: enter ring 3
- mov ax, 0x10
+ lea ax, [gdt.data - gdt]
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
+ mov bx, sp
+ push ax ; ss
+ push bx ; sp
+ push 0x202 ; flags (EI | 0x02)
+ push (gdt.text - gdt) ; cs
+ push task1 ; ip
iret
i_timer:
shl bx, 3
lea bx, [idt + bx]
mov word [bx + 0], dx
- mov word [bx + 2], 0x08
+ mov word [bx + 2], (gdt.text - gdt)
mov byte [bx + 4], 0x00
mov byte [bx + 5], ah
mov word [bx + 6], 0
; al - char
writech:
- mov bx, 0x18
+ lea bx, [gdt.vid - gdt]
mov es, bx
xor ch, ch