| plan 9 kernel history: overview | file list | diff list |
1991/0318/port/devboot.c (diff list | history)
| 1991/0318/sys/src/9/port/devboot.c:1,124 – 1991/0411/sys/src/9/port/devboot.c:1,124 (short | long | prev | next) | ||
| 1990/0424 | #include "u.h" #include "lib.h" #include "mem.h" #include "dat.h" #include "fns.h" #include "errno.h" #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) { return devattach('b', spec); } 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) { | |
| 1990/11211 | error(Eperm); | |
| 1990/0424 | } /* * sysremove() knows this is a nop */ void bootclose(Chan *c) { } long | |
| 1991/0411 | bootread(Chan *c, void *buf, long n, ulong offset) | |
| 1990/0424 | { | |
| 1990/1127 | switch(c->qid.path & ~CHDIR){ | |
| 1990/0424 | case Qdir: return devdirread(c, buf, n, bootdir, NBOOT, devgen); } | |
| 1990/11211 | error(Egreg); | |
| 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: /* kernel memory. BUG: shouldn't be so easygoing. BUG: mem mapping? */ | |
| 1991/0411 | if(offset>=KZERO && offset<KZERO+conf.npage*BY2PG){ | |
| 1990/0424 | /* print("%ux, %d\n", c->offset, n);/**/ | |
| 1991/0318 |
| |
| 1991/0411 | if(offset+n > KZERO+conf.npage*BY2PG) n = KZERO+conf.npage*BY2PG - offset; memmove((char*)offset, buf, n); | |
| 1990/0424 | return n; } | |
| 1990/1127 |
| |
| 1991/0411 | print("bootwrite: bad addr %lux\n", offset); | |
| 1990/11211 | error(Ebadarg); | |
| 1990/0424 | case Qboot: pc = *(ulong*)buf; splhi(); gotopc(pc); } | |
| 1990/1127 | print("bootwrite: bad path %d\n", c->qid.path); | |
| 1990/11211 | error(Ebadarg); | |
| 1990/0424 | } void bootremove(Chan *c) { | |
| 1990/11211 | error(Eperm); | |
| 1990/0424 | } void bootwstat(Chan *c, char *dp) { | |
| 1990/11211 | error(Eperm); | |
| 1990/0424 | } | |