[SeaBIOS] [PATCH v2 0/3] seabios: add serial console support

2016-07-04 Thread Gerd Hoffmann
Hi, Next round of patches. Changes: * Moved it all to a new sercon.c file. * Code maps cp437 to utf8 now, giving a much nicer display. Compare "Use the ↑ and ↓ keys to change the selection." (this series) with "Use the ^ and v keys to change the selection." (sgabios) ;-) * Simplifie

[SeaBIOS] [PATCH 2/3] kbd: make enqueue_key public, add ascii_to_keycode

2016-07-04 Thread Gerd Hoffmann
Signed-off-by: Gerd Hoffmann --- src/kbd.c | 17 - src/util.h | 2 ++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/kbd.c b/src/kbd.c index 61d9df0..7c43129 100644 --- a/src/kbd.c +++ b/src/kbd.c @@ -51,7 +51,7 @@ kbd_init(void) , x + FIELD_SIZE

[SeaBIOS] [PATCH 3/3] add serial console support

2016-07-04 Thread Gerd Hoffmann
Signed-off-by: Gerd Hoffmann --- Makefile | 2 +- src/clock.c | 1 + src/misc.c | 2 + src/optionroms.c | 4 +- src/sercon.c | 545 +++ src/util.h | 3 + 6 files changed, 555 insertions(+), 2 deletions(-)

[SeaBIOS] [PATCH 1/3] std: add cp437 to unicode map

2016-07-04 Thread Gerd Hoffmann
Signed-off-by: Gerd Hoffmann --- src/std/cp437.h | 258 1 file changed, 258 insertions(+) create mode 100644 src/std/cp437.h diff --git a/src/std/cp437.h b/src/std/cp437.h new file mode 100644 index 000..fafb864 --- /dev/null +++ b/sr

Re: [SeaBIOS] [RFC PATCH 1/2] serial console, output

2016-07-04 Thread Gerd Hoffmann
Hi, > > void sercon_putchar(char *ptr) > > { > > char c = GET_GLOBAL(ptr[0]); > > [ ... ] > > > > ... work? > > Yes. See output.c:puts_cs() as an example. It only works if it's a > constant string (as opposed to a string built on the stack). After cleaning up the code only three fix

Re: [SeaBIOS] [RFC PATCH 1/2] serial console, output

2016-07-04 Thread Gerd Hoffmann
Hi, > I found what I was looking for though - it was in the sgabios > design.txt file instead of the revision history: > So, if I read the above correctly, it was lilo that inspired the > "feature". Anyway, something to keep in mind. Oh. lilo. Interesting. I didn't expect http://www.qemu-a

Re: [SeaBIOS] [RFC PATCH 1/2] serial console, output

2016-07-04 Thread Gerd Hoffmann
Hi, > > Unfortunately, the screen can be larger than 80x25. > > It can with SVGA BIOS, but Gerd here only supports mode 3, doesn't he? Current code yes, but that doesn't imply it'll stay that way forever. Supporting other sizes is just a matter of making sercon_1000() recognizing the mode numb

Re: [SeaBIOS] [RFC PATCH 2/2] serial console, input

2016-07-04 Thread Gerd Hoffmann
Hi, > Does the original code flush the multi-byte sequence on a timeout? I > suspect it is important that one can hit ESC without having to type > another key. Also, I'd prefer to avoid backwards gotos if possible. Yes, sort of. If it didn't match an escape sequence and hasn't seen additiona

Re: [SeaBIOS] [RFC PATCH 1/2] serial console, output

2016-07-04 Thread Kevin O'Connor
On Mon, Jul 04, 2016 at 06:03:30PM +0200, Paolo Bonzini wrote: > On 04/07/2016 18:00, Kevin O'Connor wrote: > > Does anyone know where one can find the original svn commit history > > for sgabios? Seems the original google code repo is no longer > > present. > > There was no history as far as I r

[SeaBIOS] [PATCH 3/3] vgabios: Simplify set_cursor_pos()

2016-07-04 Thread Kevin O'Connor
Rework set_cursor_pos() to be slightly simpler. Signed-off-by: Kevin O'Connor --- vgasrc/vgabios.c | 28 ++-- 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/vgasrc/vgabios.c b/vgasrc/vgabios.c index 2593e03..cfb6ba2 100644 --- a/vgasrc/vgabios.c +++ b/vga

[SeaBIOS] [PATCH 2/3] vgabios: Don't check for special case of page==0xff on external calls

2016-07-04 Thread Kevin O'Connor
The original "lgpl vgabios" internally used page=0xff as a mechanism for specifying the current page. It also would allow int1013 calls to externally specify bh==0xff for the current page. However, there is no documentation supporting this as an externally available feature. SeaVGABIOS does not n

[SeaBIOS] [PATCH 1/3] vgabios: Remove special case of dh==0xff in handle_1013()

2016-07-04 Thread Kevin O'Connor
The original "lgpl vgabios" had a special case for dh==0xff in its int1013 (write string) code. There does not appear to be any VGABIOS documentation supporting this as an externally available feature. It appears this was for its own internal use when writing its strings to the screen. SeaVGABIO

Re: [SeaBIOS] [RFC PATCH 1/2] serial console, output

2016-07-04 Thread Paolo Bonzini
On 04/07/2016 18:00, Kevin O'Connor wrote: > So, if I read the sgabios code correctly, it allocates a buffer of: > > struct { u8 x, y; char c; } logbuf[256]; > int logbuf_offset; > > Every character sent on the serial port is appended to "logbuf" in > order, wrapping if necessary: logbuf[logbuf

Re: [SeaBIOS] [RFC PATCH 1/2] serial console, output

2016-07-04 Thread Kevin O'Connor
On Mon, Jul 04, 2016 at 11:26:48AM -0400, Kevin O'Connor wrote: > At one point I looked through the sgabios code and was able to > understand how it did caching. I'll take another look and see if I > can describe it. So, if I read the sgabios code correctly, it allocates a buffer of: struct { u8

Re: [SeaBIOS] [RFC PATCH 1/2] serial console, output

2016-07-04 Thread Paolo Bonzini
On 04/07/2016 17:26, Kevin O'Connor wrote: > > 4k, we need both character and attribute. But, yes, if we can allocate > > that somewhere in real mode address space without running into memory > > pressure this might be the best option. > > Unfortunately, the screen can be larger than 80x25. It

Re: [SeaBIOS] [RFC PATCH 2/2] serial console, input

2016-07-04 Thread Kevin O'Connor
On Mon, Jul 04, 2016 at 11:16:45AM +0200, Gerd Hoffmann wrote: > Hi, > > > > +#define FLAG_CTRL (1<<0) > > > +#define FLAG_SHIFT (1<<1) > > > + > > > +VARLOW struct { > > > +u8 flags; > > > +u8 scancode; > > > +} termchr[256] = { > > > +[ '1'] = { .scancode = 0x02,

Re: [SeaBIOS] [RFC PATCH 1/2] serial console, output

2016-07-04 Thread Kevin O'Connor
On Mon, Jul 04, 2016 at 02:46:24PM +0200, Gerd Hoffmann wrote: > On Mo, 2016-07-04 at 11:11 +0200, Paolo Bonzini wrote: > > On 04/07/2016 10:16, Gerd Hoffmann wrote: > > > +static void sercon_set_color(u8 fg, u8 bg, u8 bold) > > > +{ > > > +sercon_putchar('\x1b'); > > > +sercon_putchar('[')

Re: [SeaBIOS] [RFC PATCH 1/2] serial console, output

2016-07-04 Thread Paolo Bonzini
On 04/07/2016 14:46, Gerd Hoffmann wrote: > We run in real mode, so passing around pointers isn't that easy. > Given this would make sense for constant strings only (like the 4-byte > clear-screen sequence) and not so much for variable stuff we might put > all strings in the global segment. Hmm

Re: [SeaBIOS] [RFC PATCH 1/2] serial console, output

2016-07-04 Thread Gerd Hoffmann
On Mo, 2016-07-04 at 11:11 +0200, Paolo Bonzini wrote: > > On 04/07/2016 10:16, Gerd Hoffmann wrote: > > > > +sercon_putchar('\x1b'); > > +sercon_putchar('c'); > > +/* clear screen */ > > +sercon_putchar('\x1b'); > > +sercon_putchar('['); > > +sercon_putchar('2'); > > +

Re: [SeaBIOS] [RFC PATCH 2/2] serial console, input

2016-07-04 Thread Gerd Hoffmann
Hi, > > +#define FLAG_CTRL (1<<0) > > +#define FLAG_SHIFT (1<<1) > > + > > +VARLOW struct { > > +u8 flags; > > +u8 scancode; > > +} termchr[256] = { > > +[ '1'] = { .scancode = 0x02, }, > > I think this table should be generated at runtime from > kbd.c:

Re: [SeaBIOS] [RFC PATCH 1/2] serial console, output

2016-07-04 Thread Paolo Bonzini
On 04/07/2016 10:16, Gerd Hoffmann wrote: > > +sercon_putchar('\x1b'); > +sercon_putchar('c'); > +/* clear screen */ > +sercon_putchar('\x1b'); > +sercon_putchar('['); > +sercon_putchar('2'); > +sercon_putchar('J'); > +} > + > +static void sercon_set_color(u8 fg, u8 b

Re: [SeaBIOS] [RFC PATCH 1/2] serial console, output

2016-07-04 Thread Gerd Hoffmann
Hi, > > @@ -57,6 +58,7 @@ handle_10(struct bregs *regs) > > { > > debug_enter(regs, DEBUG_HDL_10); > > // don't do anything, since the VGA BIOS handles int10h requests > > +sercon_10(regs); > > } > > Might as well remove handle_10 and call sercon_10 directly from > romlayout.S.