Ignore:
Timestamp:
Aug 23, 2010, 6:57:51 PM (14 years ago)
Author:
aitotat
google:author:
aitotat
Message:

OS hooks are now enabled for all builds.
IRQ waiting no longer uses HLT instruction to fix some EMM386 and VCPI issues.

File:
1 edited

Legend:

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

    r33 r34  
    1010
    1111;--------------------------------------------------------------------
    12 ; Wait for IRQ.
    13 ;
    14 ; HIRQ_WaitIRQ
     12; HIRQ_WaitForIRQ
    1513;   Parameters:
    1614;       DS:     RAMVARS segment
    17 ;   Returns:
    18 ;       AH:     BIOS Error code
    19 ;       CF:     Cleared if wait succesfull
    20 ;               Set if any error
    21 ;   Corrupts registers:
    22 ;       AL
    23 ;--------------------------------------------------------------------
    24 ALIGN JUMP_ALIGN
    25 HIRQ_WaitIRQ:
    26     push    es
    27 
    28     LOAD_BDA_SEGMENT_TO es, ax
    29 %ifdef USE_AT   ; OS hook only available on AT+ machines
    30     call    .NotifyOperatingSystemAboutWaitingForIRQ
    31     cmc
    32     jnc     SHORT .TaskFlagPollingComplete
    33 %endif
    34     call    .WaitUntilTaskFlagIsSet     ; Process errors
    35 
    36 ALIGN JUMP_ALIGN
    37 .TaskFlagPollingComplete:
    38     pop     es
    39     jmp     HError_ProcessErrorsAfterPollingTaskFlag
    40 
    41 
    42 ;--------------------------------------------------------------------
    43 ; .NotifyOperatingSystemAboutWaitingForIRQ
    44 ;   Parameters:
    45 ;       ES:     BDA segment (zero)
    4615;   Returns:
    4716;       CF:     Set if wait done by operating system
     
    5019;       AX
    5120;--------------------------------------------------------------------
    52 %ifdef USE_AT
     21ALIGN JUMP_ALIGN
     22HIRQ_WaitForIRQ:
     23    test    BYTE [bx+DPT.bDrvCtrl], FLG_IDE_CTRL_nIEN   ; Clears CF
     24    jz      SHORT .NotifyOperatingSystemAboutWaitingForIRQ
     25    ret     ; Go to poll status register
     26
     27;--------------------------------------------------------------------
     28; .NotifyOperatingSystemAboutWaitingForIRQ
     29;   Parameters:
     30;       Nothing
     31;   Returns:
     32;       CF:     Set if wait done by operating system
     33;               Cleared if BIOS must perform task flag polling
     34;   Corrupts registers:
     35;       AX
     36;--------------------------------------------------------------------
    5337ALIGN JUMP_ALIGN
    5438.NotifyOperatingSystemAboutWaitingForIRQ:
     39    push    ds
     40
     41    LOAD_BDA_SEGMENT_TO ds, ax          ; Zero AX
    5542    cli                                 ; Disable interrupts
    56     xor     ax, ax
    57     cmp     al, [es:BDA.bHDTaskFlg]     ; Task flag already set?
     43    cmp     al, [ds:BDA.bHDTaskFlg]     ; Task flag already set?
    5844    jc      SHORT .ReturnFromWaitNotify ;  If so, skip OS notification
    5945
     
    6753    stc                                 ; Set CF since wait done by OS
    6854.ReturnFromWaitNotify:
     55    pop     ds
    6956    sti                                 ; Enable interrupts
    70     ret
    71 %endif
    72 
    73 ;--------------------------------------------------------------------
    74 ; Polls IRQ Task Flag until it has been set or timeout.
    75 ;
    76 ; .WaitUntilTaskFlagIsSet
    77 ;   Parameters:
    78 ;       DS:     RAMVARS segment
    79 ;       ES:     BDA segment
    80 ;   Returns:
    81 ;       CF:     Set if timeout
    82 ;               Cleared if Task Flag set
    83 ;   Corrupts registers:
    84 ;       AX
    85 ;--------------------------------------------------------------------
    86 ALIGN JUMP_ALIGN
    87 .WaitUntilTaskFlagIsSet:
    88     push    cx
    89 
    90     mov     cl, B_TIMEOUT_DRQ       ; Load timeout ticks
    91     call    SoftDelay_InitTimeout   ; Initialize timeout counter
    92     xor     ax, ax                  ; Zero AX
    93 ALIGN JUMP_ALIGN
    94 .PollIrqFlag:
    95     cli                             ; Disable interrupt until next HLT
    96     cmp     [es:BDA.bHDTaskFlg], al ; Task flag set? (clears CF)
    97     jne     SHORT .Return
    98     call    SoftDelay_UpdTimeout    ; Update timeout
    99     jc      SHORT .Return           ; Return if timeout
    100     sti                             ; Enable interrupts (STI has delay so HLT will catch all interrupts)
    101     hlt                             ; Sleep until any interrupt
    102     jmp     SHORT .PollIrqFlag      ; Jump to check if IDE interrupt
    103 ALIGN JUMP_ALIGN
    104 .Return:
    105     pop     cx
    106     sti
    10757    ret
    10858
     
    158108    out     WPORT_8259MA_COMMAND, al    ; Acknowledge Master 8259
    159109
    160 %ifdef USE_AT   ; OS hook only available on AT+ machines
    161110    ; Issue Int 15h, function AX=9100h (Interrupt ready)
    162111    mov     ax, 9100h                   ; Interrupt ready, device 0 (HD)
    163112    int     INTV_SYSTEM_SERVICES
    164 %endif
    165113
    166114    pop     ax                          ; Restore AX
     
    187135
    188136    ; Reading Status Register acknowledges IDE interrupt
    189     ;call   RamVars_GetSegmentToDS
    190     ;call   HError_GetStatusAndErrorRegistersToAXandStoreThemToBDA
    191     LOAD_BDA_SEGMENT_TO ds, ax
     137    call    RamVars_GetSegmentToDS
     138    call    HError_GetStatusAndErrorRegistersToAXandStoreThemToBDA
    192139    mov     BYTE [BDA.bHDTaskFlg], 0FFh     ; Set task flag
    193140
Note: See TracChangeset for help on using the changeset viewer.