Changeset 9a63657 in mainline


Ignore:
Timestamp:
2008-12-27T11:29:11Z (15 years ago)
Author:
Jiri Svoboda <jirik.svoboda@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
24a44ec
Parents:
ac48fef
Message:

Revive kernel EGA fb driver. Plus fix bug — was using memcpy() for scrolling instead of memmove().

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/ia32/src/drivers/ega.c

    rac48fef r9a63657  
    3939#include <mm/page.h>
    4040#include <mm/as.h>
     41#include <mm/slab.h>
    4142#include <arch/mm/page.h>
    4243#include <synch/spinlock.h>
     
    5960static uint32_t ega_cursor;
    6061static uint8_t *videoram;
     62static uint8_t *backbuf;
    6163
    6264static void ega_putchar(chardev_t *d, const char ch);
     
    7274{
    7375        uint8_t hi, lo;
     76
     77        backbuf = (uint8_t *) malloc(SCREEN * 2, 0);
     78        if (!backbuf)
     79                panic("Unable to allocate backbuffer.\n");
    7480       
    7581        videoram = (uint8_t *) hw_map(VIDEORAM, SCREEN * 2);
     
    99105{
    100106        videoram[ega_cursor * 2] = ch;
     107        backbuf[ega_cursor * 2] = ch;
    101108}
    102109
     
    109116                return;
    110117
    111         memcpy((void *) videoram, (void *) (videoram + ROW * 2), (SCREEN - ROW) * 2);
     118        memmove((void *) videoram, (void *) (videoram + ROW * 2), (SCREEN - ROW) * 2);
     119        memmove((void *) backbuf, (void *) (backbuf + ROW * 2), (SCREEN - ROW) * 2);
    112120        memsetw(videoram + (SCREEN - ROW) * 2, ROW, 0x0720);
     121        memsetw(backbuf + (SCREEN - ROW) * 2, ROW, 0x0720);
    113122        ega_cursor = ega_cursor - ROW;
    114123}
     
    152161}
    153162
     163void ega_redraw(void)
     164{
     165        memcpy(videoram, backbuf, SCREEN * 2);
     166        ega_move_cursor();
     167}
     168
    154169/** @}
    155170 */
Note: See TracChangeset for help on using the changeset viewer.