Compare commits
No commits in common. "567a9388d8fe080ac608cc0380fbe5375159b0f9" and "7c8176688a2fd76cd9f56a402e2f536b5e752ed4" have entirely different histories.
567a9388d8
...
7c8176688a
8 changed files with 19 additions and 311 deletions
|
@ -2,10 +2,10 @@ TOPGOALS = all clean install
|
||||||
|
|
||||||
SUBDIRS = cmd
|
SUBDIRS = cmd
|
||||||
|
|
||||||
.PHONY: $(TOPGOALS)
|
|
||||||
$(TOPGOALS): $(SUBDIRS)
|
|
||||||
|
|
||||||
.PHONY: $(SUBDIRS)
|
.PHONY: $(SUBDIRS)
|
||||||
$(SUBDIRS):
|
$(SUBDIRS):
|
||||||
@echo "📁 bin/$@"
|
@echo "📁 bin/$@"
|
||||||
@DESTDIR=$(DESTDIR)/bin $(MAKE) -C $@ $(MAKECMDGOALS)
|
@DESTDIR=$(DESTDIR)/bin $(MAKE) -C $@ $(MAKECMDGOALS)
|
||||||
|
|
||||||
|
.PHONY: $(TOPGOALS)
|
||||||
|
$(TOPGOALS): $(SUBDIRS)
|
||||||
|
|
|
@ -2,10 +2,10 @@ TOPGOALS = all clean install
|
||||||
|
|
||||||
SUBDIRS = bootsect loader efi
|
SUBDIRS = bootsect loader efi
|
||||||
|
|
||||||
.PHONY: $(TOPGOALS)
|
|
||||||
$(TOPGOALS): $(SUBDIRS)
|
|
||||||
|
|
||||||
.PHONY: $(SUBDIRS)
|
.PHONY: $(SUBDIRS)
|
||||||
$(SUBDIRS):
|
$(SUBDIRS):
|
||||||
@echo "📁 boot/$@"
|
@echo "📁 boot/$@"
|
||||||
@DESTDIR=$(DESTDIR) $(MAKE) -C $@ $(MAKECMDGOALS)
|
@DESTDIR=$(DESTDIR) $(MAKE) -C $@ $(MAKECMDGOALS)
|
||||||
|
|
||||||
|
.PHONY: $(TOPGOALS)
|
||||||
|
$(TOPGOALS): $(SUBDIRS)
|
||||||
|
|
6
external/Makefile
vendored
6
external/Makefile
vendored
|
@ -2,10 +2,10 @@ TOPGOALS = all clean install
|
||||||
|
|
||||||
SUBDIRS =
|
SUBDIRS =
|
||||||
|
|
||||||
.PHONY: $(TOPGOALS)
|
|
||||||
$(TOPGOALS): $(SUBDIRS)
|
|
||||||
|
|
||||||
.PHONY: $(SUBDIRS)
|
.PHONY: $(SUBDIRS)
|
||||||
$(SUBDIRS):
|
$(SUBDIRS):
|
||||||
@echo "📁 external/$@"
|
@echo "📁 external/$@"
|
||||||
@DESTDIR=$(DESTDIR) $(MAKE) -C $@ $(MAKECMDGOALS)
|
@DESTDIR=$(DESTDIR) $(MAKE) -C $@ $(MAKECMDGOALS)
|
||||||
|
|
||||||
|
.PHONY: $(TOPGOALS)
|
||||||
|
$(TOPGOALS): $(SUBDIRS)
|
||||||
|
|
|
@ -39,9 +39,9 @@ kmain:
|
||||||
mov [0xC00B8008], dword 0x03640469
|
mov [0xC00B8008], dword 0x03640469
|
||||||
mov [0xC00B800C], dword 0x0153024F
|
mov [0xC00B800C], dword 0x0153024F
|
||||||
|
|
||||||
mov eax, szMsgKernelAlive
|
mov esi, szMsgKernelAlive
|
||||||
call klog
|
call klog
|
||||||
mov eax, szMsgBuildDate
|
mov esi, szMsgBuildDate
|
||||||
call klog
|
call klog
|
||||||
|
|
||||||
call mm_bootstrap
|
call mm_bootstrap
|
||||||
|
@ -118,7 +118,7 @@ kmain:
|
||||||
call klog
|
call klog
|
||||||
jmp .halt
|
jmp .halt
|
||||||
|
|
||||||
include 'klog.new.inc'
|
include 'klog.inc'
|
||||||
include 'dev/console.inc'
|
include 'dev/console.inc'
|
||||||
include 'dev/dev.inc'
|
include 'dev/dev.inc'
|
||||||
include 'mm/bootstrap.inc'
|
include 'mm/bootstrap.inc'
|
||||||
|
|
|
@ -1,292 +0,0 @@
|
||||||
;; File: klog.inc
|
|
||||||
;; Kernel logging utilities
|
|
||||||
;;
|
|
||||||
|
|
||||||
COM1 = 0x3F8
|
|
||||||
|
|
||||||
;; Function: _klog_print
|
|
||||||
;;
|
|
||||||
;; In: EAX - Null-terminated string to print
|
|
||||||
_klog_print_str:
|
|
||||||
push ebp
|
|
||||||
mov ebp, esp
|
|
||||||
|
|
||||||
push esi
|
|
||||||
mov dx, COM1
|
|
||||||
mov esi, eax
|
|
||||||
@@:
|
|
||||||
lodsb
|
|
||||||
or al, al
|
|
||||||
jz @f
|
|
||||||
out dx, al
|
|
||||||
|
|
||||||
pusha
|
|
||||||
call cga_putc
|
|
||||||
popa
|
|
||||||
|
|
||||||
jmp @b
|
|
||||||
@@:
|
|
||||||
pop esi
|
|
||||||
leave
|
|
||||||
ret
|
|
||||||
|
|
||||||
;; Function: _klog_print_int
|
|
||||||
;;
|
|
||||||
;; In:
|
|
||||||
;; EAX - number
|
|
||||||
_klog_print_int:
|
|
||||||
test eax, eax
|
|
||||||
js .print_minus
|
|
||||||
.print_minus:
|
|
||||||
ret
|
|
||||||
|
|
||||||
;; Function: _klog_print_unsigned
|
|
||||||
;;
|
|
||||||
;; In:
|
|
||||||
;; EAX - number
|
|
||||||
_klog_print_unsigned:
|
|
||||||
push ebx
|
|
||||||
mov ebx, 10
|
|
||||||
xor ecx, ecx
|
|
||||||
@@:
|
|
||||||
xor edx, edx
|
|
||||||
div ebx
|
|
||||||
push edx
|
|
||||||
inc ecx
|
|
||||||
or eax, eax
|
|
||||||
jnz @b
|
|
||||||
|
|
||||||
@@:
|
|
||||||
pop eax
|
|
||||||
add al, 0
|
|
||||||
mov dx, COM1
|
|
||||||
out dx, al
|
|
||||||
pusha
|
|
||||||
call cga_putc
|
|
||||||
popa
|
|
||||||
|
|
||||||
dec ecx
|
|
||||||
or cl, cl
|
|
||||||
jnz @b
|
|
||||||
|
|
||||||
pop ebx
|
|
||||||
|
|
||||||
ret
|
|
||||||
|
|
||||||
;; Function: _klog_print_hex
|
|
||||||
;;
|
|
||||||
;; In:
|
|
||||||
;; EAX - number
|
|
||||||
_klog_print_hex:
|
|
||||||
push ebp
|
|
||||||
mov ebp, esp
|
|
||||||
|
|
||||||
push edi
|
|
||||||
mov edi, eax
|
|
||||||
|
|
||||||
mov eax, szHexPrefix
|
|
||||||
call _klog_print_str
|
|
||||||
|
|
||||||
or edi, edi
|
|
||||||
jz .print_zero
|
|
||||||
|
|
||||||
xor cl, cl
|
|
||||||
.begin:
|
|
||||||
cmp cl, 8
|
|
||||||
je .print_number
|
|
||||||
rol edi, 4
|
|
||||||
mov eax, edi
|
|
||||||
and eax, 0xF
|
|
||||||
mov al, byte [sDigit + eax]
|
|
||||||
mov [szKlogBuffer + ecx], al
|
|
||||||
inc cl
|
|
||||||
jmp .begin
|
|
||||||
|
|
||||||
.print_zero:
|
|
||||||
mov al, '0'
|
|
||||||
mov dx, COM1
|
|
||||||
out dx, al
|
|
||||||
pusha
|
|
||||||
call cga_putc
|
|
||||||
popa
|
|
||||||
jmp .end
|
|
||||||
|
|
||||||
.print_number:
|
|
||||||
mov [szKlogBuffer + ecx], byte 0
|
|
||||||
mov eax, szKlogBuffer
|
|
||||||
call _klog_print_str
|
|
||||||
|
|
||||||
.end:
|
|
||||||
pop edi
|
|
||||||
leave
|
|
||||||
ret
|
|
||||||
|
|
||||||
;; Function: _klog_print_time
|
|
||||||
;;
|
|
||||||
_klog_print_time:
|
|
||||||
; wait CMOS ready
|
|
||||||
@@:
|
|
||||||
mov al, 0x0A
|
|
||||||
out CMOS_COMMAND, al
|
|
||||||
in al, CMOS_DATA
|
|
||||||
and al, 0x80
|
|
||||||
jnz @b
|
|
||||||
|
|
||||||
mov al, CMOS_REG_HOUR
|
|
||||||
out CMOS_COMMAND, 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_COMMAND, 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_COMMAND, 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
|
|
||||||
|
|
||||||
mov eax, szTime
|
|
||||||
call _klog_print_str
|
|
||||||
|
|
||||||
ret
|
|
||||||
|
|
||||||
;; Function: klog
|
|
||||||
;;
|
|
||||||
;; Output kernel log
|
|
||||||
;;
|
|
||||||
;; In:
|
|
||||||
;; EAX - null-terminated string
|
|
||||||
;; STACK[X] - var_arg
|
|
||||||
klog:
|
|
||||||
push ebp
|
|
||||||
mov ebp, esp
|
|
||||||
|
|
||||||
push esi
|
|
||||||
mov esi, eax
|
|
||||||
|
|
||||||
; display log time
|
|
||||||
call _klog_print_time
|
|
||||||
|
|
||||||
mov ecx, 4
|
|
||||||
.begin:
|
|
||||||
mov al, [esi]
|
|
||||||
or al, al
|
|
||||||
jz .end
|
|
||||||
; search for formating
|
|
||||||
cmp al, '%'
|
|
||||||
jne .putchar
|
|
||||||
; read next char
|
|
||||||
inc esi
|
|
||||||
mov al, [esi]
|
|
||||||
|
|
||||||
; check if another '%'
|
|
||||||
cmp al, '%'
|
|
||||||
je .putchar
|
|
||||||
|
|
||||||
; check if string format
|
|
||||||
cmp al, 's'
|
|
||||||
jne @f
|
|
||||||
; print string
|
|
||||||
mov eax, [ebp + ecx]
|
|
||||||
push ecx
|
|
||||||
call _klog_print_str
|
|
||||||
pop ecx
|
|
||||||
add ecx, 4
|
|
||||||
|
|
||||||
jmp .next
|
|
||||||
|
|
||||||
; check if hex format
|
|
||||||
@@:
|
|
||||||
cmp al, 'x'
|
|
||||||
jne @f
|
|
||||||
|
|
||||||
mov eax, [ebp + ecx]
|
|
||||||
push ecx
|
|
||||||
call _klog_print_hex
|
|
||||||
pop ecx
|
|
||||||
add ecx, 4
|
|
||||||
|
|
||||||
jmp .next
|
|
||||||
|
|
||||||
; check if int format
|
|
||||||
@@:
|
|
||||||
cmp al, 'd'
|
|
||||||
jne @f
|
|
||||||
|
|
||||||
mov eax, [ebp + ecx]
|
|
||||||
push ecx
|
|
||||||
call _klog_print_int
|
|
||||||
pop ecx
|
|
||||||
add ecx, 4
|
|
||||||
|
|
||||||
jmp .next
|
|
||||||
|
|
||||||
; check if unsigned
|
|
||||||
@@:
|
|
||||||
cmp al, 'u'
|
|
||||||
jne @f
|
|
||||||
|
|
||||||
mov eax, [ebp + ecx]
|
|
||||||
push ecx
|
|
||||||
call _klog_print_unsigned
|
|
||||||
pop ecx
|
|
||||||
add ecx, 4
|
|
||||||
|
|
||||||
jmp .next
|
|
||||||
|
|
||||||
; unknown format
|
|
||||||
@@:
|
|
||||||
mov al, '?'
|
|
||||||
|
|
||||||
.putchar: ; XXX: fix this mess
|
|
||||||
mov dx, COM1
|
|
||||||
out dx, al
|
|
||||||
pusha
|
|
||||||
call cga_putc
|
|
||||||
popa
|
|
||||||
|
|
||||||
.next:
|
|
||||||
inc esi
|
|
||||||
jmp .begin
|
|
||||||
|
|
||||||
.end:
|
|
||||||
mov eax, szCRLF
|
|
||||||
call _klog_print_str
|
|
||||||
|
|
||||||
leave
|
|
||||||
ret
|
|
||||||
|
|
||||||
szTime db '[00:00:00] ', 0
|
|
||||||
szCRLF db CR, LF, 0
|
|
||||||
sDigit db '0123456789ABCDEF'
|
|
||||||
szHexPrefix db '0x', 0
|
|
||||||
szKlogBuffer db '00000000', 0
|
|
|
@ -5,7 +5,7 @@
|
||||||
;; Setup recursive paging.
|
;; Setup recursive paging.
|
||||||
;; map page dir at 0xFFFFF000
|
;; map page dir at 0xFFFFF000
|
||||||
mm_bootstrap:
|
mm_bootstrap:
|
||||||
mov eax, szMsgMmBootstrap
|
mov esi, szMsgMmBootstrap
|
||||||
call klog
|
call klog
|
||||||
; 0x400000
|
; 0x400000
|
||||||
; PDE entry: 0x7ffc00 phys addr and curr virt addr: 0xc07ffc00
|
; PDE entry: 0x7ffc00 phys addr and curr virt addr: 0xc07ffc00
|
||||||
|
|
|
@ -2,10 +2,10 @@ SUBDIRS = csu crypto lzp c
|
||||||
|
|
||||||
TOPGOALS = all clean install
|
TOPGOALS = all clean install
|
||||||
|
|
||||||
.PHONY: $(TOPGOALS)
|
|
||||||
$(TOPGOALS): $(SUBDIRS)
|
|
||||||
|
|
||||||
.PHONY: $(SUBDIRS)
|
.PHONY: $(SUBDIRS)
|
||||||
$(SUBDIRS):
|
$(SUBDIRS):
|
||||||
@echo "📁 lib/$@"
|
@echo "📁 lib/$@"
|
||||||
@DESTDIR=$(DESTDIR) $(MAKE) -C $@ $(MAKECMDGOALS)
|
@DESTDIR=$(DESTDIR) $(MAKE) -C $@ $(MAKECMDGOALS)
|
||||||
|
|
||||||
|
.PHONY: $(TOPGOALS)
|
||||||
|
$(TOPGOALS): $(SUBDIRS)
|
||||||
|
|
|
@ -2,10 +2,10 @@ TOPGOALS = all clean install
|
||||||
|
|
||||||
SUBDIRS = dummy
|
SUBDIRS = dummy
|
||||||
|
|
||||||
.PHONY: $(TOPGOALS)
|
|
||||||
$(TOPGOALS): $(SUBDIRS)
|
|
||||||
|
|
||||||
.PHONY: $(SUBDIRS)
|
.PHONY: $(SUBDIRS)
|
||||||
$(SUBDIRS):
|
$(SUBDIRS):
|
||||||
@echo "📁 modules/$@"
|
@echo "📁 modules/$@"
|
||||||
@DESTDIR=$(DESTDIR) $(MAKE) -C $@ $(MAKECMDGOALS)
|
@DESTDIR=$(DESTDIR) $(MAKE) -C $@ $(MAKECMDGOALS)
|
||||||
|
|
||||||
|
.PHONY: $(TOPGOALS)
|
||||||
|
$(TOPGOALS): $(SUBDIRS)
|
||||||
|
|
Loading…
Reference in a new issue