1
0
mirror of git://projects.qi-hardware.com/iris.git synced 2024-11-05 12:23:09 +02:00
iris/kernel.hhp
2009-05-11 00:28:12 +02:00

76 lines
1.6 KiB
Plaintext

#pypp 0
#ifndef _KERNEL_HH
#define _KERNEL_HH
#define NULL 0
class Object
class Page
class Thread
class Memory
struct Object:
unsigned size
Object *prev, *next
struct Page : public Object:
Page *page_prev, *page_next
unsigned physical
struct Thread : public Object:
struct Cpu:
unsigned at, v0, v1, a0, a1, a2, a3
unsigned t0, t1, t2, t3, t4, t5, t6, t7, t8, t9
unsigned gp, sp, fp, ra, hi, lo, k0, k1, pc
Cpu cpu
Thread *thread_prev, *thread_next
Thread *schedule_prev, *schedule_next
Memory *address_space
struct Memory : public Object:
Memory *memory_prev, *memory_next
Page *pages
Thread *threads
Memory *memories
unsigned limit, used
struct Cpu:
unsigned asid
Page ***directory
Cpu cpu
// Functions which can be called from assembly must not be mangled.
extern "C":
// Kernel entry points, called from entry.S.
void init ()
Thread *interrupt (Thread *current)
Thread *cache_error (Thread *current)
Thread *exception (Thread *current)
// tlb stuff. tlb_refill is also an entry point.
void tlb_setup ()
Thread *tlb_refill (Thread *current, unsigned EntryHi)
// Start running the idle task for the first time.
void run_idle (Thread *self)
// Panic. n is sent over caps led. message is currently ignored.
void panic (unsigned n, char const *message)
// Debug: switch caps led
void led (bool on, bool tick)
#ifndef EXTERN
#define EXTERN extern
#endif
struct FreePage:
FreePage *next
EXTERN FreePage *zero_pages, *junk_pages
EXTERN Memory top_memory
EXTERN Thread *sleepers, *runners
EXTERN Thread idle
EXTERN Memory idle_memory
EXTERN Page idle_page
#endif