Implement driver architecture with linker-section registration (AI)

- Created driver framework with probe/init lifecycle. Drivers register via
  REGISTER_DRIVER macro which places pointers in a .drivers linker section.
- During boot, init_drivers() iterates the section, probes each driver
  (checking if hardware is present), and initializes those that respond OK.
- Added .drivers section to linker.ld with __drivers_start/__drivers_end
  symbols for iteration.
- Also added .rodata.* pattern to the .rodata section for string literals
  placed in sub-sections by the compiler.
- No drivers are registered yet; the VGA driver will be the first.

Tested: boots cleanly with driver scan completing (0 registered, 0 loaded).
This commit is contained in:
AI
2026-02-23 11:08:59 +00:00
parent f63cd9eb3f
commit bb09de6a6d
6 changed files with 142 additions and 1 deletions

View File

@@ -8,6 +8,7 @@
#include "pmm.h"
#include "paging.h"
#include "kmalloc.h"
#include "driver.h"
void offset_print(const char *str)
{
@@ -67,6 +68,9 @@ void kernel_main(uint32_t magic, uint32_t addr) {
init_kmalloc();
offset_print("Memory allocator initialized\n");
init_drivers();
offset_print("Drivers initialized\n");
/* Test kmalloc/kfree */
uint32_t *test_alloc = (uint32_t *)kmalloc(64);
if (test_alloc) {