M bitsy/clock.c => bitsy/clock.c +1 -1
@@ 95,7 95,7 @@ clockintr(Ureg *ureg, void*)
accounttime();
if(kproftimer != nil)
- kproftimer(ureg->pc);
+ (*kproftimer)(ureg->pc);
checkalarms();
ilock(&clock0lock);
M bitsy/devpenmouse.c => bitsy/devpenmouse.c +4 -4
@@ 92,8 92,8 @@ pentrackxy(int x, int y) {
/* pen up. associate with button 1, 2, 3 up */
mouse.buttons &= ~0x7;
} else {
- x = (x<<16)/calibration.scalex + calibration.transx;
- y = (y<<16)/calibration.scaley + calibration.transy;
+ x = ((x*calibration.scalex)>>16) + calibration.transx;
+ y = ((y*calibration.scaley)>>16) + calibration.transy;
if ((mouse.buttons & 0x7) == 0)
mouse.buttons |= 0x1;
}
@@ 325,8 325,8 @@ penmousewrite(Chan *c, void *va, long n, vlong)
}
else if(strcmp(field[0], "calibrate") == 0){
if (nf == 1) {
- calibration.scalex = 1;
- calibration.scaley = 1;
+ calibration.scalex = 1<<16;
+ calibration.scaley = 1<<16;
calibration.transx = 0;
calibration.transy = 0;
} else if (nf == 5) {
M bitsy/devµc.c => bitsy/devµc.c +11 -12
@@ 312,8 312,17 @@ static long
int i, j;
Rune r;
- if(off != 0)
- error(Ebadarg);
+ if(c->qid.path == Qkbdin){
+ if(n >= sizeof(str))
+ n = sizeof(str)-1;
+ memmove(str, a, n);
+ str[n] = 0;
+ for(i = 0; i < n; i += j){
+ j = chartorune(&r, &str[i]);
+ kbdcr2nl(nil, r);
+ }
+ return n;
+ }
cmd = parsecmd(a, n);
if(cmd->nf > 15)
@@ 322,16 331,6 @@ static long
data[i] = atoi(cmd->f[i]);
switch(c->qid.path){
- case Qkbdin:
- if(n >= sizeof(str))
- n = sizeof(str)-1;
- memmove(str, a, n);
- str[n] = 0;
- for(i = 0; i < n; i += j){
- j = chartorune(&r, &str[i]);
- kbdputc(nil, r);
- }
- break;
case Qled:
sendmsgwithack(BLled, data, cmd->nf);
break;
M bitsy/l.s => bitsy/l.s +13 -2
@@ 144,13 144,13 @@ TEXT putttb(SB), $-4
*/
TEXT mmuenable(SB), $-4
MRC CpMMU, 0, R0, C(CpControl), C(0x0)
- ORR $(CpCmmuena|CpCdcache|CpCwb), R0
+ ORR $(CpCmmuena|CpCdcache|CpCicache|CpCwb), R0
MCR CpMMU, 0, R0, C(CpControl), C(0x0)
RET
TEXT mmudisable(SB), $-4
MRC CpMMU, 0, R0, C(CpControl), C(0x0)
- BIC $(CpCmmuena|CpCdcache|CpCwb|CpCvivec), R0
+ BIC $(CpCmmuena|CpCdcache|CpCicache|CpCwb|CpCvivec), R0
MCR CpMMU, 0, R0, C(CpControl), C(0x0)
RET
@@ 360,6 360,10 @@ TEXT forkret(SB),$-4
RFE /* MOVM.IA.S.W (R13), [R15] */
TEXT splhi(SB), $-4
+ /* save caller pc in Mach */
+ MOVW $(MACHADDR+0x04),R2
+ MOVW R14,0(R2)
+ /* turn off interrupts */
MOVW CPSR, R0
ORR $(PsrDfiq|PsrDirq), R0, R1
MOVW R1, CPSR
@@ 372,6 376,10 @@ TEXT spllo(SB), $-4
RET
TEXT splx(SB), $-4
+ /* save caller pc in Mach */
+ MOVW $(MACHADDR+0x04),R2
+ MOVW R14,0(R2)
+ /* reset interrupt level */
MOVW R0, R1
MOVW CPSR, R0
MOVW R1, CPSR
@@ 383,6 391,9 @@ TEXT splxpc(SB), $-4 /* for iunlock */
MOVW R1, CPSR
RET
+TEXT spldone(SB), $0
+ RET
+
TEXT islo(SB), $-4
MOVW CPSR, R0
AND $(PsrDfiq|PsrDirq), R0
M bitsy/random.c => bitsy/random.c +1 -1
@@ 12,7 12,7 @@ struct Rb
Rendez producer;
Rendez consumer;
ulong randomcount;
- uchar buf[1024];
+ uchar buf[128];
uchar *ep;
uchar *rp;
uchar *wp;
M bitsy/screen.c => bitsy/screen.c +10 -10
@@ 286,33 286,33 @@ screenwin(void)
{
Point p, q;
char *greet;
- Memimage *grey;
+ Memimage *orange;
memsetchan(gscreen, RGB16);
back = memwhite;
conscol = memblack;
- /* a lot of work to get a grey color */
- grey = allocmemimage(Rect(0,0,1,1), RGB16);
- grey->flags |= Frepl;
- grey->clipr = gscreen->r;
- grey->data->bdata[0] = 0x40;
- grey->data->bdata[1] = 0xfd;
+ /* a lot of work to get a orange color */
+ orange = allocmemimage(Rect(0,0,1,1), RGB16);
+ orange->flags |= Frepl;
+ orange->clipr = gscreen->r;
+ orange->data->bdata[0] = 0x40;
+ orange->data->bdata[1] = 0xfd;
w = memdefont->info[' '].width;
h = memdefont->height;
window.min = Pt(4, 4);
- window.max = addpt(window.min, Pt(4+w*33, 4+h*15));
+ window.max = addpt(window.min, Pt(4+w*33, 4+h*12));
memimagedraw(gscreen, window, memblack, ZP, memopaque, ZP);
window = insetrect(window, 4);
memimagedraw(gscreen, window, memwhite, ZP, memopaque, ZP);
memimagedraw(gscreen, Rect(window.min.x, window.min.y,
- window.max.x, window.min.y+h+5+6), grey, ZP, nil, ZP);
- freememimage(grey);
+ window.max.x, window.min.y+h+5+6), orange, ZP, nil, ZP);
+ freememimage(orange);
window = insetrect(window, 5);
greet = " Plan 9 Console ";
M bitsy/trap.c => bitsy/trap.c +3 -1
@@ 644,8 644,10 @@ _dumpstack(Ureg *ureg)
if(KTZERO < v && v < (ulong)&etext && (v&3)==0){
v -= 4;
p = (ulong*)v;
- if((*p & 0x0f000000) == 0x0b000000)
+ if((*p & 0x0f000000) == 0x0b000000){
print("%.8lux=%.8lux ", l, v);
+ i++;
+ }
}
if(i == 4){
i = 0;
M port/devcons.c => port/devcons.c +39 -23
@@ 26,7 26,7 @@ static struct
/* someplace to save up characters at interrupt time before dumping them in the q */
Lock lockputc;
- char istage[128];
+ char istage[512];
char *iw;
char *ir;
char *ie;
@@ 61,8 61,12 @@ consactive(void)
void
prflush(void)
{
+ ulong now;
+
+ now = m->ticks;
while(consactive())
- ;
+ if(m->ticks - now >= HZ)
+ break;
}
/*
@@ 76,7 80,6 @@ putstrn0(char *str, int n, int usewrite)
{
int m;
char *t;
- char buf[PRINTSIZE+2];
/*
* if there's an attached bit mapped display,
@@ 95,17 98,17 @@ putstrn0(char *str, int n, int usewrite)
while(n > 0) {
t = memchr(str, '\n', n);
- if(t) {
- m = t - str;
- memmove(buf, str, m);
- buf[m] = '\r';
- buf[m+1] = '\n';
- if(usewrite)
- qwrite(printq, buf, m+2);
- else
- qiwrite(printq, buf, m+2);
- str = t + 1;
- n -= m + 1;
+ if(t && !kbd.raw) {
+ m = t-str;
+ if(usewrite){
+ qwrite(printq, str, m);
+ qwrite(printq, "\r\n", 2);
+ } else {
+ qiwrite(printq, str, m);
+ qiwrite(printq, "\r\n", 2);
+ }
+ n -= m+1;
+ str = t+1;
} else {
if(usewrite)
qwrite(printq, str, n);
@@ 211,9 214,9 @@ panic(char *fmt, ...)
serialputs(buf, n+1);
if(consdebug)
consdebug();
- putstrn(buf, n+1);
spllo();
prflush();
+ putstrn(buf, n+1);
dumpstack();
exit(1);
@@ 320,6 323,10 @@ echo(char *buf, int n)
int x;
char *e, *p;
+ if(kbd.raw){
+ qproduce(kbdq, buf, n);
+ return;
+ }
e = buf+n;
for(p = buf; p < e; p++){
switch(*p){
@@ 382,9 389,6 @@ echo(char *buf, int n)
}
qproduce(kbdq, buf, n);
- if(kbd.raw)
- return;
-
echoscreen(buf, n);
if(printq)
echoprintq(buf, n);
@@ 393,14 397,26 @@ echo(char *buf, int n)
/*
* Called by a uart interrupt for console input.
*
- * turn '\r' into '\n' before putting it into the queue.
+ * turn '\r' into '\n' before putting it into the queue. we
+ * can't type runs on alternate consoles, so don't worry about it.
*/
int
-kbdcr2nl(Queue *q, int ch)
+kbdcr2nl(Queue*, int ch)
{
- if(ch == '\r')
+ char *next;
+
+ ilock(&kbd.lockputc); /* just a mutex */
+ if(ch == '\r' && !kbd.raw)
ch = '\n';
- return kbdputc(q, ch);
+ next = kbd.iw+1;
+ if(next >= kbd.ie)
+ next = kbd.istage;
+ if(next != kbd.ir){
+ *kbd.iw = ch;
+ kbd.iw = next;
+ }
+ iunlock(&kbd.lockputc);
+ return 0;
}
/*
@@ 824,7 840,7 @@ conswrite(Chan *c, void *va, long n, vlong off)
if(bp > sizeof buf)
bp = sizeof buf;
memmove(buf, a, bp);
- putstrn0(a, bp, 1);
+ putstrn0(buf, bp, 1);
a += bp;
l -= bp;
}
M port/taslock.c => port/taslock.c +10 -0
@@ 17,6 17,16 @@ lockloop(Lock *l, ulong pc)
Proc *p;
p = l->p;
+{
+ulong x = (ulong)p;
+uchar *cp;
+int i;
+if(x < KTZERO) {
+ cp = (uchar*)l;
+ for(i = 0; i < 64; i++) print("%2.2ux ", cp[i]);
+ print("\n");
+}
+}
print("lock loop key 0x%lux pc 0x%lux held by pc 0x%lux proc %lud\n",
l->key, pc, l->pc, p ? p->pid : 0);
dumpaproc(up);