/* arch.h — the per-arch contract. * * The common C core is arch-agnostic: it only calls these functions. * Each arch// provides an implementation. This is the whole * "boundary" between the minimal asm/glue and the portable C. */ #ifndef MINOS_ARCH_H #define MINOS_ARCH_H /* Early, arch-specific bring-up done before kmain() prints anything: * e.g. point UART at the right MMIO/port. Called from the asm entry's * C landing pad, or the very top of kmain(). */ void arch_early_init(void); /* Emit one byte to the platform's debug UART. The console layer in * common/console.c builds print()/puts() on top of just this. */ void arch_uart_putc(char c); /* Blocking read of one byte from the debug UART (polls the RX FIFO). * The UART is full-duplex, so this is the mirror of arch_uart_putc. */ char arch_uart_getc(void); /* Non-blocking: return 1 if a received byte is waiting, else 0. Lets the * console drain any stale/echoed RX bytes without blocking. */ int arch_uart_rx_ready(void); /* Install the interrupt/trap vector table (IDT / mtvec / VBAR). * M1 stubs this; M2 makes it handle a timer tick. */ void arch_set_trap_vector(void); /* Name of the architecture, for the banner. */ const char *arch_name(void); /* Human-readable current CPU privilege mode (e.g. "ring0", "M-mode", * "SVC"). Reads the live hardware state so the banner proves it. */ const char *arch_cpu_mode(void); /* Halt the CPU (wfi / hlt) — end of kmain(). */ void arch_halt(void) __attribute__((noreturn)); #endif /* MINOS_ARCH_H */