chore: kernel module ?

This commit is contained in:
d0p1 🏳️‍⚧️ 2024-07-08 19:20:24 +02:00
parent c5ea67ad1d
commit 80aca5ee8a
5 changed files with 65 additions and 1 deletions

10
kernel/pic.inc Normal file
View file

@ -0,0 +1,10 @@
PIC1_COMMAND = 0x20
PIC1_DATA = 0x21
PIC2_COMMAND = 0xA0
PIC2_DATA = 0xA1
PIC_EOI = 0x20
pic_init:
ret

10
kernel/sys/coff.inc Normal file
View file

@ -0,0 +1,10 @@
struc COFFFileHdr {
.f_magic dw ?
.f_nscns dw ?
.f_timdat dd ?
.f_symptr dd ?
.f_nsyms dd ?
.f_opthdr dw ?
.f_flags dw ?
}

View file

@ -4,7 +4,7 @@ SUBDIRS = dummy
.PHONY: $(SUBDIRS)
$(SUBDIRS):
@echo "📁 boot/$@"
@echo "📁 modules/$@"
@DESTDIR=$(DESTDIR) $(MAKE) -C $@ $(MAKECMDGOALS)
.PHONY: $(TOPGOALS)

View file

@ -1,2 +1,21 @@
format COFF
use32
include '../module.inc'
section '.text' code
public module_init
module_init:
ret
public module_exit
module_exit:
ret
MODULE_INFO_BEGIN
MODULE_AUTHOR "d0p1"
MODULE_DESCRIPTION "Dummy module"
MODULE_LICENSE "BSD-3-Clause"
MODULE_VERSION "1.0"

25
modules/module.inc Normal file
View file

@ -0,0 +1,25 @@
macro MODULE_INFO_BEGIN {
section '.modinfo' data
}
macro MODULE_INFO tag,value {
public module_#tag
module_#tag db `value#, 0
}
macro MODULE_AUTHOR value {
MODULE_INFO author, value
}
macro MODULE_VERSION value {
MODULE_INFO version, value
}
macro MODULE_LICENSE value {
MODULE_INFO license, value
}
macro MODULE_DESCRIPTION value {
MODULE_INFO description, value
}