kern
diff src/vid.c @ 41:928b0ebfff4d
merged the timer/rtc/etc from the misc branch
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Tue, 14 Jun 2011 01:19:07 +0300 |
parents | eaec918de072 |
children |
line diff
1.1 --- a/src/vid.c Sat May 28 08:06:47 2011 +0300 1.2 +++ b/src/vid.c Tue Jun 14 01:19:07 2011 +0300 1.3 @@ -1,5 +1,6 @@ 1.4 #include <string.h> 1.5 #include "vid.h" 1.6 +#include "intr.h" 1.7 #include "asmops.h" 1.8 1.9 /* height of our virtual console text buffer */ 1.10 @@ -27,10 +28,15 @@ 1.11 1.12 void clear_scr(void) 1.13 { 1.14 + int istate = get_intr_state(); 1.15 + disable_intr(); 1.16 + 1.17 memset16(vmem, VMEM_CHAR(' ', LTGRAY, BLACK), WIDTH * HEIGHT); 1.18 start_line = 0; 1.19 set_start_line(0); 1.20 set_cursor(0, 0); 1.21 + 1.22 + set_intr_state(istate); 1.23 } 1.24 1.25 void set_char(char c, int x, int y, int fg, int bg) 1.26 @@ -41,6 +47,8 @@ 1.27 void set_cursor(int x, int y) 1.28 { 1.29 int loc; 1.30 + int istate = get_intr_state(); 1.31 + disable_intr(); 1.32 1.33 if(x < 0 || x >= WIDTH || y < 0 || y >= HEIGHT) { 1.34 loc = 0xffff; 1.35 @@ -52,10 +60,15 @@ 1.36 outb(loc, CRTC_DATA); 1.37 outb(CRTC_CURSOR_HIGH, CRTC_ADDR); 1.38 outb(loc >> 8, CRTC_DATA); 1.39 + 1.40 + set_intr_state(istate); 1.41 } 1.42 1.43 void scroll_scr(void) 1.44 { 1.45 + int new_line, istate = get_intr_state(); 1.46 + disable_intr(); 1.47 + 1.48 if(++start_line > VIRT_HEIGHT - HEIGHT) { 1.49 /* The bottom of the visible range reached the end of our text buffer. 1.50 * Copy the rest of the lines to the top and reset start_line. 1.51 @@ -65,10 +78,11 @@ 1.52 } 1.53 1.54 /* clear the next line that will be revealed by scrolling */ 1.55 - int new_line = start_line + HEIGHT - 1; 1.56 + new_line = start_line + HEIGHT - 1; 1.57 memset16(vmem + new_line * WIDTH, VMEM_CHAR(' ', LTGRAY, BLACK), WIDTH); 1.58 + set_start_line(start_line); 1.59 1.60 - set_start_line(start_line); 1.61 + set_intr_state(istate); 1.62 } 1.63 1.64 static void set_start_line(int line)