On Thu, Jul 21, 2011 at 02:49:08AM +0300, Nikolay Nikolov wrote:
Hi, all,
I made a patch for proper Ctrl-Break handling. This is useful for MS-DOS or compatible operating systems like FreeDOS.
When Ctrl-Break is detected, it clears the keyboard buffer, sets the Ctrl-Break flag at [0040h:0071h], invokes int 1Bh and then adds 0000h to the keyboard buffer. If a non-enhanced keyboard is present, Ctrl-Scroll Lock works just like Ctrl-Break. This seems to be the "standard" BIOS behaviour, at least on the PCs I tested.
The patch was tested with MS-DOS 6.22, running under qemu.
Thanks. Please see my comments below.
I'm new to git (and this is my first SeaBIOS patch ever), so I'm not sure what's the preferred way to submit patches. I just did a "git diff" and attached the result. Sorry if that's not the best way :)
Best way is to run "git format-patch", but "git diff" is also fine. Please do include a "Signed-off-by" line in your commit message or email message though.
diff --git a/src/kbd.c b/src/kbd.c index 1977c5d..e85f92d 100644 --- a/src/kbd.c +++ b/src/kbd.c @@ -406,7 +406,6 @@ __process_key(u8 scancode) }
// XXX - PrtScr should cause int 0x05
// XXX - Ctrl+Break should cause int 0x1B // XXX - SysReq should cause int 0x15/0x85
switch (scancode) {
@@ -474,12 +473,31 @@ __process_key(u8 scancode) flags1 &= ~KF1_NUM; break;
- case 0x46: /* Scroll Lock press */
flags1 |= KF1_SCROLL;
flags0 ^= KF0_SCROLLACTIVE;
- case 0x46: /* Scroll Lock or Ctrl-Break press */
if (flags2 & KF2_LAST_E0
|| (!(flags2 & KF2_101KBD) && (flags0 & KF0_CTRLACTIVE))) {
// Ctrl-Break press
flags2 &= ~KF2_LAST_E0;
SET_BDA(kbd_flag2, flags2);
SET_BDA(break_flag, 0x80);
SET_BDA(kbd_buf_tail, GET_BDA(kbd_buf_head));
asm volatile ("int $0x1B":::"memory");
Can this use call16_simpint() instead? If not, calling an interrupt should probably backup/restore the register state.
enqueue_key(0, 0);
RBIL implies the 0000 should be added to the keyboard buffer before the int 0x1B - though I'm not really familiar enough to say which is really correct.
-Kevin