VirtualBox

Changeset 67785 in vbox for trunk/src/VBox/Devices/PC/BIOS


Ignore:
Timestamp:
Jul 5, 2017 8:46:04 AM (8 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
116703
Message:

BIOS: Preserve most flags on INT 16h/01h, 11h. Some software depends on enabling interrupts and/or preserving TF, DF.

Location:
trunk/src/VBox/Devices/PC/BIOS
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/PC/BIOS/biosint.h

    r62509 r67785  
    170170    uint16_t        es;
    171171    uint16_t        ds;
     172    uint16_t        ifl;
    172173    iret_addr_t     ra;
    173174} kbd_regs_t;
  • trunk/src/VBox/Devices/PC/BIOS/keyboard.c

    r63562 r67785  
    645645#define SP      r.gr.u.r16.sp
    646646#define FLAGS   r.ra.flags.u.r16.flags
     647#define IFLGS   r.ifl
    647648
    648649/* Interrupt 16h service implementation. */
     
    686687
    687688    case 0x01: /* check keyboard status */
    688         SET_IF();   /* Enable interrupts. Some callers depend on that! */
     689        /* Enable interrupts, preserve most flags. Some callers depend on that! */
     690        FLAGS = IFLGS;
    689691        if ( !dequeue_key(&scan_code, &ascii_code, 0) ) {
    690692            SET_ZF();
     
    763765
    764766    case 0x11: /* check MF-II keyboard status */
    765         SET_IF();
     767        /* Enable interrupts, preserve most flags. Some callers depend on that! */
     768        FLAGS = IFLGS;
    766769        if ( !dequeue_key(&scan_code, &ascii_code, 0) ) {
    767770            SET_ZF();
  • trunk/src/VBox/Devices/PC/BIOS/notes.txt

    r67694 r67785  
    1212  emulation.
    1313
    14 - Keystroke check (INT 16h, fn 01h/10h) always enables interrupts on return.
     14- Keystroke check (INT 16h, fn 01h/11h) always enables interrupts on return.
    1515  DOS POWER.EXE depends on that in some situations.
     16
     17- IBM DOS J5.00/V is even worse and does a far jump into INT 16h/11h after
     18  pushing garbage on the stack. Using IRET directly may change IOPL, set
     19  TF, change direction flag, etc. We have to use or simulate RETF 2 instead.
    1620
    1721- MS-DOS 5.0/V setup assumes that INT 13h always returns with interrupts
  • trunk/src/VBox/Devices/PC/BIOS/orgs.asm

    r67694 r67785  
    873873int16_handler:
    874874                sti
     875                ;; Flags are saved *after* enabling interrupts, and with
     876                ;; implicitly cleared TF. Software may depend on that.
     877                pushf
    875878                push    es
    876879                push    ds
     
    888891                pop     ds
    889892                pop     es
     893                add     sp, 2           ; Skip saved flags
    890894                iret
    891895
     
    915919                pop     ds
    916920                pop     es
     921                add     sp, 2           ; Skip saved flags
    917922; TODO: review/enable? If so, flags should be restored here?
    918923if 0
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette