vt: Fixes for the simple vt code
authorAlan Cox <alan@linux.intel.com>
Thu, 18 Dec 2014 11:55:47 +0000 (11:55 +0000)
committerAlan Cox <alan@linux.intel.com>
Thu, 18 Dec 2014 11:55:47 +0000 (11:55 +0000)
Work around what appears to be an sdcc bug
Allow cursor_off to be called first without writing over address 0

Kernel/vt.c

index bd2e799..71353f9 100644 (file)
@@ -216,12 +216,14 @@ static unsigned char csave;
 
 static uint8_t *char_addr(unsigned int y1, unsigned char x1)
 {
-       return VT_BASE + VT_WIDTH * y1 + x1;
+       /* See SDCC bug #2332 */
+       return VT_BASE + VT_WIDTH * y1 + (uint16_t)x1;
 }
 
 void cursor_off(void)
 {
-       *cpos = csave;
+       if (cpos)
+               *cpos = csave;
 }
 
 void cursor_on(int8_t y, int8_t x)