main.c (1079B)
1 #include <os9/os9.h> 2 3 #include <libk.h> 4 5 #include "version.h" 6 #include "sysreg.h" 7 #include "arch.h" 8 9 int 10 getch(void) 11 { 12 char ch; 13 14 if (!console) 15 panic("getch out of sync"); 16 chanread(console, &ch, 1); 17 return ch; 18 } 19 20 void 21 imach(void) 22 { 23 Map *textp, *datap, *stackp, *pagep; 24 static Map maps[5]; 25 extern char text[], etext[], end[]; 26 27 mach.maps = maps; 28 textp = &maps[0]; 29 datap = &maps[1]; 30 stackp = &maps[2]; 31 pagep = &maps[3]; 32 33 textp->name = "text"; 34 textp->pa = mach.phytext; 35 textp->va = mach.phytext + mach.kzero; 36 textp->siz = etext - text; 37 textp->perm = MR | MX; 38 39 datap->name = "data"; 40 datap->pa = textp->pa +textp->siz; 41 datap->va = datap->pa + mach.kzero; 42 datap->siz = end - etext; 43 datap->perm = MR | MW; 44 45 stackp->name = "stack"; 46 stackp->pa = mach.phystack - PAGESIZE; 47 stackp->va = datap->va + datap->siz + PAGESIZE; 48 stackp->siz = PAGESIZE; 49 stackp->perm = MR | MW; 50 51 pagep->name = "ptable"; 52 pagep->pa = mach.phystack; 53 pagep->va = 0xFFFFFF0000080000; 54 pagep->siz = PAGESIZE * 20; 55 pagep->perm = MR | MW; 56 } 57 58 void 59 main(Mach *m) 60 { 61 ifpu(); 62 igic(); 63 isys(); 64 }