-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
147 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,3 +46,5 @@ CR4_PKE = 0x0400000 | |
CR4_CET = 0x0800000 | ||
CR4_PKS = 0x1000000 | ||
|
||
CR = 0x0D | ||
LF = 0x0A |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,16 @@ | ||
struc console | ||
{ | ||
.buffer db 80*25 dup (?) | ||
.lineno db ? | ||
.colno db ? | ||
} | ||
VGA_COLUMNS = 80 | ||
VGA_LINES = 25 | ||
VGA_BASE = 0xC03B0000 | ||
|
||
vga_lineno db 0 | ||
vga_colno db 0 | ||
|
||
|
||
;; Function: vga_console_clear | ||
vga_console_clear: | ||
mov ecx, VGA_COLUMNS*VGA_LINES | ||
xor al, al | ||
mov edi, VGA_BASE | ||
rep stosb | ||
ret | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
struc TSS { | ||
.link dw ? | ||
.link_h dw ? | ||
.esp0 dd ? | ||
.ss0 dw ? | ||
.ss0_h dw ? | ||
.esp1 dd ? | ||
.ss1 dw ? | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,92 @@ | ||
CMOS_ADDRESS = 0x70 | ||
CMOS_DATA = 0x71 | ||
|
||
CMOS_REG_SECOND = 0x00 | ||
CMOS_REG_MINUTE = 0x02 | ||
CMOS_REG_HOUR = 0x04 | ||
|
||
COM1 = 0x3F8 | ||
|
||
klog_print: | ||
mov dx, COM1 | ||
@@: | ||
lodsb | ||
or al, al | ||
jz @f | ||
out dx, al | ||
jmp @b | ||
@@: | ||
ret | ||
|
||
klog_print_date: | ||
clc | ||
@@: | ||
mov al, 0x0A | ||
out CMOS_ADDRESS, al | ||
in al, CMOS_DATA | ||
and al, 0x80 | ||
jnz @b | ||
|
||
mov al, CMOS_REG_HOUR | ||
out CMOS_ADDRESS, al | ||
in al, CMOS_DATA | ||
|
||
mov ah, al | ||
shr ah, 4 | ||
and ah, 0xF | ||
and al, 0xF | ||
|
||
add ah, 0x30 | ||
add al, 0x30 | ||
mov [szTime + 1], ah | ||
mov [szTime + 2], al | ||
|
||
mov al, CMOS_REG_MINUTE | ||
out CMOS_ADDRESS, al | ||
in al, CMOS_DATA | ||
|
||
mov ah, al | ||
shr ah, 4 | ||
and ah, 0xF | ||
and al, 0xF | ||
|
||
add ah, 0x30 | ||
add al, 0x30 | ||
mov [szTime + 4], ah | ||
mov [szTime + 5], al | ||
|
||
mov al, CMOS_REG_SECOND | ||
out CMOS_ADDRESS, al | ||
in al, CMOS_DATA | ||
|
||
mov ah, al | ||
shr ah, 4 | ||
and ah, 0xF | ||
and al, 0xF | ||
|
||
add ah, 0x30 | ||
add al, 0x30 | ||
|
||
mov [szTime + 7], ah | ||
mov [szTime + 8], al | ||
|
||
|
||
push esi | ||
mov esi, szTime | ||
call klog_print | ||
pop esi | ||
|
||
ret | ||
|
||
macro KLOG_INIT { | ||
} | ||
;; Function: klog | ||
;; Output kernel log | ||
klog: | ||
call klog_print_date | ||
|
||
call klog_print | ||
|
||
mov esi, szCRLF | ||
call klog_print | ||
ret | ||
|
||
macro KLOG msg { | ||
out 0xe9, al | ||
} | ||
szTime db '[00:00:00] ', 0 | ||
szCRLF db CR, LF, 0 |