public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Screen regen buffer at 0x00b8000
@ 2005-05-20 13:48 Richard B. Johnson
  2005-05-20 14:14 ` Jan-Benedict Glaw
  2005-05-20 20:03 ` Linus Torvalds
  0 siblings, 2 replies; 16+ messages in thread
From: Richard B. Johnson @ 2005-05-20 13:48 UTC (permalink / raw)
  To: Linux kernel


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 TYPE (MAP_FIXED|MAP_SHARED|MAP_FILE|MAP_LOCKED)
#define PROT (PROT_READ|PROT_WRITE)

#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
     if(fork())
         return 0;
#endif

     len = getpagesize();
     if((fd = open("/dev/mem", O_RDWR)) == FAIL)
         ERRORS("open");
     if((sp = mmap((void *)SCREEN, len, PROT, TYPE, fd, SCREEN))==MAP_FAILED)
         ERRORS("mmap");
     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++;
     }
     i *= sizeof(unsigned short);
     rp = &sp[COL];
     (void)nice(20);
     for(;;)
     {
         if(link_stat())
             memcpy(rp, upmsg, i);
         else
             memcpy(rp, dnmsg, i);
         usleep(500000);
     }
     return 0;      // Not reached
}


Cheers,
Dick Johnson
Penguin : Linux version 2.6.11.9 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.

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2005-05-23 18:56 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-05-20 13:48 Screen regen buffer at 0x00b8000 Richard B. Johnson
2005-05-20 14:14 ` Jan-Benedict Glaw
2005-05-20 14:43   ` Marco Rogantini
2005-05-20 15:24     ` Richard B. Johnson
2005-05-20 16:34       ` Marco Rogantini
2005-05-20 15:31   ` Richard B. Johnson
2005-05-20 19:26     ` Geert Uytterhoeven
2005-05-20 19:45       ` Valdis.Kletnieks
2005-05-20 19:59         ` Richard B. Johnson
2005-05-20 20:03 ` Linus Torvalds
2005-05-20 20:17   ` Richard B. Johnson
2005-05-20 21:21     ` Jon Smirl
2005-05-20 21:27       ` Richard B. Johnson
2005-05-20 23:39       ` James Simmons
2005-05-23 18:28     ` Gábor Lénárt
2005-05-23 18:56       ` Richard B. Johnson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox