changeset 4350: | 1f9d7811d546 |
parent: | b79e68a62219 |
author: | cinap_lenrek@felloff.net |
date: | Mon, 16 Mar 2015 05:46:08 +0100 |
permissions: | -rw-r--r-- |
description: | kernel: get rid of auxpage() and preserve cache index bits in Page.va in mount cache the mount cache uses Page.va to store cached range offset and limit, but mips kernel uses cache index bits from Page.va to maintain page coloring. Page.va was not initialized by auxpage(). this change removes auxpage() which was primarily used only by the mount cache and use newpage() with cache file offset page as va so we will get a page of the right color. mount cache keeps the index bits intact by only using the top and buttom PGSHIFT bits of Page.va for the range offset/limit. |
1 #include "u.h"2 #include "../port/lib.h"3 #include "mem.h"4 #include "dat.h"5 #include "fns.h"6 #include "io.h"7 #include "../port/error.h"9 #define Image IMAGE10 #include <draw.h>11 #include <memdraw.h>12 #include <cursor.h>13 #include "screen.h"15 enum {16 DC_UNLOCK = 0,17 DC_UNLOCKVALUE = 0x4758,18 DC_GENERAL_CFG = 1,19 CURE = 2,20 DC_CURS_ST_OFFSET = 6,21 DC_CURSOR_X = 24,22 DC_CURSOR_Y = 25,23 DC_PAL_ADDRESS = 28,24 DC_PAL_DATA25 };27 static void28 geodeenable(VGAscr* scr)29 {30 Pcidev *p;32 if(scr->mmio)33 return;34 p = scr->pci;35 if(!p) return;36 scr->mmio = vmap(p->mem[2].bar&~0x0F, p->mem[2].size);37 if(!scr->mmio) return;38 addvgaseg("geodegp", p->mem[1].bar&~0x0F, p->mem[1].size);39 addvgaseg("geodemmio", p->mem[2].bar&~0x0F, p->mem[2].size);40 addvgaseg("geodevid", p->mem[3].bar&~0x0F, p->mem[3].size);41 vgalinearpci(scr);42 if(scr->apsize)43 addvgaseg("geodescreen", scr->paddr, scr->apsize);44 scr->storage = 0x800000;45 }47 static void48 geodelinear(VGAscr*, int, int)49 {50 }52 static void53 geodecurload(VGAscr* scr, Cursor* curs)54 {55 uvlong *p, and1, xor1, and2, xor2;56 int i;57 uchar *c, *s;59 if(!scr->mmio) return;60 p = (uvlong*)((uchar*)scr->vaddr + scr->storage);61 c = curs->clr;62 s = curs->set;63 for(i=0;i<16;i++) {64 and1 = 0xFF ^ (*s ^ *c++);65 xor1 = *s++;66 and1 &= ~xor1;67 and2 = 0xFF ^ (*s ^ *c++);68 xor2 = *s++;69 and2 &= ~xor2;70 *p++ = (and1 << 56) | (and2 << 48) | 0xFFFFFFFFFFFFLL;71 *p++ = (xor1 << 56) | (xor2 << 48);72 }73 for(;i<128;i++) {74 *p++ = -1;75 *p++ = 0;76 }77 scr->offset = curs->offset;78 }80 static int81 geodecurmove(VGAscr* scr, Point p) {82 if(!scr->mmio) return 1;83 ((ulong*)scr->mmio)[DC_UNLOCK] = DC_UNLOCKVALUE;84 ((ulong*)scr->mmio)[DC_CURSOR_X] = p.x + scr->offset.x;85 ((ulong*)scr->mmio)[DC_CURSOR_Y] = p.y + scr->offset.y;86 return 0;87 }89 static void90 geodecurenable(VGAscr* scr)91 {92 geodeenable(scr);93 if(!scr->mmio) return;94 geodecurload(scr, &arrow);95 geodecurmove(scr, ZP);96 ((ulong*)scr->mmio)[DC_UNLOCK] = DC_UNLOCKVALUE;97 ((ulong*)scr->mmio)[DC_CURS_ST_OFFSET] = scr->storage;98 ((ulong*)scr->mmio)[DC_GENERAL_CFG] |= CURE;99 /* set cursor colours */100 ((ulong*)scr->mmio)[DC_PAL_ADDRESS] = 0x100;101 ((ulong*)scr->mmio)[DC_PAL_DATA] = -1;102 ((ulong*)scr->mmio)[DC_PAL_DATA] = 0;103 }105 static void106 geodecurdisable(VGAscr* scr)107 {108 if(!scr->mmio) return;109 ((ulong*)scr->mmio)[DC_UNLOCK] = DC_UNLOCKVALUE;110 ((ulong*)scr->mmio)[DC_GENERAL_CFG] &= ~CURE;111 }113 VGAdev vgageodedev = {114 "geode",115 geodeenable,116 .linear = geodelinear,117 };120 VGAcur vgageodecur = {121 "geodehwgc",122 geodecurenable,123 geodecurdisable,124 geodecurload,125 geodecurmove,126 };