Changeset 525 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS/Src


Ignore:
Timestamp:
Mar 14, 2013, 9:45:07 PM (12 years ago)
Author:
krille_n_@…
google:author:
krille_n_@hotmail.com
Message:

Changes:

  • Made some improvements to the stack switching in Int13h.asm.
  • Added a tail-call optimized variant of the CALL_MENU_LIBRARY macro (JMP_MENU_LIBRARY).
  • Other optimizations and fixes.
Location:
trunk/XTIDE_Universal_BIOS/Src/Handlers
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h.asm

    r522 r525  
    3737ALIGN JUMP_ALIGN
    3838Int13h_DiskFunctionsHandlerWithStackChange:
    39     push    ds
     39    sti         ; Enable interrupts
     40    ; TODO: Maybe we need to save Flags (DF) as well?
     41    push    ds  ; Save DS:DI on the original stack
    4042    push    di
    4143    call    RamVars_GetSegmentToDS
    4244
    4345    ; Store entry registers to RAMVARS
     46%ifdef USE_386
     47    pop     DWORD [RAMVARS.dwStackChangeDSDI]
     48%else
     49    pop     WORD [RAMVARS.wStackChangeDI]   ; Pop DS:DI to the top of what
     50    pop     WORD [RAMVARS.wStackChangeDS]   ; is to become the new stack
     51%endif
    4452    mov     [RAMVARS.fpInt13hEntryStack], sp
    4553    mov     [RAMVARS.fpInt13hEntryStack+2], ss
    46     pop     WORD [RAMVARS.wStackChangeDI]
    47     pop     WORD [RAMVARS.wStackChangeDS]
    4854
    4955    ; Load new stack and restore DS and DI
    50     mov     di, ds      ; We do not want to overwrite DS and DI in stack
    51     mov     ss, di
    52     mov     sp, RAMVARS.rgbTopOfStack
    53     lds     di, [RAMVARS.dwStackChangeDSDI]
     56    mov     di, ds      ; We can save 2 bytes by using PUSH/POP but it's slower
     57    mov     ss, di      ; No need to wrap with CLI/STI since this is for AT only (286+)
     58    mov     sp, RAMVARS.rgbTopOfStack-4
     59    pop     di          ; DI before stack change
     60    pop     ds          ; DS before stack change
    5461
    5562    ; Call INT 13h
     
    5966
    6067    ; Restore stack (we must not corrupt FLAGS!)
    61     cli
    6268%ifdef USE_386
    6369    lss     sp, [ss:RAMVARS.fpInt13hEntryStack]
    6470%else
     71    cli
    6572    mov     sp, [ss:RAMVARS.fpInt13hEntryStack]
    6673    mov     ss, [ss:RAMVARS.fpInt13hEntryStack+2]
    67 %endif
    68     pop     di          ; DI before stack change
    69     pop     ds          ; DS before stack change
     74    sti
     75%endif
    7076    retf    2           ; Skip FLAGS from stack
    7177%endif ; RELOCATE_INT13H_STACK
     
    8894ALIGN JUMP_ALIGN
    8995Int13h_DiskFunctionsHandler:
     96%ifndef RELOCATE_INT13H_STACK
    9097    sti                                 ; Enable interrupts
     98%endif
    9199    cld                                 ; String instructions to increment pointers
    92100    CREATE_FRAME_INTPACK_TO_SSBP    SIZE_OF_IDEPACK_WITHOUT_INTPACK
     
    398406    dw  AH1Eh_HandlerForXTCFfeatures                ; 1Eh, Lo-tech XT-CF features (XTIDE Universal BIOS)
    399407%else
    400     dw  UnsupportedFunction                         ; 1Eh, 
     408    dw  UnsupportedFunction                         ; 1Eh,
    401409%endif
    402410    dw  UnsupportedFunction                         ; 1Fh,
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH1Eh_XTCF.asm

    r505 r525  
    112112    jae     SHORT .SetMemoryMappedMode
    113113
    114 ; We need to limit block size here. Consider this scenario;
    115 ; 1. While in PIO mode or memory mapped mode, the drive is set to do
    116 ;    block transfers larger than XTCF_DMA_MODE_MAX_BLOCK_SIZE.
    117 ; 2. A call is subsequently made to change device mode to DEVICE_8BIT_XTCF_DMA.
    118 ; 3. The call to AH24h_SetBlockSize fails but the change in device mode has been made.
    119 
    120114    ; Set DMA Mode
    121115    mov     BYTE [di+DPT_ATA.bDevice], DEVICE_8BIT_XTCF_DMA
    122116    mov     al, [di+DPT_ATA.bBlockSize]
    123     MIN_U   al, XTCF_DMA_MODE_MAX_BLOCK_SIZE
    124     jmp     SHORT AH24h_SetBlockSize    ; Returns via AH23h_Enable8bitPioMode
     117    cmp     al, XTCF_DMA_MODE_MAX_BLOCK_SIZE
     118    jbe     SHORT AH24h_SetBlockSize
     119    mov     al, XTCF_DMA_MODE_MAX_BLOCK_SIZE
     120    jmp     SHORT AH24h_SetBlockSize
    125121
    126122.SetMemoryMappedMode:
Note: See TracChangeset for help on using the changeset viewer.