## diffname port/rdb.c 1999/0820
## diff -e /dev/null /n/emeliedump/1999/0820/sys/src/brazil/port/rdb.c
0a
#include "u.h"
#include "../port/lib.h"
#include "mem.h"
#include "dat.h"
#include "fns.h"
#include "io.h"
#include "ureg.h"
extern Queue *printq;
#define DBG if(0)scrprint
#pragma varargck argpos scrprint 1
static Ureg ureg;
static void
scrprint(char *fmt, ...)
{
char buf[128];
va_list va;
int n;
va_start(va, fmt);
n = doprint(buf, buf+sizeof buf, fmt, va)-buf;
va_end(va);
putstrn(buf, n);
}
static char*
getline(void)
{
static char buf[128];
int i, c;
for(;;){
for(i=0; i<nelem(buf) && (c=serialgetc()) != '\n'; i++){
DBG("%c...", c);
buf[i] = c;
}
if(i < nelem(buf)){
buf[i] = 0;
return buf;
}
}
}
static void*
addr(char *s, Ureg *ureg)
{
ulong a;
a = strtoul(s, 0, 16);
if(a < sizeof(Ureg))
return ((uchar*)ureg)+a;
return (void*)a;
}
static void
talkrdb(Ureg *ureg)
{
uchar *a;
char *req;
printq = nil; // turn off serial console
// scrprint("Brazil debugger\n");
iprint("Edebugger reset\n");
for(;;){
req = getline();
switch(*req){
case 'r':
a = addr(req+1, ureg);
DBG("read %p\n", a);
iprint("R%.8lux %.2ux %.2ux %.2ux %.2ux\n", strtoul(req+1, 0, 16), a[0], a[1], a[2], a[3]);
break;
/*
* case Tmput:
n = min[4];
if(n > 4){
mesg(Rerr, Ecount);
break;
}
a = addr(min+0);
scrprint("mput %.8lux\n", a);
memmove(a, min+5, n);
mesg(Rmput, mout);
break;
*
*/
default:
DBG("unknown %c\n", *req);
iprint("Eunknown message\n");
break;
}
}
}
void
rdb(void)
{
splhi();
iprint("rdb...");
callwithureg(talkrdb);
}
.
## diffname port/rdb.c 1999/1031
## diff -e /n/emeliedump/1999/0820/sys/src/brazil/port/rdb.c /n/emeliedump/1999/1031/sys/src/9/port/rdb.c
65c
// scrprint("Plan 9 debugger\n");
.
## diffname port/rdb.c 2000/0611
## diff -e /n/emeliedump/1999/1031/sys/src/9/port/rdb.c /n/emeliedump/2000/0611/sys/src/9/port/rdb.c
73a
break;
case 'w':
a = addr(req+1, ureg, &p);
*(ulong*)a = strtoul(p, nil, 16);
iprint("W\n");
.
71c
a = addr(req+1, ureg, nil);
.
61a
char *p;
.
52c
a = strtoul(s, p, 16);
.
48c
addr(char *s, Ureg *ureg, char **p)
.
## diffname port/rdb.c 2001/0527
## diff -e /n/emeliedump/2000/0611/sys/src/9/port/rdb.c /n/emeliedump/2001/0527/sys/src/9/port/rdb.c
65c
serialoq = nil; // turn off serial console
kprintoq = nil; // turn off /dev/kprint if active
.
9,10d
## diffname port/rdb.c 2002/0217
## diff -e /n/emeliedump/2001/0527/sys/src/9/port/rdb.c /n/emeliedump/2002/0217/sys/src/9/port/rdb.c
21c
n = vseprint(buf, buf+sizeof buf, fmt, va)-buf;
.
## diffname port/rdb.c 2002/0412
## diff -e /n/emeliedump/2002/0217/sys/src/9/port/rdb.c /n/emeliedump/2002/0412/sys/src/9/port/rdb.c
33c
for(i=0; i<nelem(buf) && (c=uartgetc()) != '\n'; i++){
.
|