-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkmain.s
50 lines (44 loc) · 1.06 KB
/
kmain.s
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
;;;;;;;;; File: kmain.s
;;;
;;; Description:
;;; Kernel main -- by the time we get here, we're in 64-bit mode,
;;; and the GDT has been set up for us.
;;;
;;; Author: Deborah Hooker
;;;
;;; Revision History:
;;; 11/03/11 - Initial version.
;;;
;;; Current Status: Experimental as hell
;;;
;;;;;;;;;
bits 64
section .text
global kmain
;;; Reserve initial kernel stack space
STACKSIZE equ 0x4000 ; 16k stack to start
kmain:
;; Make sure interrupts are clear until we get IDT set up.
cli
;; clear screen for now
;;mov edi, 0xB8000
;;mov rax, 0x1F201F201F201F20
;;mov ecx, 500
;;rep movsq
;;blah:
;;dd 'Istanbul, not Constantinople'
;;mov edi, 0xB8000
;;mov rsi, blah
;;mov ecx, 7
;;rep movsq
mov ax, 'I' | 0x0F << 8
mov [0xB8000], ax
mov ax, 's' | 0x0F << 8
mov [0xB8002], ax
hlt
;; mov esp, _sys_stack + STACKSIZE ; Point the stack at our new stack area.
;; BSS section. Right now, just the stack.
;;section .bss
;;align 4
_sys_stack:
;;resb STACKSIZE