]> git.lizzy.rs Git - plan9front.git/blobdiff - sys/src/9/pc/vga.c
kernel: cleanup makefile for $CONF.$O target
[plan9front.git] / sys / src / 9 / pc / vga.c
index 30c207d2495aa770dc78f1b8999d7894c4c79e71..2cfbd8078b3dafe3af74470361bb5af985d6cadd 100644 (file)
@@ -20,7 +20,6 @@ static Rectangle window;
 static int *xp;
 static int xbuf[256];
 Lock vgascreenlock;
-int drawdebug;
 
 void
 vgaimageinit(ulong)
@@ -54,7 +53,7 @@ vgascreenputc(VGAscr* scr, char* buf, Rectangle *flushr)
        int h, w, pos;
        Rectangle r;
 
-       if(xp < xbuf || xp >= &xbuf[sizeof(xbuf)])
+       if(xp < xbuf || xp >= &xbuf[nelem(xbuf)])
                xp = xbuf;
 
        h = scr->memdefont->height;
@@ -119,9 +118,10 @@ vgascreenputc(VGAscr* scr, char* buf, Rectangle *flushr)
 static void
 vgascreenputs(char* s, int n)
 {
-       int i, gotdraw;
-       Rune r;
-       char buf[4];
+       static char rb[UTFmax+1];
+       static int nrb;
+       char *e;
+       int gotdraw;
        VGAscr *scr;
        Rectangle flushr;
 
@@ -146,18 +146,14 @@ vgascreenputs(char* s, int n)
 
        flushr = Rect(10000, 10000, -10000, -10000);
 
-       while(n > 0){
-               i = chartorune(&r, s);
-               if(i <= 0){
-                       s++;
-                       --n;
-                       continue;
+       e = s + n;
+       while(s < e){
+               rb[nrb++] = *s++;
+               if(nrb >= UTFmax || fullrune(rb, nrb)){
+                       rb[nrb] = 0;
+                       vgascreenputc(scr, rb, &flushr);
+                       nrb = 0;
                }
-               memmove(buf, s, i);
-               buf[i] = 0;
-               n -= i;
-               s += i;
-               vgascreenputc(scr, buf, &flushr);
        }
        flushmemscreen(flushr);
 
@@ -192,11 +188,12 @@ vgascreenwin(VGAscr* scr)
        h = scr->memdefont->height;
        r = scr->gscreen->r;
 
-       if(i = mkcolor(scr->gscreen, 0x444488FF)){
+       if(i = mkcolor(scr->gscreen, 0x0D686BFF)){
                memimagedraw(scr->gscreen, r, i, ZP, nil, ZP, S);
                freememimage(i);
        }
 
+       r = scr->gscreen->clipr;
        window = insetrect(r, 20);
        memimagedraw(scr->gscreen, window, conscol, ZP, memopaque, ZP, S);
        window = insetrect(window, 4);
@@ -221,6 +218,8 @@ vgascreenwin(VGAscr* scr)
 
        qunlock(&drawlock);
 
+       vgascreenputs(kmesg.buf, kmesg.n);
+
        screenputs = vgascreenputs;
 }
 
@@ -258,7 +257,7 @@ addvgaseg(char *name, ulong pa, ulong size)
        Physseg seg;
 
        memset(&seg, 0, sizeof seg);
-       seg.attr = SG_PHYSICAL;
+       seg.attr = SG_PHYSICAL | SG_DEVICE | SG_NOEXEC;
        seg.name = name;
        seg.pa = pa;
        seg.size = size;