Andy-Python-Programmer / aero

Aero is a new modern, experimental, UNIX-like operating system following the monolithic kernel design. Supporting modern PC features such as long mode, 5-level paging, and SMP (multicore), to name a few.
https://aero.andypy.dev
GNU General Public License v3.0
1.17k stars 50 forks source link

creating kernel "modules" #41

Closed YusufKhan-gamedev closed 2 years ago

YusufKhan-gamedev commented 2 years ago

How would I access the kernel interfaces with kernel privileges (i.e. make a kernel module) in aero?

Andy-Python-Programmer commented 2 years ago

For a simple hello world kernel module example which is directly linked into a modules section in the kernel itself:

  1. Create a new in src/aero_kernel/src/drivers/, we will call it hello.rs
  2. Register the init module function.
    
    fn hello_init() {
    log::debug!("Hello, World from Aero kernel module!");
    }

// register the module init function :^) aero_kernel::module_init!(hello_init);


3. Profit
YusufKhan-gamedev commented 2 years ago

For a simple hello world kernel module example which is directly linked into a modules section in the kernel itself:

1. Create a new in `src/aero_kernel/src/drivers/`, we will call it `hello.rs`

2. Register the init module function.
fn hello_init() {
    log::debug!("Hello, World from Aero kernel module!");
}

// register the module init function :^)
aero_kernel::module_init!(hello_init);
3. Profit

How would I load the kernel module on runtime?

Andy-Python-Programmer commented 2 years ago

How would I load the kernel module on runtime?

Currently we don't support loading kernel modules at runtime yet. Though soon I could implement support for it.