Skip to contentSkip to conversation

PATCH: console bug fixes

PATCH Tristan Gingold 2 participants 3 messages Apr 13, 2006

lore
Share & tools
lore
#0 lore raw

Hi,

small patch to fix memcpy misuses in console.c
Tested on ia64 only.

Tristan.

# HG changeset patch
# User [email protected]
# Node ID d2be6e89ea51a8469500d9abccf02af4c9d1bc3d
# Parent bfc00c83f08318097446b3818c9de6f2ce286fb6
Use memmove instead of memcpy for overlapping areas (console scroll). Use memset instead of memcpy to clear line.

xen/drivers/char/console.c +3 -5
diff -r bfc00c83f083 -r d2be6e89ea51 xen/drivers/char/console.c
@@ -180,12 +180,10 @@
 
     if (ypos >= LINES)
     {
-        static char zeroarr[2*COLUMNS] = { 0 };
         ypos = LINES-1;
-        memcpy((char*)video, 
-               (char*)video + 2*COLUMNS, (LINES-1)*2*COLUMNS);
-        memcpy((char*)video + (LINES-1)*2*COLUMNS, 
-               zeroarr, 2*COLUMNS);
+        memmove((char*)video, 
+                (char*)video + 2*COLUMNS, (LINES-1)*2*COLUMNS);
+        memset((char*)video + (LINES-1)*2*COLUMNS, 0, 2*COLUMNS);
     }
 }
 

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#1 lore raw

While I realize this was done that way before, I'd recommend not storing zeroes when clearing a line, but rather spaces with a proper attribute (which will make the console better cooperate with dom0-s potentially doing non-standard things - especially when debugging I happen to output stuff to the screen without going through printk and the like). Of course, this implies not using memset here. Jan

Quoted 1 line
Quoted 1 line
Quoted 1 line

Tristan Gingold <[email protected]> 13.04.06 10:58:04 >>>

Hi,

small patch to fix memcpy misuses in console.c
Tested on ia64 only.

Tristan.

#2 lore raw
Quoted 6 lines · Jan Beulich

While I realize this was done that way before, I'd recommend not storing zeroes when clearing a line, but rather spaces with a proper attribute (which will make the console better cooperate with dom0-s potentially doing non-standard things - especially when debugging I happen to output stuff to the screen without going through printk and the like). Of course, this implies not using memset here. Jan

Then you should also update cls().

I have submitted the patch mostly for replacing memcpy by memmove. Using memcpy for scrolling on ia64 makes garbage.

Feel free to improve the situation for creating blank lines!

Tristan.