Modules
Choose-OS supports OS-specific loader modules. Bootsector and Linux loaders exist at the moment.
A loader module must begin with the following:
.globl _main
.org LOADER_OFF
_main: jmp real_entry_point_of_this_module
.org LOADER_OFF+2
chos_id: .ascii "CHO"
chos_stage: .byte BIT_xxx|0x10
chos_major: .byte CHOS_MAJOR
chos_minor: .byte CHOS_MINOR
...
real_entry_point_of_this_module:
LOADER_OFF is 0x9000, so the assembled/compiled loader will be big, but the extra 0x9000
bytes+32 bytes of header will be stripped from the final raw loader. This way the OS-specific loaders can use the same segment as the 2nd stage loader - which is compiled at 0x8000 - does.
A loader is also required to include chos/module.h, which defines the addresses for
2nd stage loader exported variables and function pointer table entries.
Such functions should be called with the CALL(FN_NAME) macro.
Variables can be accessed normally.
References
Here are some good sources of information:
- Help-PC
- LILO documentation
- Almost any PC BIOS programming book