[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] minios: fix minios console
# HG changeset patch # User Keir Fraser <keir.fraser@xxxxxxxxxx> # Date 1255506943 -3600 # Node ID a95b55bf6c1a38b2912e2c5cbc5d2a5cd460b9e4 # Parent 6100b7a34705e40ae23a0e081f2bce1b6ed342f5 minios: fix minios console MiniOS' console_print tries to expand '\n' into "\n\r" in place, causing page faults if the string resides in text. Use a duplicate of the string instead. Signed-off-by: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx> --- extras/mini-os/console/console.c | 18 +++++++++++------- 1 files changed, 11 insertions(+), 7 deletions(-) diff -r 6100b7a34705 -r a95b55bf6c1a extras/mini-os/console/console.c --- a/extras/mini-os/console/console.c Wed Oct 14 08:54:58 2009 +0100 +++ b/extras/mini-os/console/console.c Wed Oct 14 08:55:43 2009 +0100 @@ -79,6 +79,8 @@ void console_print(struct consfront_dev void console_print(struct consfront_dev *dev, char *data, int length) { char *curr_char, saved_char; + char copied_str[length]; + char *copied_ptr; int part_len; int (*ring_send_fn)(struct consfront_dev *dev, const char *data, unsigned length); @@ -86,24 +88,26 @@ void console_print(struct consfront_dev ring_send_fn = xencons_ring_send_no_notify; else ring_send_fn = xencons_ring_send; - - for(curr_char = data; curr_char < data+length-1; curr_char++) + + copied_ptr = copied_str; + memcpy(copied_ptr, data, length); + for(curr_char = copied_ptr; curr_char < copied_ptr+length-1; curr_char++) { if(*curr_char == '\n') { saved_char = *(curr_char+1); *(curr_char+1) = '\r'; - part_len = curr_char - data + 2; - ring_send_fn(dev, data, part_len); + part_len = curr_char - copied_ptr + 2; + ring_send_fn(dev, copied_ptr, part_len); *(curr_char+1) = saved_char; - data = curr_char+1; + copied_ptr = curr_char+1; length -= part_len - 1; } } - ring_send_fn(dev, data, length); + ring_send_fn(dev, copied_ptr, length); - if(data[length-1] == '\n') + if(copied_ptr[length-1] == '\n') ring_send_fn(dev, "\r", 1); } _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |