| plan 9 kernel history: overview | file list | diff list |
1992/0711/port/devboot.c (diff list | history)
| port/devboot.c on 1990/0424 | ||
| 1990/0424 | #include "u.h" | |
| 1992/0321 | #include "../port/lib.h" | |
| 1990/0424 | #include "mem.h" #include "dat.h" #include "fns.h" | |
| 1992/0111 | #include "../port/error.h" | |
| 1990/0424 | #include "devtab.h" enum{ Qdir, Qboot, Qmem, }; Dirtab bootdir[]={ | |
| 1990/1127 | "boot", {Qboot}, 0, 0666, "mem", {Qmem}, 0, 0666, | |
| 1990/0424 | }; #define NBOOT (sizeof bootdir/sizeof(Dirtab)) void bootreset(void) { } void bootinit(void) { } Chan* bootattach(char *spec) { | |
| 1992/0522 | return devattach('B', spec); | |
| 1990/0424 | } Chan* bootclone(Chan *c, Chan *nc) { return devclone(c, nc); } int bootwalk(Chan *c, char *name) { return devwalk(c, name, bootdir, NBOOT, devgen); } void bootstat(Chan *c, char *dp) { devstat(c, dp, bootdir, NBOOT, devgen); } Chan* bootopen(Chan *c, int omode) { return devopen(c, omode, bootdir, NBOOT, devgen); } void bootcreate(Chan *c, char *name, int omode, ulong perm) { | |
| 1992/0711 | USED(c, name, omode, perm); | |
| 1990/11211 | error(Eperm); | |
| 1990/0424 | } void bootclose(Chan *c) { | |
| 1992/0320 | USED(c); | |
| 1990/0424 | } long | |
| 1991/0411 | bootread(Chan *c, void *buf, long n, ulong offset) | |
| 1990/0424 | { | |
| 1990/1127 | switch(c->qid.path & ~CHDIR){ | |
| 1992/0625 | ||
| 1990/0424 | case Qdir: return devdirread(c, buf, n, bootdir, NBOOT, devgen); | |
| 1992/0625 | case Qmem: /* kernel memory */ if(offset>=KZERO && offset<KZERO+conf.npage*BY2PG){ if(offset+n > KZERO+conf.npage*BY2PG) n = KZERO+conf.npage*BY2PG - offset; memmove(buf, (char*)offset, n); return n; } error(Ebadarg); | |
| 1990/0424 | } | |
| 1990/11211 | error(Egreg); | |
| 1992/0522 | return 0; /* not reached */ | |
| 1990/0424 | } long | |
| 1991/0411 | bootwrite(Chan *c, void *buf, long n, ulong offset) | |
| 1990/0424 | { ulong pc; | |
| 1990/1127 | switch(c->qid.path & ~CHDIR){ | |
| 1990/0424 | case Qmem: | |
| 1991/1206 | /* kernel memory */ | |
| 1991/0411 | if(offset>=KZERO && offset<KZERO+conf.npage*BY2PG){ if(offset+n > KZERO+conf.npage*BY2PG) n = KZERO+conf.npage*BY2PG - offset; memmove((char*)offset, buf, n); | |
| 1990/0424 | return n; } | |
| 1990/11211 | error(Ebadarg); | |
| 1990/0424 | case Qboot: pc = *(ulong*)buf; splhi(); gotopc(pc); } | |
| 1990/11211 | error(Ebadarg); | |
| 1992/0522 | return 0; /* not reached */ | |
| 1990/0424 | } void bootremove(Chan *c) { | |
| 1992/0320 | USED(c); | |
| 1990/11211 | error(Eperm); | |
| 1990/0424 | } void bootwstat(Chan *c, char *dp) { | |
| 1992/0711 | USED(c, dp); | |
| 1990/11211 | error(Eperm); | |
| 1990/0424 | } | |