[Kos-cvs] kos/modules/console _console.c,1.5,1.6

thomas at kos.enix.org thomas at kos.enix.org
Thu Jan 6 19:53:35 CET 2005


Update of /home/kos/cvs/kos/modules/console
In directory the-doors:/tmp/cvs-serv18827

Modified Files:
	_console.c 
Log Message:
Trying to get the cursor working

Index: _console.c
===================================================================
RCS file: /home/kos/cvs/kos/modules/console/_console.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- _console.c	29 Dec 2003 13:42:50 -0000	1.5
+++ _console.c	6 Jan 2005 18:53:33 -0000	1.6
@@ -38,7 +38,7 @@
   /* Take global lock */
   for (i = 0; i < MAX_CONSOLE; i++)
     {
-      if(consoles[i].usage == 0) 
+      if(consoles[i].usage == 0)
 	{
 	  console        = & consoles[i];
 	  console->usage = 1;
@@ -63,9 +63,9 @@
 	 kos-oldies. Don't know exactly what it does, but at least
 	 under Bochs, it doesn't work ;( */
       outb(VGA_SET_CURSOR_START, VGA_COMMAND_PORT);
-      outb( 6, VGA_DATA_PORT);
+      outb( 0, VGA_DATA_PORT);
       outb(VGA_SET_CURSOR_END, VGA_COMMAND_PORT);
-      outb( 2, VGA_DATA_PORT);
+      outb( 0, VGA_DATA_PORT);
 
       memset((char *) video, 0, PAGE_SIZE);
     }
@@ -75,16 +75,16 @@
 	 buffer for the kernel console, because we are now able to
 	 allocate memory */
       if(i == 1) {
-	consoles[KERNEL_CONSOLE].back_buffer = 
+	consoles[KERNEL_CONSOLE].back_buffer =
 	  (volatile unsigned char *) kvalloc(1, FALSE, TRUE);
 
 	memset((char *) consoles[KERNEL_CONSOLE].back_buffer, 0, PAGE_SIZE);
       }
 
-      console->virt_addr = 
+      console->virt_addr =
 	(volatile unsigned char *) kvalloc(1, FALSE, TRUE);
-      
-      if(console->virt_addr == NULL) 
+
+      if(console->virt_addr == NULL)
 	{
 	  return -ENOMEM;
 	}
@@ -100,7 +100,7 @@
     }
 
   console->attr = VGA_COLOR_WHITE;
-  
+
   *console_id = console;
   *width      = COLUMNS;
   *height     = ROWS;
@@ -108,20 +108,20 @@
   return 0;
 }
 
-static result_t console_delete (void *console_id) 
+static result_t console_delete (void *console_id)
 {
   UNUSED(console_id);
   return -ENOSYS;
 }
 
-static result_t console_change (void *from_console_id, void *to_console_id) 
+static result_t console_change (void *from_console_id, void *to_console_id)
 {
   console_t *from_console;
   console_t *to_console;
 
   from_console = (console_t *) from_console_id;
   to_console   = (console_t *) to_console_id;
-  
+
   ASSERT(from_console != NULL);
   ASSERT(to_console != NULL);
 
@@ -133,14 +133,14 @@
 
   memcpy((char *) from_console->back_buffer, (char *) video, PAGE_SIZE);
   from_console->virt_addr = from_console->back_buffer;
-	 
+
   memcpy((char*) video, (char*) to_console->virt_addr, PAGE_SIZE);
   to_console->virt_addr = video;
 
   return 0;
 }
 
-static result_t console_set_cursor_pos (void *console_id, uint x, uint y) 
+static result_t console_set_cursor_pos (void *console_id, uint x, uint y)
 {
   console_t *console;
   int pos;
@@ -149,7 +149,7 @@
 
   console = (console_t *) console_id;
 
-  pos  = BASE_SCREEN_MEM + (x + y * COLUMNS) * 2;
+  pos = (x + y * COLUMNS) * 2;
 
   outb(VGA_SET_CURSOR_HIGH, VGA_COMMAND_PORT);
   outb( (pos >> 8), VGA_DATA_PORT);
@@ -159,7 +159,7 @@
   return 0;
 }
 
-static result_t console_set_cursor_status (void *console_id, uint state) 
+static result_t console_set_cursor_status (void *console_id, uint state)
 {
   UNUSED(console_id);
   UNUSED(state);
@@ -169,17 +169,17 @@
 static result_t console_set_attribute (void *console_id, uint attr)
 {
   console_t *console;
-  
+
   ASSERT(console_id != NULL);
 
   console = (console_t *) console_id;
 
   console->attr = attr;
-  
+
   return 0;
 }
 
-static result_t console_scroll (void *console_id, uint delta) 
+static result_t console_scroll (void *console_id, uint delta)
 {
   console_t *console = (console_t *) console_id;
   uint i;
@@ -189,24 +189,24 @@
     return 0;
 
   for (i = 0 ; i < ROWS-delta ; i++)
-    memcpy((void *)(console->virt_addr + i*COLUMNS*2), 
+    memcpy((void *)(console->virt_addr + i*COLUMNS*2),
 	   (void *)(console->virt_addr + (i+delta)*COLUMNS*2),
 	   COLUMNS*2);
 
   for (; i < ROWS ; i++)
-    memset((void *)(console->virt_addr + i*COLUMNS*2), 0x0, COLUMNS*2);  
+    memset((void *)(console->virt_addr + i*COLUMNS*2), 0x0, COLUMNS*2);
 
   return 0;
 }
 
 static result_t console_write (void *console_id, const char *str,
-			       size_t len, uint x, uint y) 
+			       size_t len, uint x, uint y)
 {
   console_t *console = (console_t *) console_id;
 
   ASSERT(len == 1);
 
-  while(len--) 
+  while(len--)
     {
       /* TODO : If len != 1, this loop does not work, because we
 	 always print the character at the same address (x should be
@@ -220,7 +220,7 @@
   return 0;
 }
 
-struct tty_output_driver console_output_driver = 
+struct tty_output_driver console_output_driver =
   {
     console_create,
     console_delete,



More information about the Kos-cvs mailing list