[lkml]   [2005]   [May]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectScreen regen buffer at 0x00b8000

Why can't I consistantly write to the VGA screen regen buffer
and have it appear on the screen????

It looks like access there is cached??? One needs to change
VT consoles to make it appear!!

The screen-regen buffer at this address is hardware, in the
chip! It should not be cached!

#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <unistd.h>
#include <string.h>
#include <signal.h>
#include <fcntl.h>
#include <errno.h>
#include <time.h>
#include <sys/mman.h>

#define ERRORS(s) do { \
fprintf(stderr,"Error from line %d, file %s, call %s, (%s)\n",\
__LINE__,__FILE__,(s), strerror(errno)); \
exit(EXIT_FAILURE); } while(0)


#define SCREEN 0x000b8000
#define ATTRIB 0x1700
#define COL 64
#define FAIL -1

static const char ln[]=" Link is ";
static const char up[]="up ";
static const char dn[]="down ";

int dummy;

int link_stat() // Dummy for testing
dummy ^= 1;
return dummy;
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

int main(int args, char *argv[])
unsigned short upmsg[sizeof(up) + sizeof(ln)];
unsigned short dnmsg[sizeof(dn) + sizeof(ln)];
size_t i, j, len;
int fd;
unsigned short *sp, *rp;
#if 0
return 0;

len = getpagesize();
if((fd = open("/dev/mem", O_RDWR)) == FAIL)
if((sp = mmap((void *)SCREEN, len, PROT, TYPE, fd, SCREEN))==MAP_FAILED)
for(i=0; i< sizeof(ln)-1; i++)
upmsg[i] = (unsigned short) ln[i] | ATTRIB;
dnmsg[i] = (unsigned short) ln[i] | ATTRIB;
for(j=0; j< sizeof(up)-1; j++)
upmsg[i] = (unsigned short) up[j] | ATTRIB;
dnmsg[i] = (unsigned short) dn[j] | ATTRIB;
i *= sizeof(unsigned short);
rp = &sp[COL];
memcpy(rp, upmsg, i);
memcpy(rp, dnmsg, i);
return 0; // Not reached

Dick Johnson
Penguin : Linux version on an i686 machine (5537.79 BogoMips).
Notice : All mail here is now cached for review by Dictator Bush.
98.36% of all statistics are fiction.
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2005-05-20 16:12    [W:0.049 / U:27.528 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site