Plan 9 from Bell Labs’s /usr/web/sources/extra/9hist/port/devboot.c

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


## diffname port/devboot.c 1990/0424
## diff -e /dev/null /n/bootesdump/1990/0424/sys/src/9/mips/devboot.c
0a
#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[]={
	"boot",		Qboot,		0,			0666,
	"mem",		Qmem,		0,			0666,
};

#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)
{
	error(0, Eperm);
}

/*
 * sysremove() knows this is a nop
 */
void	 
bootclose(Chan *c)
{
}

long	 
bootread(Chan *c, void *buf, long n)
{
	switch(c->qid & ~CHDIR){
	case Qdir:
		return devdirread(c, buf, n, bootdir, NBOOT, devgen);
	}

	error(0, Egreg);
}

long	 
bootwrite(Chan *c, void *buf, long n)
{
	ulong pc;

	switch(c->qid & ~CHDIR){
	case Qmem:
		/* kernel memory.  BUG: shouldn't be so easygoing. BUG: mem mapping? */
		if(c->offset>=KZERO && c->offset<KZERO+conf.npage*BY2PG){
/*			print("%ux, %d\n", c->offset, n);/**/
			if(c->offset+n > KZERO+conf.npage*BY2PG)
				n = KZERO+conf.npage*BY2PG - c->offset;
			memcpy((char*)c->offset, buf, n);
			return n;
		}
		error(0, Ebadarg);

	case Qboot:
		pc = *(ulong*)buf;
		splhi();
		gotopc(pc);
	}
	error(0, Ebadarg);
}

void	 
bootremove(Chan *c)
{
	error(0, Eperm);
}

void	 
bootwstat(Chan *c, char *dp)
{
	error(0, Eperm);
}

void
bootuserstr(Error *e, char *buf)
{
	consuserstr(e, buf);
}

void	 
booterrstr(Error *e, char *buf)
{
	rooterrstr(e, buf);
}
.
## diffname port/devboot.c 1990/0427
## diff -e /n/bootesdump/1990/0424/sys/src/9/mips/devboot.c /n/bootesdump/1990/0427/sys/src/9/mips/devboot.c
106a
		flushmmu();
.
## diffname port/devboot.c 1990/0430
## diff -e /n/bootesdump/1990/0427/sys/src/9/mips/devboot.c /n/bootesdump/1990/0430/sys/src/9/mips/devboot.c
107d
## diffname port/devboot.c 1990/11211
## diff -e /n/bootesdump/1990/0430/sys/src/9/mips/devboot.c /n/bootesdump/1990/11211/sys/src/9/mips/devboot.c
121,133c
	error(Eperm);
.
115c
	error(Eperm);
.
109c
	error(Ebadarg);
.
102c
		error(Ebadarg);
.
84c
	error(Egreg);
.
65c
	error(Eperm);
.
## diffname port/devboot.c 1990/1127
## diff -e /n/bootesdump/1990/11211/sys/src/9/mips/devboot.c /n/bootesdump/1990/1127/sys/src/9/mips/devboot.c
108a
	print("bootwrite: bad path %d\n", c->qid.path);
.
101a
		print("bootwrite: bad addr %lux\n", c->offset);
.
92c
	switch(c->qid.path & ~CHDIR){
.
79c
	switch(c->qid.path & ~CHDIR){
.
16,17c
	"boot",		{Qboot},	0,	0666,
	"mem",		{Qmem},		0,	0666,
.
## diffname port/devboot.c 1991/0318
## diff -e /n/bootesdump/1990/1210/sys/src/9/mips/devboot.c /n/bootesdump/1991/0318/sys/src/9/port/devboot.c
99c
			memmove((char*)c->offset, buf, n);
.
## diffname port/devboot.c 1991/0411
## diff -e /n/bootesdump/1991/0318/sys/src/9/port/devboot.c /n/bootesdump/1991/0411/sys/src/9/port/devboot.c
102c
		print("bootwrite: bad addr %lux\n", offset);
.
97,99c
			if(offset+n > KZERO+conf.npage*BY2PG)
				n = KZERO+conf.npage*BY2PG - offset;
			memmove((char*)offset, buf, n);
.
95c
		if(offset>=KZERO && offset<KZERO+conf.npage*BY2PG){
.
88c
bootwrite(Chan *c, void *buf, long n, ulong offset)
.
77c
bootread(Chan *c, void *buf, long n, ulong offset)
.
## diffname port/devboot.c 1991/0419
## diff -e /n/bootesdump/1991/0411/sys/src/9/port/devboot.c /n/bootesdump/1991/0419/sys/src/9/port/devboot.c
49a
Chan*
bootclwalk(Chan *c, char *name)
{
	return devclwalk(c, name);
}

.
## diffname port/devboot.c 1991/0427
## diff -e /n/bootesdump/1991/0419/sys/src/9/port/devboot.c /n/bootesdump/1991/0427/sys/src/9/port/devboot.c
50,55d
## diffname port/devboot.c 1991/1206
## diff -e /n/bootesdump/1991/0427/sys/src/9/port/devboot.c /n/bootesdump/1991/1206/sys/src/9/port/devboot.c
96c
/* print("%ux, %d\n", c->offset, n);/**/
.
94c
		/* kernel memory */
.
68,70d
## diffname port/devboot.c 1992/0111
## diff -e /n/bootesdump/1991/1206/sys/src/9/port/devboot.c /n/bootesdump/1992/0111/sys/src/9/port/devboot.c
6c
#include	"../port/error.h"
.
## diffname port/devboot.c 1992/0320
## diff -e /n/bootesdump/1992/0111/sys/src/9/port/devboot.c /n/bootesdump/1992/0320/sys/src/9/port/devboot.c
119a
	USED(c);
.
113a
	USED(c);
.
70a
	USED(c);
.
64a
	USED(c);
.
## diffname port/devboot.c 1992/0321
## diff -e /n/bootesdump/1992/0320/sys/src/9/port/devboot.c /n/bootesdump/1992/0321/sys/src/9/port/devboot.c
2c
#include	"../port/lib.h"
.
## diffname port/devboot.c 1992/0522
## diff -e /n/bootesdump/1992/0321/sys/src/9/port/devboot.c /n/bootesdump/1992/0522/sys/src/9/port/devboot.c
110a
	return 0;	/* not reached */
.
83a
	return 0;	/* not reached */
.
35c
	return devattach('B', spec);
.
## diffname port/devboot.c 1992/0625
## diff -e /n/bootesdump/1992/0522/sys/src/9/port/devboot.c /n/bootesdump/1992/0625/sys/src/9/port/devboot.c
110d
102d
96d
80a

	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);
.
78a

.
## diffname port/devboot.c 1992/0711
## diff -e /n/bootesdump/1992/0625/sys/src/9/port/devboot.c /n/bootesdump/1992/0711/sys/src/9/port/devboot.c
133c
	USED(c, dp);
.
65c
	USED(c, name, omode, perm);
.
## diffname port/devboot.c 1993/0206
## diff -e /n/bootesdump/1992/0711/sys/src/9/port/devboot.c /n/bootesdump/1993/0206/sys/src/9/port/devboot.c
116a
		icflush(0, 64*1024);
.
## diffname port/devboot.c 1993/0219
## diff -e /n/bootesdump/1993/0206/sys/src/9/port/devboot.c /n/bootesdump/1993/0219/sys/src/9/port/devboot.c
117d
## diffname port/devboot.c 1995/0108
## diff -e /n/bootesdump/1993/0219/sys/src/9/port/devboot.c /n/fornaxdump/1995/0108/sys/src/brazil/port/devboot.c
120a
}

long
bootbwrite(Chan *c, Block *bp, ulong offset)
{
	return devbwrite(c, bp, offset);
.
97a
Block*
bootbread(Chan *c, long n, ulong offset)
{
	return devbread(c, n, offset);
}

.
## diffname port/devboot.c 1995/0804
## diff -e /n/fornaxdump/1995/0108/sys/src/brazil/port/devboot.c /n/fornaxdump/1995/0804/sys/src/brazil/port/devboot.c
145d
143c
bootwstat(Chan*, char*)
.
138d
136c
bootremove(Chan*)
.
72d
70c
bootclose(Chan*)
.
65d
63c
bootcreate(Chan*, char*, int, ulong)
.
## diffname port/devboot.c 1996/0223
## diff -e /n/fornaxdump/1995/0804/sys/src/brazil/port/devboot.c /n/fornaxdump/1996/0223/sys/src/brazil/port/devboot.c
7d
## diffname port/devboot.c 1997/0327 # deleted
## diff -e /n/fornaxdump/1996/0223/sys/src/brazil/port/devboot.c /n/emeliedump/1997/0327/sys/src/brazil/port/devboot.c
1,142d

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to [email protected].