VirtualBox

Changeset 42791 in vbox


Ignore:
Timestamp:
Aug 13, 2012 12:38:33 PM (12 years ago)
Author:
vboxsync
Message:

BIOS: Fixed 16-bit PM APM interface.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/PC/BIOS/apm.c

    r42770 r42791  
    165165        // @todo: change connection state
    166166        break;
     167    case APM_PM_CONN:
     168        // @todo: validate device ID
     169        // @todo: validate current connection state
     170        // @todo: change connection state
     171        AX = APM_BIOS_SEG;              /* 16-bit PM code segment (RM segment base). */
     172        BX = (uint16_t)apm_pm16_entry;  /* 16-bit PM entry point offset. */
     173        CX = APM_BIOS_SEG;              /* 16-bit data segment. */
     174        SI = APM_BIOS_SEG_LEN;          /* 16-bit PM code segment length. */
     175        DI = APM_BIOS_SEG_LEN;          /* Data segment length. */
     176        break;
    167177    case APM_32_CONN:
    168178        // @todo: validate device ID
  • trunk/src/VBox/Devices/PC/BIOS/apm_pm.asm

    r42770 r42791  
    124124
    125125
     126;; 16-bit protected mode APM entry point
     127
     128;; According to the APM spec, only CS (16-bit code selector) is defined.
     129;; The data selector can be derived from it.
    126130
    127131apm_pm16_entry:
    128                 stc
    129                 retf                    ; return to 16-bit caller
     132
     133                mov     ah, 2           ; mark as originating in 16-bit PM
     134               
     135                                        ; fall through
    130136
    131137apm_pm16_entry_from_32:
     
    144150                pop     ds              ; restore registers
    145151
    146 .386
    147                 retfd                   ; return to 32-bit code
     152                retf                    ; return to caller - 16-bit return
     153                                        ; even to 32-bit thunk!
    148154
    149155_TEXT           ends
     
    161167;; selector and the data selector can be derived from it.
    162168
     169;; WARNING: To simplify matters, we use 16-bit far return to go from 32-bit
     170;; code to 16-bit and back. As a consequence, the 32-bit APM code must lie
     171;; below 64K boundary in the 32-bit APM code segment.
     172
    163173apm_pm32_entry:
    164174
    165 ;               cli
    166 ;               hlt
    167 
    168175                push    ebp             ; ebp is not used by APM
    169176
    170                 push    cs              ; return address for 16-bit code
    171                 push    apm_pm32_back
     177                mov     bp, cs          ; return address for 16-bit code
     178                push    bp
     179                mov     ebp, apm_pm32_back
     180                push    bp              ; Note: 16:16 address!
    172181
    173182                push    cs
    174183                pop     ebp
    175184                add     ebp, 8          ; calculate 16-bit code selector
    176                 push    ebp             ; push 16-bit code selector
    177 
    178                 xor     ebp, ebp        ; manually pad 16-bit offset
    179                 push    bp              ; to a 32-bit value
    180                 push    apm_pm16_entry_from_32
     185                push    bp              ; push 16-bit code selector
     186
     187                mov     ebp, apm_pm16_entry_from_32
     188                push    bp              ; push 16-bit offset
    181189
    182190                mov     ah, 3           ; mark as originating in 32-bit PM
     191
     192                db      66h             ; force a 16-bit return
    183193                retf                    ; off to 16-bit code...
    184194
  • trunk/src/VBox/Devices/PC/BIOS/notes.txt

    r42770 r42791  
    4545
    4646- PC DOS 6.x/7.x QCONFIG is a rare user of INT 16h fn 0Ah (read keyboard ID).
     47
     48- DOS POWER.EXE uses the real mode APM interface, OS/2 APM.SYS uses the 16-bit
     49  protected mode APM interface, and Windows 9x uses the 32-bit protected mode
     50  APM interface.
    4751
    4852- Windows 98 is one of the few APM 1.2 users; Windows 95 uses APM 1.1, while
Note: See TracChangeset for help on using the changeset viewer.

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