Exemple #1
0
void VL_Startup()
{
	myint mode;
	
	vga_init(); /* TODO: maybe move into main or such? */
	
	if (MS_CheckParm("x2")) {
		mode = G640x400x256;
		vwidth = 640;
		vheight = 400;
	} else {
		mode = G320x200x256;
		vwidth = 320;
		vheight = 200;
	}

	if (gfxbuf == NULL) 
		gfxbuf = malloc(vwidth * vheight * 1);
		
	if (vga_hasmode(mode) == 0) 
		Quit("vga_hasmode failed!");
			
	if (vga_setmode(mode) != 0)
		Quit("vga_setmode failed!");
		
	if ((mode != G320x200x256) && (vga_setlinearaddressing() == -1))
		Quit("vga_setlinearaddressing failed!");
		
 	graphmem = vga_getgraphmem();
 	
 	keyboard_init();
	keyboard_seteventhandler(keyboard_handlerx);
}
static void pcconsole_probe(cfe_driver_t *drv,
			      unsigned long probe_a, unsigned long probe_b, 
			      void *probe_ptr)
{
    pcconsole_t *softc;
    char descr[80];

    /* 
     * probe_a is
     * probe_b is     
     * probe_ptr is 
     */

    softc = (pcconsole_t *) KMALLOC(sizeof(pcconsole_t),0);
    if (softc) {

	memset(softc,0,sizeof(pcconsole_t));

	vga_init(&(softc->vga),__ISAaddr(VGA_TEXTBUF_COLOR),outb);

	xsprintf(descr,"%s",drv->drv_description,probe_a,probe_b);
	cfe_attach(drv,softc,NULL,descr);
	}

}
Exemple #3
0
int gr_init(int mode)
{
	int retcode;
 	// Only do this function once!
	if (gr_installed==1)
		return -1;
	MALLOC(grd_curscreen,grs_screen, 1);
	memset(grd_curscreen, 0, sizeof(grs_screen));
	
	vga_init();

	if ((retcode=gr_set_mode(mode)))
		return retcode;
	
	grd_curscreen->sc_canvas.cv_color = 0;
	grd_curscreen->sc_canvas.cv_drawmode = 0;
	grd_curscreen->sc_canvas.cv_font = NULL;
	grd_curscreen->sc_canvas.cv_font_fg_color = 0;
	grd_curscreen->sc_canvas.cv_font_bg_color = 0;
	gr_set_current_canvas( &grd_curscreen->sc_canvas );

	gr_installed = 1;
	atexit(gr_close);
	return 0;
}
Exemple #4
0
void
vgacninit(struct consdev *cp)
{

	vga_init((u_char *)cp->address);
	kbdreset();
}
Exemple #5
0
int
main(int argc,char *argv[])
{
  int mode,c;

  vga_init();
  c=1;
  if(argc == 1)
    screen(10);     /* G640x480x256 */
  else
    c = 0;
  while(argc > 1)
    {
      argc--;
      c++;
      if(isdigit(*argv[c]))
	mode = atoi(argv[c]);
      else if(*argv[c] == 'G')
	mode = vga_getmodenumber(argv[c]);
      else
	{
	  printf("Unknown mode %s\n",argv[c]);
	  continue;
	}
      screen(mode);
    }
  vga_setmode(TEXT);
  return 0;
}
Exemple #6
0
//! [1]
bool SvgalibScreen::initDevice()
{
    if (vga_init() != 0) {
        qCritical("SvgalibScreen::initDevice(): unable to initialize svgalib");
        return false;
    }

    int mode = vga_getdefaultmode();
    if (vga_setmode(mode) == -1) {
        qCritical("SvgalibScreen::initialize(): unable to set graphics mode");
        return false;
    }

    if (gl_setcontextvga(mode) != 0) {
        qCritical("SvgalibScreen::initDevice(): unable to set vga context");
        return false;
    }
    context = gl_allocatecontext();
    gl_getcontext(context);

    vga_modeinfo *modeinfo = vga_getmodeinfo(mode);
    if (modeinfo->flags & IS_LINEAR)
        QScreen::data = vga_getgraphmem();

    initColorMap();

    QScreenCursor::initSoftwareCursor();
    return true;
}
Exemple #7
0
static int _qdgdfv_startup(void)
{
    vga_init();

    _qdgdfv_scale = 1;

    /* only 320x200 supported by now */
    _qdgdfv_screen_x_size = 320;
    _qdgdfv_screen_y_size = 200;

    vga_setmode(G320x200x256);

    _qdgdfv_set_palette();

    keyboard_init();

    keyboard_translatekeys(TRANSLATE_CURSORKEYS);

    _qdgdfv_virtual_screen = (unsigned char *)
        qdgdfv_malloc(_qdgdfv_screen_x_size * _qdgdfv_screen_y_size);

    qdgdfv_clear_virtual_screen();

    /* svgalib runs always fullscreen */
    _qdgdfv_full_screen = 1;

    qdgdfv_logger("qdgdfv_startup", "SVGALIB driver startup");

    return 1;
}
Exemple #8
0
int ui_init(int *fd_keyboard, int *fd_mouse)
{
    int dac_shift, i, mouse_type, force_red;
    
    if (vga_init() == 0)
    {
        old_mode = vga_getcurrentmode();
        vga_setmode(G640x480x256);
        /*vga_setlinearaddressing();*/
        if (vga_ext_set(VGA_EXT_AVAILABLE, VGA_AVAIL_FLAGS) & VGA_CLUT8)
        {
            vga_ext_set(VGA_EXT_SET, VGA_CLUT8);
            dac_shift = 0;
        }
        else
            dac_shift = 2;
        force_red = 0xFF;
        for (i = 0; i < 255; i++)
            vga_setpalette(i,
                           i >> dac_shift,
                           (i & force_red) >> dac_shift,
                           (i & force_red) >> dac_shift);
        vga_setpalette(UI_LO_COLOR, 127 >> dac_shift, 0, 0); /* Save dim    red for UI */
        vga_setpalette(UI_HI_COLOR, 255 >> dac_shift, 0, 0); /* Save bright red for UI */
        vga = vga_getmodeinfo(vga_getcurrentmode());
    }
Exemple #9
0
void Graphic::init_graph_mode()
{
#ifdef SVGALIB
  vga_init();
  int vga_mode=G640x480x16M;
  vga_setmode(vga_mode);
  gl_setcontextvga(vga_mode);
#endif

#if 0
  gl_setpalettecolor(BLUE, 0, 0, 63); // blue
  gl_setpalettecolor(BLACK, 0, 0, 0); // black
  gl_setpalettecolor(GREEN, 0, 63, 0);
  gl_setpalettecolor(RED, 63, 0, 0);
  gl_setpalettecolor(BROWN, 170/4, 85/4, 0);
  gl_setpalettecolor(MAGENTA, 170/4, 0, 170/4);
  gl_setpalettecolor(CYAN, 0, 170/4, 170/4);
  gl_setpalettecolor(GRAY, 48, 48, 48);

  gl_setpalettecolor(LIGHTBLACK, 85/4, 85/4, 85/4);
  gl_setpalettecolor(LIGHTBLUE, 85/4, 85/4, 255/4);
  gl_setpalettecolor(LIGHTGREEN, 85/4, 255/4, 85/4);
  gl_setpalettecolor(LIGHTCYAN, 85/4, 255/4, 255/4);
  gl_setpalettecolor(LIGHTRED, 25/45/4, 85/4, 85/4);
  gl_setpalettecolor(LIGHTMAGENTA, 255/4, 85/4, 255/4);
  gl_setpalettecolor(LIGHTBROWN, 255/4, 255/4, 85/4);
#endif
}
Exemple #10
0
/* VGA device wrapper around PCI device around virtio GPU */
static void virtio_vga_realize(VirtIOPCIProxy *vpci_dev, Error **errp)
{
    VirtIOVGA *vvga = VIRTIO_VGA(vpci_dev);
    VirtIOGPU *g = &vvga->vdev;
    VGACommonState *vga = &vvga->vga;
    Error *err = NULL;
    uint32_t offset;
    int i;

    /* init vga compat bits */
    vga->vram_size_mb = 8;
    vga_common_init(vga, OBJECT(vpci_dev), false);
    vga_init(vga, OBJECT(vpci_dev), pci_address_space(&vpci_dev->pci_dev),
             pci_address_space_io(&vpci_dev->pci_dev), true);
    pci_register_bar(&vpci_dev->pci_dev, 0,
                     PCI_BASE_ADDRESS_MEM_PREFETCH, &vga->vram);

    /*
     * Configure virtio bar and regions
     *
     * We use bar #2 for the mmio regions, to be compatible with stdvga.
     * virtio regions are moved to the end of bar #2, to make room for
     * the stdvga mmio registers at the start of bar #2.
     */
    vpci_dev->modern_mem_bar = 2;
    vpci_dev->msix_bar = 4;
    offset = memory_region_size(&vpci_dev->modern_bar);
    offset -= vpci_dev->notify.size;
    vpci_dev->notify.offset = offset;
    offset -= vpci_dev->device.size;
    vpci_dev->device.offset = offset;
    offset -= vpci_dev->isr.size;
    vpci_dev->isr.offset = offset;
    offset -= vpci_dev->common.size;
    vpci_dev->common.offset = offset;

    /* init virtio bits */
    qdev_set_parent_bus(DEVICE(g), BUS(&vpci_dev->bus));
    /* force virtio-1.0 */
    vpci_dev->flags &= ~VIRTIO_PCI_FLAG_DISABLE_MODERN;
    vpci_dev->flags |= VIRTIO_PCI_FLAG_DISABLE_LEGACY;
    object_property_set_bool(OBJECT(g), true, "realized", &err);
    if (err) {
        error_propagate(errp, err);
        return;
    }

    /* add stdvga mmio regions */
    pci_std_vga_mmio_region_init(vga, &vpci_dev->modern_bar,
                                 vvga->vga_mrs, true);

    vga->con = g->scanout[0].con;
    graphic_console_set_hwops(vga->con, &virtio_vga_ops, vvga);

    for (i = 0; i < g->conf.max_outputs; i++) {
        object_property_set_link(OBJECT(g->scanout[i].con),
                                 OBJECT(vpci_dev),
                                 "device", errp);
    }
}
Exemple #11
0
void editor_init(void)
{
    Text *txt = text_load(NULL);

    vga_init();
    print_init();
	view_main_window();

    editor.root =  GetMenu(CHINESE);
    if(!(editor.root)){
        messagebox_manager("load menu failed.");
        getch();
        text_free(txt);
        exit(1);
    }
    view_main_menu(editor.root);
    if(!txt){
        messagebox_manager("open empty file failed.");
    }
    editor.cli = clipborad_init();

    initmouse();
    fprintf(stderr,"logging...\n");
    showmouseptr();
    editor.txt = txt;
    editor.mode = MENU;
}
Exemple #12
0
void kmain(void){
	vga_init();
	heap_init();
	unreal_init();

	// DETECT MEMORY
	puts("Detecting memory... ");
	memdetect();
	uint16_t count = *((uint16_t *) 0x7E00);
	if(!count){
		puts("error - something is wrong with INT15/EAX=E820");
		while(1);
	}

	uint16_t i;
	uint32_t amount = 0;
	for(i = 0;i < count;i++){
		amount += *((uint32_t *) 0x7008 + i * 4);
	}
	
	uint32_t mb = amount / 1048576;
	amount %= 1048576;
	uint8_t point = amount / 131072;
	if(amount % 131072 > 65536) point++;

	putd(mb);
	putc('.');
	putd(point);
	puts(" MB\n");

	unreal_disk();
	read_unbuffered(0, 0x30000, 1);
	puts("Done!");
	while(1);
}
Exemple #13
0
static int
SVGA_open(PSD psd)
{
	int		mode;
	vga_modeinfo *	modeinfo;

	vga_init();
	//mode = G640x480x256;
	mode = G640x480x16;
	vga_setmode(mode);
	modeinfo = vga_getmodeinfo(mode);

	psd->xres = modeinfo->width;
	psd->yres = modeinfo->height;
	psd->linelen = modeinfo->linewidth;
	psd->planes = 1;
	psd->bpp = modeinfo->bytesperpixel;	// FIXME??
	psd->ncolors = modeinfo->colors;
	psd->flags = PSF_SCREEN;
	psd->addr = 0;		// FIXME

	/* note: must change psd->pixtype here for truecolor systems*/
	psd->pixtype = PF_PALETTE;
	return 1;
}
Exemple #14
0
int main(void)
{
    vga_init();

    /* Create virtual screen. */
    vbuf = malloc(VWIDTH * VHEIGHT);
    gl_setcontextvirtual(VWIDTH, VHEIGHT, 1, 8, vbuf);

    /* Set Mode X-style 320x240x256. */
    vga_setmode(G320x240x256);
    gl_setrgbpalette();
    vga_clear();

    boxes();

    demo1();

    demo2();

    vga_setmode(G320x200x256);	/* Set linear 320x200x256. */
    gl_setrgbpalette();

    demo3();

    vga_setmode(TEXT);
    exit(0);
}
Exemple #15
0
int main(int argc, char *argv[])
{
    vga_init();
    
    if(argc>=2) {
        timescale=atoi(argv[1]);
        if(timescale<1)timescale=1;
    }

    VGAMODE = vga_getdefaultmode();
    if (VGAMODE == -1)
	VGAMODE = G320x200x256;	/* Default mode. */

    if (!vga_hasmode(VGAMODE)) {
	printf("Mode not available.\n");
	exit(-1);
    }
    VIRTUAL = 0;		/* No virtual screen. */
    if (vga_getmodeinfo(VGAMODE)->colors == 16 ||
	(vga_getmodeinfo(VGAMODE)->flags & IS_MODEX))
	/* These modes are supported indirectly by vgagl. */
	VIRTUAL = 1;

    if (VIRTUAL) {
	/* Create virtual screen. */
	gl_setcontextvgavirtual(VGAMODE);
	backscreen = gl_allocatecontext();
	gl_getcontext(backscreen);
    }
    vga_setmode(VGAMODE);
    gl_setcontextvga(VGAMODE);	/* Physical screen context. */
    physicalscreen = gl_allocatecontext();
    gl_getcontext(physicalscreen);
    if (COLORS == 256)
	gl_setrgbpalette();

	if(argc==3)sleep(2);

    test();

    /* Now do the same with clipping enabled. */
    gl_clearscreen(0);
    gl_setclippingwindow(WIDTH / 4, HEIGHT / 4, WIDTH - WIDTH / 4 - 1,
			 HEIGHT - HEIGHT / 4 - 1);

    test();

    gl_disableclipping();
    if (COLORS == 256)
	/* Show the logo if using 256 color mode. */
	logotest();

    getchar();

    if (VIRTUAL)
	gl_freecontext(backscreen);
    vga_setmode(TEXT);
    exit(0);
}
Exemple #16
0
int	main(void)
{
  vga_init();
  kbd_init();
  cls();
  run_shell();
  return (0);
}
Exemple #17
0
/*
** SWimp_Init
**
** This routine is responsible for initializing the implementation
** specific stuff in a software rendering subsystem.
*/
int SWimp_Init( void *hInstance, void *wndProc )
{
	vga_init();

	VID_InitModes();

	return true;
}
Exemple #18
0
/* cons_init - initializes the console devices */
void
cons_init(void) {
    serial_init();
	vga_init();
    //cons.rpos = cons.wpos = 0;
    if (!serial_exists) {
        kprintf("serial port does not exist!!\n");
    }
}
Exemple #19
0
void setup( void )
{
   vga_init();

   vga_setmode(G800x600x32K);
/*   gl_setcontextvga(G800x600x32K);*/

   vmc = SVGAMesaCreateContext(GL_TRUE);
   SVGAMesaMakeCurrent( vmc );
}
Exemple #20
0
int mymain(void)
{	
	char * p = (char *)BMP_ADDR;
	char red, blue, green;
	int color;
	int i, j;
	
	puts("vga init\n");
	vga_init();

	puts("lcd init\n");
	lcd_init();
	
	lcd_clear_screen(0x000000);	// black	

	puts("lcd draw line\n");
	lcd_draw_hline(100, 100, 640-100, 0xff0000);	// red
	lcd_draw_hline(200, 100, 640-100, 0x00ff00);	// green
	lcd_draw_hline(300, 100, 640-100, 0x0000ff);	// blue
	lcd_draw_hline(400, 100, 640-100, 0xffffff);	// white

	lcd_draw_vline(640/2, 50, 480-50, 0xffffff);	// white
	
	#define POS	50
	#define HALF	20
	lcd_draw_cross(POS, POS, HALF);
	lcd_draw_cross(POS, 640-POS, HALF);
	
	lcd_draw_cross(480-POS, POS, HALF);
	lcd_draw_cross(480-POS, 640-POS, HALF);
	
	//while (1);
	
	// show BMP file
		// read bmp file
	// bmp file header is 54 bytes
	p += 54;
	
	for (i = 0; i < 272; i++)
		for (j = 0; j < 480; j++)
		{
			blue = *p++;
			green = *p++;
			red = *p++;
		
			color = red << 16 | green << 8 | blue << 0;
			
			lcd_draw_pixel(272-i, j, color);
		}
	
	while (1);
	
	return 0;
}
Exemple #21
0
	int main(int argc, char *argv[])
	{
		
		int i;
		int oldmode;
		int mode = G320x200x256;
		int width, height, colors;

		//获得当前的模式
		oldmode = vga_getcurrentmode();

		//初始化
		vga_init();

		//判断是否支持该模式
		if(vga_hasmode(mode)) 
			vga_setmode(mode);
		else {
			printf("No such mode\n");
			exit(1);
		}
		//取得信息
		width = vga_getxdim();
		height = vga_getydim();
		colors = vga_getcolors();

		//绘图
		for(i=0; i<colors; i++){
			vga_setcolor(i);
			vga_drawline(0, i, width-1, i);
		}
			

		vga_setcolor(3);
		for(i=0; i<50; i++) vga_drawpixel(i*4, 20);

		vga_setcolor(4);
		vga_drawline(100, 100, 300, 200);

		vga_setcolor(5);
		vga_drawline(0, 0, width-1, 0);
		vga_drawline(0, height-1, width-1, height-1);
		vga_drawline(0, 0, 0, height-1);
		vga_drawline(width-1, 0, width-1, height-1);

		//等待按键
		while(!vga_getkey());

		//恢复原来的模式 
		vga_setmode(oldmode);

		return 0;
	}
Exemple #22
0
bool d_raster_new(void)
{
    int ret;
    
    ret = vga_init();
    if(ret != 0) {
        d_error_push(__FUNCTION__": vga_init failed.");
        return failure;
    }
    raster_vbuf = NULL;
    return success;
}
Exemple #23
0
/*
 * Term hook
 * Initialize a new term
 */
static void term_init_svgalib(term *t)
{
	int vgamode;

	/* Only one term */
	(void) t;

	vga_init();

	/* The palette is 256x3 bytes big (RGB). */
	C_MAKE(pal, 768, byte);

#ifdef USE_GRAPHICS

	/* Hardwire this mode in for now */
	vgamode = G1024x768x256;

	/* Set up the bitmap buffer context */
	gl_setcontextvgavirtual(vgamode);
	buffer = gl_allocatecontext();
	gl_getcontext(buffer);

	/* Load bitmap into virtual screen */
	term_load_bitmap();

#endif /* USE_GRAPHICS */

	/* Hardwire this mode in for now */
	vgamode = G640x480x256;

	/* Set up the physical screen context */
	if (vga_setmode(vgamode) < 0)
	{
		quit("Graphics mode not available!");
	}

	gl_setcontextvga(vgamode);
	screen = gl_allocatecontext();
	gl_getcontext(screen);

	/* Is this needed? */
	gl_enablepageflipping(screen);

	/* Set up palette colors */
	setpal();

	/* Load the character font data */
	initfont();

	/* Color 0 isn't transparent */
	gl_setwritemode(WRITEMODE_OVERWRITE);
}
Exemple #24
0
void kernel_start(void)
{

	vga_init();
	
	if (magic != 0x2badb002)
	{
		kpanic("We are not booting off a Multiboot bootloader.");
	}

	kprintf("muskios 0.1 (git %s)\nCopyright 2013 Maxthon Chan\n\n", MUSKIOS_VERSION);
	kprintf("Multiboot 0x%x", magic);
}
Exemple #25
0
int koutput_init(void)
{
#ifdef CONFIG_VGA
	vga_init();
#endif
#ifdef CONFIG_UART
	if (mb_info && (mb_info->flags & MULTIBOOT_INFO_CMDLINE))
		if (!uart_early_init((char*) mb_info->cmdline))
			early_print |= UART_EARLY_PRINT;
#endif

	return 0;
}
Exemple #26
0
bool screen_init (void)
{
#ifdef LINUXFB
  use_fb = 1;
  if (fb_init ()) 
  {
    use_fb = 0;
    return false;
  }
#endif

#ifdef VGALIB
  use_fb = 0;
  vga_init ();
  vga_setmode(DEFAULT_VGA_MODE);
  gl_setcontextvga(DEFAULT_VGA_MODE);
  physical_screen = gl_allocatecontext();
  gl_getcontext(physical_screen);

  gl_setcontextvgavirtual(DEFAULT_VGA_MODE);
  virtual_screen = gl_allocatecontext();
  gl_getcontext(virtual_screen);

  gl_setcontext(virtual_screen);
  //vga_ext_set(VGA_EXT_SET,  VGA_CLUT8);

// color table:
// http://en.wikipedia.org/wiki/ANSI_escape_code#Colors 

  gl_setpalettecolor(BLUE, 0, 0, 63); // blue
  gl_setpalettecolor(BLACK, 0, 0, 0); // black
  gl_setpalettecolor(GREEN, 0, 63, 0); 
  gl_setpalettecolor(RED, 63, 0, 0); 
  gl_setpalettecolor(BROWN, 170/4, 85/4, 0);
  gl_setpalettecolor(MAGENTA, 170/4, 0, 170/4);
  gl_setpalettecolor(CYAN, 0, 170/4, 170/4); 
  gl_setpalettecolor(GRAY, 48, 48, 48);

  gl_setpalettecolor(LIGHTBLACK, 85/4, 85/4, 85/4); 
  gl_setpalettecolor(LIGHTBLUE, 85/4, 85/4, 255/4); 
  gl_setpalettecolor(LIGHTGREEN, 85/4, 255/4, 85/4); 
  gl_setpalettecolor(LIGHTCYAN, 85/4, 255/4, 255/4); 
  gl_setpalettecolor(LIGHTRED, 25/45/4, 85/4, 85/4); 
  gl_setpalettecolor(LIGHTMAGENTA, 255/4, 85/4, 255/4); 
  gl_setpalettecolor(LIGHTBROWN, 255/4, 255/4, 85/4); 

#endif

  active_console = 1;
  return true;
}
Exemple #27
0
int sysdep_init(void)
{
   fprintf(stderr,
      "info: using FXmame v0.5 driver for xmame, written by Mike Oliphant\n");
   
   if (InitGlide()!=OSD_OK)
      return OSD_NOT_OK;
   if (vga_init())
      return OSD_NOT_OK;
   if (svga_input_init())
      return OSD_NOT_OK;
   
   return OSD_OK;
}
int sysdep_display_init(void)
{
	memset(sysdep_display_properties.mode_info, 0,
	  SYSDEP_DISPLAY_VIDEO_MODES * sizeof(int));
        sysdep_display_properties.mode_info[0] =
          SYSDEP_DISPLAY_FULLSCREEN | SYSDEP_DISPLAY_EFFECTS;
        memset(sysdep_display_properties.mode_name, 0,
          SYSDEP_DISPLAY_VIDEO_MODES * sizeof(const char *));
        sysdep_display_properties.mode_name[0] = "SvgaLib";

        if (vga_init())
            return 1;

	return svga_input_init();
}
Exemple #29
0
int graphics_setup (void)
{
    int i,j, count = 1;

    vga_init();

    current_vgamode = TEXT;

    for (i = 0; i < MAX_SCREEN_MODES; i++) {
	/* Ignore the larger modes which only make sense for Picasso screens.  */
	if (x_size_table[i] > 800 || y_size_table[i] > 600)
	    continue;

	for (j = 0; j < MAX_COLOR_MODES+1; j++) {
	    /* Delete modes which are not available on this card.  */
	    if (!vga_hasmode (vga_mode_table[i][j])) {
		vga_mode_table[i][j] = -1;
	    }

	    if (vga_mode_table[i][j] != -1)
		count++;
	}
    }

    video_mode_menu = (struct bstring *)malloc (sizeof (struct bstring)*count);
    memset (video_mode_menu, 0, sizeof (struct bstring)*count);
    count = 0;

    for (i = 0; i < MAX_SCREEN_MODES; i++) {
	/* Ignore the larger modes which only make sense for Picasso screens.  */
	if (x_size_table[i] > 800 || y_size_table[i] > 600)
	    continue;

	for (j = 0; j < MAX_COLOR_MODES+1; j++) {
	    char buf[80];
	    if (vga_mode_table[i][j] == -1)
		continue;

	    sprintf (buf, "%3dx%d, %s", x_size_table[i], y_size_table[i],
		     colormodes[j]);
	    video_mode_menu[count].val = -1;
	    video_mode_menu[count++].data = strdup(buf);
	}
    }
    video_mode_menu[count].val = -3;
    video_mode_menu[count++].data = NULL;
    return 1;
}
Exemple #30
0
void kmain(struct multiboot_info *mbt)
{
    vga_init();

    gdt_install();
    idt_install();
    isr_install();
    irq_install();
    syscalls_install();

    puts_c(__kernel_name " kernel v" __kernel_version_str "\n\n", COLOR_LIGHT_BLUE, COLOR_DEFAULT_BG);

    uint64_t mem;
    get_multiboot_info(mbt, &mem);

    extern uint32_t _kernel_memory_end[];
    kprintf("End of kernel's memory: 0x%x\n", (uint64_t) (uint32_t) _kernel_memory_end);
    kprintf("Memory:\n%l B\n%l KB\n%l MB\n%l GB\n", mem, mem / 1024, mem / 1024 / 1024, mem / 1024 / 1024 / 1024);
    
    init_paging();
    map_page(0xFD7FF000, 0x60000, 3);
    int *p = (int *) 0xFD7FF000;
    *p = 12;
    kprintf("*(0x%x) = %i\n", (uint64_t) (uint32_t) p, *p);

    map_page(0x10000000, 0x60000, 3);
    int *p2 = (int *) 0x10000000;
    kprintf("*(0x%x) = %i\n", (uint64_t) (uint32_t) p2, *p2);

    print_next_available_page();
    uint32_t ap = allocate_page(203);
    map_page(ap, 0x60000, 3);
    int *p3 = (int *) ap;
    kprintf("*(0x%x) = %i\n", (uint64_t) ap, *p3);

    print_next_available_page();
    ap = allocate_page(203);
    kprintf("ap = 0x%x\n", (uint32_t) ap);

    struct kthread thread;
    create_kthread(thread_test, &thread);
    start_kthread(&thread);
    kprintf("Returned from thread.\n");

    _asm_print_test();

    return;
}