kmod: prepare for kernel module loading

This commit is contained in:
RaphProductions 2025-05-17 11:51:28 +02:00
parent 30017592ad
commit d017412af5
3 changed files with 31 additions and 4 deletions

22
kernel/src/dbg/export.h Normal file
View file

@ -0,0 +1,22 @@
#pragma once
#include <stdint.h>
// At Soaplin, we aren't doing module racism based on the license. (Ḭ̸̡̢̨̧̨̛͍͚̙̺̦̩͕̮̙̙̳̮͉̝̙̜͓̪͇̠̪̣̻̰͕̲̲̘̖̦͖͕͎̲̹͖̮̳̻̞̌͋̋̆͛̉͆ ̸̨͕͎̣̥͖͔̳̫̳͚̯̬̙̘͓̹̼̻̼̈̓̉ͅͅs̶̟͉̠̣̞͎͍̘̟̝̱̩̃͛̽͛̆͌̆̒̔̈́̎̿̐̈́͐̓̓͒͌̈̀̓͗̋̕͜͜͝͠͝͠ͅȩ̸̡̛͔̦̲̦̼̹̙̲͖͎̼̝̯̦̞̜͍̀̈́̈́͂̈́̍́̆̆̔͗́̆̀͑̀̔͆̄͐͐̆͠ę̸̨̢̢̧̛̛͕̱̯̲̦͕͖̦̝̯̮̤̫͙͔̲̬̯̗̗͈̬̳̙͙̼͉̩͚̼̮͚̖̰̗̤͓̘͂̾̒͋̀͂̏́̂̋̅̆̋̈̔̈́̀̔̈́̊̓͂͌̋̂́̍̀͒͊͊̓͌̃̚͘͜͝͠ ̸̧̡̧͍̼̹͇̞̘͇̯̞̣̝̲̳̦̟̱͇̥͈̟̝̹̳̫͕̜̬̥̯̬̟̤̖̹̙̩̰̈͗͆͌̊̽̾͝͝ͅy̵̡̡̢̞̭͔̰͔͔̖̥͕̙̳̯͍͉̦̦͓̥̞̝͖͕̰̼͖̲̮͚̲̜̰̱̘̯̤̌́̏̄̏́̈́̓ͅỡ̵̢̢̢̖̠͉̖̺̻̣̜̬̮͓̫͎͖͎̤̪̝̗̰͕͍͖̖̟͙͍̻̑͊̃̃̒̍̆̎̋̿͐̋̉̇̾͆̿̌̃̏̽̊̀͒̇̏̓̾̏̈́̓̿̏̚͠͝͝͝ͅu̸̧͕̟͉͉͖̰̝͕̞̪̖͙͙̅̒̅̂̑́,̶̢̡̡̧̛̲̬̞̘̻̗̩̫̗͓̪̬͚̗̖͕̰̣͙͍̯͇̩̭͎̖̝̬̻͖̟̩̙̩̝͓̤́̄̆̍̂̈̊̄͆̽̑̑̊̓̋͐̔̉̍͌̏̀̿͘͜͜͜ͅͅ ̴̢̛̛͈͚̳̣̮̬̲̲͈̮͓̭̗̈́̽̄͌̾̒́̔̌̐̽͋̓̄̉̆̑̃́̏̉̔̓̂̽̊͆̽̎̍̈͑́̌͑̍̕͘͘͝͠ͅL̵̙̯̦̬̱͍̣̹̱̝̓̒i̵̢̨̨̧̨̛̗̲͍͇̖̥̯͔̙̪̱͓̝̦̼̭̬̟̞̩̭͙̐̐͊̒͑̊͌̽̂̉͊̈́̌͒̆̐͐͒̉̀́̑́̅͛͐̕̕͝͝ͅͅņ̵̛͓̲͆̏̃̊̒̇̑̑̾̽͊̃͌̔́̌̈́̈́͛͆̒̀̿̎͒̑̃̈́̈́͂͐͂̕̚̕͘͜͠͠ư̸̧̯̤̲͚͖̯͖͈̠̽̏̈́̄̀͒̐̅̽̋̓̂̑̋̽͒̄̑̇̈́̆̈͛͆̿̈̉͆͗͊̎͂̇̽̋̅͊̀̚̚͝ś̶̛̗̥͇̖̠͓͆̀̅̓̓͆͆̐́̄͛̃͑̔̑̒͒͋͂̂́͋͂́͗̐͆̐̕͝͝͠)
typedef struct {
const char* name;
uint64_t addr;
uint64_t size;
} kernel_symbol_t;
#define EXPORT_SYMBOL(sym) \
static const kernel_symbol_t __ksym_##sym \
__attribute__((section(".ksyms"), used)) = { \
.name = #sym, \
.addr = (uint64_t)&sym, \
.size = sizeof(sym) \
}
extern const kernel_symbol_t __start_ksyms[];
extern const kernel_symbol_t __stop_ksyms[];