M carrera/dat.h => carrera/dat.h +1 -0
@@ 48,6 48,7 @@ struct Conf
ulong copymode; /* 0 is copy on write, 1 is copy on reference */
int monitor;
ulong ialloc; /* bytes available for interrupt time allocation */
+ ulong pipeqsize; /* size in bytes of pipe queues */
};
/*
M carrera/kbd.c => carrera/kbd.c +18 -34
@@ 190,12 190,12 @@ mouseintr(void)
void
kbdintr(void)
{
- int c, i, nk;
+ int c, i;
static int esc1, esc2;
static int caps;
static int ctl;
static int num;
- static int lstate;
+ static int collecting, nk;
static uchar kc[5];
static int shift;
int keyup;
@@ 257,39 257,21 @@ kbdintr(void)
if(!(c & Spec)){
if(ctl)
c &= 0x1f;
- switch(lstate){
- case 1:
- kc[0] = c;
- lstate = 2;
- if(c == 'X')
- lstate = 3;
- break;
- case 2:
- kc[1] = c;
- c = latin1(kc);
- nk = 2;
- putit:
- lstate = 0;
- if(c != -1)
- kbdputc(kbdq, c);
- else for(i=0; i<nk; i++)
- kbdputc(kbdq, kc[i]);
- break;
- case 3:
- case 4:
- case 5:
- kc[lstate-2] = c;
- lstate++;
- break;
- case 6:
- kc[4] = c;
- c = unicode(kc);
- nk = 5;
- goto putit;
- default:
+ if(!collecting){
kbdputc(kbdq, c);
- break;
+ return;
}
+ kc[nk++] = c;
+ c = latin1(kc, nk);
+ if(c < -1) /* need more keystrokes */
+ return;
+ if(c != -1) /* valid sequence */
+ kbdputc(kbdq, c);
+ else /* dump characters */
+ for(i=0; i<nk; i++)
+ kbdputc(kbdq, kc[i]);
+ nk = 0;
+ collecting = 0;
return;
}
else {
@@ 304,7 286,8 @@ kbdintr(void)
shift = 1;
return;
case Latin:
- lstate = 1;
+ collecting = 1;
+ nk = 0;
return;
case Ctrl:
ctl = 1;
@@ 369,6 352,7 @@ int
kbdinit(void)
{
int i;
+return 0;
/*
* empty the buffer
M pc/dat.h => pc/dat.h +1 -0
@@ 83,6 83,7 @@ struct Conf
ulong maxx; /* screen width */
ulong maxy; /* screen length */
ulong ialloc; /* max interrupt time allocation in bytes */
+ ulong pipeqsize; /* size in bytes of pipe queues */
};
/*
M pc/devvga.c => pc/devvga.c +40 -13
@@ 79,6 79,7 @@ struct Vgacard
{
char *name;
void (*setpage)(int); /* routine to page though display memory */
+ void (*mvcursor)(Point); /* routine to move hardware cursor */
};
enum
@@ 95,19 96,22 @@ enum
static void nopage(int), tsengpage(int), tridentpage(int), parapage(int);
static void atipage(int), cirruspage(int), s3page(int);
+static void nomvcursor(Point);
+
Vgacard vgachips[] =
{
-[Ati] { "ati", atipage, },
-[Pvga1a] { "pvga1a", parapage, },
-[Trident] { "trident", tridentpage, },
-[Tseng] { "tseng", tsengpage, },
-[Cirrus] { "cirrus", cirruspage, },
-[S3] { "s3", s3page, },
-[Generic] { "generic", nopage, },
+[Ati] { "ati", atipage, nomvcursor, },
+[Pvga1a] { "pvga1a", parapage, nomvcursor, },
+[Trident] { "trident", tridentpage, nomvcursor, },
+[Tseng] { "tseng", tsengpage, nomvcursor, },
+[Cirrus] { "cirrus", cirruspage, nomvcursor, },
+[S3] { "s3", s3page, nomvcursor, },
+[Generic] { "generic", nopage, nomvcursor, },
{ 0, 0, },
};
Vgacard *vgacard; /* current vga card */
+static int hwcursor;
/*
* work areas for bitblting screen characters, scrolling, and cursor redraw
@@ 174,13 178,15 @@ enum
Qvgatype= 2,
Qvgaport= 3,
Qvgaportw= 4,
- Nvga= 4,
+ Qvgactl= 5,
+ Nvga= 5,
};
Dirtab vgadir[]={
"vgasize", {Qvgasize}, 0, 0666,
"vgatype", {Qvgatype}, 0, 0666,
"vgaport", {Qvgaport}, 0, 0666,
"vgaportw", {Qvgaportw}, 0, 0666,
+ "vgactl", {Qvgactl}, 0, 0666,
};
void
@@ 295,6 301,14 @@ vgawrite(Chan *c, void *buf, long n, ulong offset)
return n;
}
error(Ebadarg);
+ case Qvgactl:
+ if(offset != 0 || n >= sizeof(cbuf))
+ error(Ebadarg);
+ memmove(cbuf, buf, n);
+ cbuf[n] = 0;
+ if(strncmp(cbuf, "hwcursor", 8) == 0)
+ hwcursor = 1;
+ break;
case Qvgasize:
if(offset != 0 || n >= sizeof(cbuf))
error(Ebadarg);
@@ 675,7 689,7 @@ screenload(Rectangle r, uchar *data, int tl, int l, int dolock)
if(!rectclip(&r, gscreen.r) || tl<=0)
return;
- if(dolock)
+ if(dolock && hwcursor == 0)
cursorlock(r);
lock(&loadlock);
@@ 758,7 772,7 @@ screenload(Rectangle r, uchar *data, int tl, int l, int dolock)
}
unlock(&loadlock);
- if(dolock)
+ if(dolock && hwcursor == 0)
cursorunlock();
}
@@ 831,7 845,7 @@ screenunload(Rectangle r, uchar *data, int tl, int l, int dolock)
if(!rectclip(&r, gscreen.r) || tl<=0)
return;
- if(dolock)
+ if(dolock && hwcursor == 0)
cursorlock(r);
lock(&loadlock);
@@ 914,7 928,7 @@ screenunload(Rectangle r, uchar *data, int tl, int l, int dolock)
}
unlock(&loadlock);
- if(dolock)
+ if(dolock && hwcursor == 0)
cursorunlock();
}
@@ 1064,6 1078,15 @@ s3page(int page)
}
/*
+ * hardware cursor routines
+ */
+static void
+nomvcursor(Point p)
+{
+ USED(p.x);
+}
+
+/*
* character mode console
*/
static void
@@ 1321,7 1344,9 @@ cursoron(int dolock)
if(dolock)
lock(&cursor);
- if(cursor.visible++ == 0){
+ if(hwcursor)
+ (*vgacard->mvcursor)(mousexy());
+ else if(cursor.visible++ == 0){
cursor.r.min = mousexy();
cursor.r.max = add(cursor.r.min, Pt(16, 16));
cursor.r = raddp(cursor.r, cursor.offset);
@@ 1374,6 1399,8 @@ cursoron(int dolock)
void
cursoroff(int dolock)
{
+ if(hwcursor)
+ return;
if(cursor.disable)
return;
if(dolock)
M pc/kbd.c => pc/kbd.c +17 -34
@@ 359,12 359,12 @@ ct82c710(void)
static void
kbdintr(Ureg *ur, void *arg)
{
- int s, c, i, nk;
+ int s, c, i;
static int esc1, esc2;
static int caps;
static int ctl;
static int num;
- static int lstate;
+ static int collecting, nk;
static uchar kc[5];
int keyup;
@@ 444,39 444,21 @@ kbdintr(Ureg *ur, void *arg)
if(!(c & Spec)){
if(ctl)
c &= 0x1f;
- switch(lstate){
- case 1:
- kc[0] = c;
- lstate = 2;
- if(c == 'X')
- lstate = 3;
- break;
- case 2:
- kc[1] = c;
- c = latin1(kc);
- nk = 2;
- putit:
- lstate = 0;
- if(c != -1)
- kbdputc(kbdq, c);
- else for(i=0; i<nk; i++)
- kbdputc(kbdq, kc[i]);
- break;
- case 3:
- case 4:
- case 5:
- kc[lstate-2] = c;
- lstate++;
- break;
- case 6:
- kc[4] = c;
- c = unicode(kc);
- nk = 5;
- goto putit;
- default:
+ if(!collecting){
kbdputc(kbdq, c);
- break;
+ return;
}
+ kc[nk++] = c;
+ c = latin1(kc, nk);
+ if(c < -1) /* need more keystrokes */
+ return;
+ if(c != -1) /* valid sequence */
+ kbdputc(kbdq, c);
+ else /* dump characters */
+ for(i=0; i<nk; i++)
+ kbdputc(kbdq, kc[i]);
+ nk = 0;
+ collecting = 0;
return;
} else {
switch(c){
@@ 490,7 472,8 @@ kbdintr(Ureg *ur, void *arg)
mouseshifted = shift = 1;
return;
case Latin:
- lstate = 1;
+ collecting = 1;
+ nk = 0;
return;
case Ctrl:
ctl = 1;
M port/devpipe.c => port/devpipe.c +9 -3
@@ 38,11 38,17 @@ Dirtab pipedir[] =
"data", {Qdata0}, 0, 0600,
"data1", {Qdata1}, 0, 0600,
};
-#define NPIPEDIR 4
+#define NPIPEDIR 2
void
pipeinit(void)
{
+ if(conf.pipeqsize == 0){
+ if(conf.nmach > 1)
+ conf.pipeqsize = 256*1024;
+ else
+ conf.pipeqsize = 32*1024;
+ }
}
void
@@ 65,12 71,12 @@ pipeattach(char *spec)
exhausted("memory");
p->ref = 1;
- p->q[0] = qopen(32*1024, 0, 0, 0);
+ p->q[0] = qopen(conf.pipeqsize, 0, 0, 0);
if(p->q[0] == 0){
free(p);
exhausted("memory");
}
- p->q[1] = qopen(32*1024, 0, 0, 0);
+ p->q[1] = qopen(conf.pipeqsize, 0, 0, 0);
if(p->q[1] == 0){
free(p->q[0]);
free(p);
M port/portfns.h => port/portfns.h +1 -2
@@ 115,7 115,7 @@ void kproc(char*, void(*)(void*), void*);
void kprocchild(Proc*, void (*)(void*), void*);
void kproftimer(ulong);
void ksetenv(char*, char*);
-long latin1(uchar*);
+long latin1(uchar*, int);
void lights(int);
void links(void);
void lock(Lock*);
@@ 244,7 244,6 @@ void swapinit(void);
void tsleep(Rendez*, int (*)(void*), void*, int);
void unbreak(Proc*);
void uncachepage(Page*);
-long unicode(uchar*);
long unionread(Chan*, void*, long);
void unlock(Lock*);
void unmount(Chan*, Chan*);
M power/dat.h => power/dat.h +1 -0
@@ 52,6 52,7 @@ struct Conf
ulong frag; /* Ip fragment assemble queue size */
ulong debugger; /* use processor 1 as a kernel debugger */
ulong ialloc; /* bytes available for interrupt time allocation */
+ ulong pipeqsize; /* size in bytes of pipe queues */
};
/*