Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ===driver support in 0x42c-kernel===
- ---ExampleDriver.asm---
- .dw stack_size ; Size of stack that this driver needs
- .dw driver_id
- ; ---Everything past this point is loaded into RAM when the driver is loaded---
- .dw interrupt_handler ; Pointer to handler
- ; Jump table
- SET PC, subroutine1
- SET PC, subroutine2
- SET PC, subroutine3 ; These are relative and made absolute when the driver is loaded
- .dw 0xFFFF ; Signals the end of the jump table for the loader
- ; Relocation table goes here
- interrupt_handler: ; Called when the device this driver supports triggers an interrupt
- ; handle interrupt...
- SET PC, POP
- subroutine1:
- ; ...etc...
- ---Kernel-level---
- All devices are told to use their device number as the interrupt message (assuming the device supports being told this).
- When an interrupt with that message is fired, the appropriate driver will handle it.
- All drivers are loaded into RAM and made absolute. They must specify an interrupt handler, and may specify any number of subroutines.
- A program may use the kernel routine kernel_device_loaded with a device ID (32 bit) to see if a device is plugged in and has a loaded driver.
- The OS bootloader will load drivers for all connected devices through the kernel via kernel_load_driver.
- A program may use a driver subroutine in a similar fashion to how it uses library subroutines.
Advertisement
Add Comment
Please, Sign In to add comment