Changeset 59114 in vbox for trunk/src/VBox
- Timestamp:
- Dec 14, 2015 1:46:52 PM (9 years ago)
- Location:
- trunk/src/VBox/Devices/PC/BIOS
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/PC/BIOS/floppy.c
r56316 r59114 82 82 uint8_t floppy_wait_for_interrupt(void) 83 83 { 84 uint32_t retries = 18; 85 84 86 int_disable(); 85 for (; ;)87 for (;retries;--retries) 86 88 { 87 89 uint8_t val8 = read_byte(0x0040, 0x003e); … … 90 92 int_enable_hlt_disable(); 91 93 } 94 return 0; 92 95 } 93 96 … … 175 178 // wait on 40:3e bit 7 to become 1 176 179 do { 180 val8 = inb(0x80); 177 181 val8 = read_byte(0x0040, 0x003e); 178 } while ( (val8 & 0x80) == 0 );182 } while ( (val8 & 0x80) == 0 && --retries); 179 183 val8 &= 0x7f; 180 184 int_disable(); -
trunk/src/VBox/Devices/PC/BIOS/keyboard.c
r56292 r59114 55 55 void jmp_post(void); 56 56 #pragma aux jmp_post = "jmp far ptr post" aborts; 57 58 extern void eoi_master_pic(void); /* in assembly code */ 59 #pragma aux eoi_master_pic "*"; 60 61 /* Manually save/restore BP around invoking user Ctrl-Break handler. 62 * The handler could conceivably clobber BP and the compiler does not 63 * believe us when we say 'modify [bp]' (BP is considered unalterable). 64 */ 65 void int_1b(void); 66 #pragma aux int_1b = \ 67 "push bp" \ 68 "int 1Bh" \ 69 "pop bp" \ 70 value [bp] modify [bp]; 71 57 72 58 73 #define none 0 … … 358 373 } 359 374 360 361 shift_flags = read_byte(0x0040, 0x17);362 375 mf2_flags = read_byte(0x0040, 0x18); 363 376 mf2_state = read_byte(0x0040, 0x96); 377 /* Check if suspend flag set but no E1 prefix (i.e. not Pause). */ 378 if ((mf2_flags & 0x08) && !(shift_flags & 0x01)) { 379 /* Pause had been pressed. Clear suspend flag and do nothing. */ 380 mf2_flags &= ~0x08; 381 write_byte(0x0040, 0x18, mf2_flags); 382 return; 383 } 384 385 shift_flags = read_byte(0x0040, 0x17); 364 386 asciicode = 0; 365 387 … … 441 463 break; 442 464 443 case 0x45: /* Num Lock press */465 case 0x45: /* Num Lock/Pause press */ 444 466 if ((mf2_state & 0x03) == 0) { 467 /* Num Lock */ 445 468 mf2_flags |= 0x20; 446 469 write_byte(0x0040, 0x18, mf2_flags); 447 470 shift_flags ^= 0x20; 448 471 write_byte(0x0040, 0x17, shift_flags); 449 } 450 break; 451 case 0xc5: /* Num Lock release */ 472 } else { 473 /* Pause */ 474 mf2_flags |= 0x08; /* Set the suspend flag */ 475 write_byte(0x0040, 0x18, mf2_flags); 476 477 /* Enable keyboard and send EOI. */ 478 outp(0x64, 0xae); 479 eoi_master_pic(); 480 481 while (read_byte(0x0040, 0x18) & 0x08) 482 ; /* Hold on and wait... */ 483 484 //@todo: We will send EOI again (and enable keyboard) on the way out; we shouldn't 485 } 486 break; 487 case 0xc5: /* Num Lock/Pause release */ 452 488 if ((mf2_state & 0x03) == 0) { 453 489 mf2_flags &= ~0x20; … … 456 492 break; 457 493 458 case 0x46: /* Scroll Lock press */ 459 mf2_flags |= 0x10; 460 write_byte(0x0040, 0x18, mf2_flags); 461 shift_flags ^= 0x10; 462 write_byte(0x0040, 0x17, shift_flags); 463 break; 464 465 case 0xc6: /* Scroll Lock release */ 466 mf2_flags &= ~0x10; 467 write_byte(0x0040, 0x18, mf2_flags); 494 case 0x46: /* Scroll Lock/Break press */ 495 if (mf2_state & 0x02) { /* E0 prefix? */ 496 /* Zap the keyboard buffer. */ 497 write_word(0x0040, 0x001c, read_word(0x0040, 0x001a)); 498 499 write_byte(0x0040, 0x71, 0x80); /* Set break flag */ 500 outp(0x64, 0xae); /* Enable keyboard */ 501 int_1b(); /* Invoke user handler */ 502 enqueue_key(0, 0); /* Dummy key press*/ 503 } else { 504 mf2_flags |= 0x10; 505 write_byte(0x0040, 0x18, mf2_flags); 506 shift_flags ^= 0x10; 507 write_byte(0x0040, 0x17, shift_flags); 508 } 509 break; 510 511 case 0xc6: /* Scroll Lock/Break release */ 512 if (!(mf2_state & 0x02)) { /* Only if no E0 prefix */ 513 mf2_flags &= ~0x10; 514 write_byte(0x0040, 0x18, mf2_flags); 515 } 468 516 break; 469 517 -
trunk/src/VBox/Devices/PC/BIOS/makefile
r50160 r59114 16 16 CFLAGS = -q -0 -wx -zu -s -oas -d1+ -ms 17 17 CFLAGS32 = -q -wx -zu -s -oas -d1+ -ms -nt=BIOS32 -nd=BIOS32 18 # -oat seems to prevent ENTER/LEAVE generation 19 #CFLAGS32 = -q -wx -zu -s -oat -d1+ -ms -nt=BIOS32 -nd=BIOS32 18 20 19 21 DEFS = -DVBOX -DVBOX_LANBOOT_SEG=0xE200 -DVBOX_VERSION_STRING=$(Q)0.9$(Q) & … … 45 47 clname DATA segaddr=0xF000 segment _DATA & 46 48 clname CODE & 47 segment _TEXT segaddr=0xF000 offset=0x1 600 &49 segment _TEXT segaddr=0xF000 offset=0x1C00 & 48 50 segment BIOS32 segaddr=0xF000 offset=0xDB00 & 49 51 segment BIOSSEG segaddr=0xF000 offset=0xE000 & -
trunk/src/VBox/Devices/PC/BIOS/orgs.asm
r57162 r59114 908 908 xor ax, ax 909 909 mov ds, ax 910 mov al, ds:[496h] ; mf2_state |= 0x02 911 or al, 2 ; TODO: why not RMW? 912 mov ds:[496h], al 910 or byte ptr ds:[496h], 2 ; mf2_state |= 0x02 913 911 jmp int09_done 914 912 … … 917 915 jne int09_process_key 918 916 xor ax, ax 919 mov ds, ax ; TODO: haven't we just done that?? 920 mov al, ds:[496h] 921 or al, 1 922 mov ds:[496h], al ; TODO: why not RMW? 917 mov ds, ax 918 or byte ptr ds:[496h], 1 ; mf2_state | 0x01 923 919 jmp int09_done 924 920
Note:
See TracChangeset
for help on using the changeset viewer.