Changeset 557 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS/Src/Handlers
- Timestamp:
- Jun 19, 2013, 6:47:58 PM (11 years ago)
- google:author:
- aitotat@gmail.com
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h.asm
r556 r557 103 103 %ifdef MODULE_DRIVEXLATE 104 104 call DriveXlate_ToOrBack 105 mov [RAMVARS.xlateVars+XLATEVARS.bXlatedDrv], dl106 105 %endif 107 106 call FindDPT_ForDriveNumberInDL ; DS:DI points to our DPT, or NULL if not our drive … … 166 165 UnsupportedFunction: 167 166 Int13h_DirectCallToAnotherBios: 168 call ExchangeCurrentInt13hHandlerWithOldInt13hHandler 167 %ifdef MODULE_DRIVEXLATE 168 ; Disable drive number translations in case of recursive INT 13h calls 169 mov [RAMVARS.xlateVars+XLATEVARS.bXlatedDrv], dl 170 push WORD [RAMVARS.xlateVars+XLATEVARS.wFDandHDswap] 171 mov WORD [RAMVARS.xlateVars+XLATEVARS.wFDandHDswap], 8000h ; No translation 172 %endif 173 174 push bp ; Store offset to IDEPACK (SS:SP now points it) 175 176 ; Simulate INT by pushing flags and return address 177 push WORD [bp+IDEPACK.intpack+INTPACK.flags] 178 popf 179 pushf ; Simulate INT by pushing flags 180 push cs 181 ePUSH_T di, .ReturnFromAnotherBios ; Can not corrupt flags 182 183 ; Push old INT 13h handler and restore registers 184 push WORD [RAMVARS.fpOldI13h+2] 185 push WORD [RAMVARS.fpOldI13h] 169 186 mov bx, [bp+IDEPACK.intpack+INTPACK.bx] 170 187 mov di, [bp+IDEPACK.intpack+INTPACK.di] 171 188 mov ds, [bp+IDEPACK.intpack+INTPACK.ds] 172 push WORD [bp+IDEPACK.intpack+INTPACK.flags]173 popf174 push bp175 189 mov bp, [bp+IDEPACK.intpack+INTPACK.bp] 176 177 test dl, dl 178 js SHORT .CallHardDiskHandler 179 int BIOS_DISKETTE_INTERRUPT_40h ; Windows 98 requires we call INT 40h for floppy drives (reason unknown) 180 SKIP2B bp ; Skip INT 13h 181 .CallHardDiskHandler: 182 int BIOS_DISK_INTERRUPT_13h ; Can safely do as much recursion as it wants 183 184 ; Store returned values to INTPACK 185 pop bp ; Standard INT 13h functions never uses BP as return register 190 retf ; "Return" to old INT 13h 191 .ReturnFromAnotherBios: 192 193 %if 0 194 ; We need to restore our pointer to IDEPACK but we cannot corrupt any register 195 push ax ; Dummy WORD 196 cli 197 xchg bp, sp 198 mov [bp], sp ; Replace dummy WORD with returned BP 199 mov sp, [bp+2] ; Load offset to IDEPACK 200 xchg sp, bp 201 sti ; We would have set IF anyway when exiting INT 13h 202 pop WORD [bp+IDEPACK.intpack+INTPACK.bp] 203 %endif 204 ; Actually we can corrupt BP since no standard INT 13h function uses it as return 205 ; register. Above code is kept here just in case if there is some non-standard function. 206 ; POP BP below also belongs to the above code. 207 pop bp ; Clean IDEPACK offset from stack 208 209 ; Store remaining returned values to INTPACK 186 210 %ifdef USE_386 211 ; We do not use GS or FS at the moment 187 212 ; mov [bp+IDEPACK.intpack+INTPACK.gs], gs 188 213 ; mov [bp+IDEPACK.intpack+INTPACK.fs], fs … … 205 230 206 231 %ifdef MODULE_DRIVEXLATE 232 ; Restore drive number translation back to what it was 233 pop WORD [RAMVARS.xlateVars+XLATEVARS.wFDandHDswap] 207 234 cmp dl, [RAMVARS.xlateVars+XLATEVARS.bXlatedDrv] ; DL is still drive number? 208 je SHORT .ExchangeInt13hHandlers235 je SHORT Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH 209 236 mov [bp+IDEPACK.intpack+INTPACK.dl], dl ; Something is returned in DL 210 ALIGN JUMP_ALIGN 211 .ExchangeInt13hHandlers: 212 %endif 213 214 %ifdef USE_186 215 push Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH 216 jmp SHORT ExchangeCurrentInt13hHandlerWithOldInt13hHandler 217 %else 218 call ExchangeCurrentInt13hHandlerWithOldInt13hHandler 237 %endif 219 238 jmp SHORT Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH 220 %endif221 239 222 240 … … 295 313 ALIGN JUMP_ALIGN 296 314 Int13h_CallPreviousInt13hHandler: 297 call ExchangeCurrentInt13hHandlerWithOldInt13hHandler 298 int BIOS_DISK_INTERRUPT_13h 299 ;;; fall-through to ExchangeCurrentInt13hHandlerWithOldInt13hHandler 300 301 ;-------------------------------------------------------------------- 302 ; ExchangeCurrentInt13hHandlerWithOldInt13hHandler 303 ; Parameters: 304 ; DS: RAMVARS segment 305 ; Returns: 306 ; Nothing 307 ; Corrupts registers: 308 ; Nothing 309 ; Note: Flags are preserved 310 ;-------------------------------------------------------------------- 311 ALIGN JUMP_ALIGN 312 ExchangeCurrentInt13hHandlerWithOldInt13hHandler: 313 push es 314 push si 315 LOAD_BDA_SEGMENT_PRESERVE_FLAGS_TO es, si 316 mov si, [RAMVARS.fpOldI13h] 317 cli 318 xchg si, [es:BIOS_DISK_INTERRUPT_13h*4] 319 mov [RAMVARS.fpOldI13h], si 320 mov si, [RAMVARS.fpOldI13h+2] 321 xchg si, [es:BIOS_DISK_INTERRUPT_13h*4+2] 322 sti 323 mov [RAMVARS.fpOldI13h+2], si 324 pop si 325 pop es 315 pushf ; Simulate INT by pushing flags 316 call far [RAMVARS.fpOldI13h] 326 317 ret 327 318
Note:
See TracChangeset
for help on using the changeset viewer.