⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 nruntime.asm

📁 本源码为BIOS研发技术剖析光盘原代码,是SIS530BIOS完整原代码.
💻 ASM
📖 第 1 页 / 共 5 页
字号:
        push    ax
        mov     al,ds:[12h]             ; 8042 input port byte
        test    al,00100000b            ; diag switch on ? pin-32 of 8042
        pop     ax
        jz      timer_tick              ; yes
        jmp     proc_shutdown           ; shutdown proc
timer_tick:
;------ DO any special LED blinking ----;
        push    ax
        mov     al,20h                  ; end of interrupt
        out     20h,al
        pop     ax
        iret
;-----------------------------------------------------------------------;
;               TIMER_INTERRUPT_INT8            ; Moved to OEMRUN.ASM
;-----------------------------------------------------------------------;
;                       KB_INTERRUPT_INT9                               ;
;-----------------------------------------------------------------------;
; This routine will get control in every keyboard interrupt, any special;
; action can be done here. this is called from INT-9 ISR                ;
; input :                                                               ;
;       DS      40H                                                     ;
;       other registers already saved using PUSHA, ES is not saved.     ;
; register usage : can destroy any register except DS, ES               ;
;-----------------------------------------------------------------------;
        public  kb_interrupt_int9
        extrn   kb_interrupt_int9_end:near
kb_interrupt_int9:
        jmp     kb_interrupt_int9_end
;-----------------------------------------------------------------------;
;                       POWER_ON_INIT           ; Moved to RUNTIME.ASM
;-----------------------------------------------------------------------;
;                               HRESET_CLEAR                            ;
;-----------------------------------------------------------------------;
; If any initialization (e.g. detection CPU ID, etc.) is required in    ;
; power on/hard reset path.                                             ;
; input :                                                               ;
;       SS = CS                                                         ;
;       DX      CPU ID information                                      ;
;       all other registers are undefined including DS,ES,SP,EBP        ;
;       stack   not available                                           ;
; register usage : can destroy any register execept SS                  ;
;-----------------------------------------------------------------------;
        public  hreset_clear
        extrn   hreset_clear_end:near
hreset_clear:
        jmp     hreset_clear_end
;-----------------------------------------------------------------------;
;                               SRESET_CLEAR                            ;
;-----------------------------------------------------------------------;
; If any initialization is required in <ctrl><alt><del> soft reset or   ;
; shutdown path.                                                        ;
; input :                                                               ;
;       SS = CS                                                         ;
;       all other registers are undefined including DS,ES,SP,EBP        ;
;       stack   not available                                           ;
; register usage : can destroy any register execept SS                  ;
;-----------------------------------------------------------------------;
        public  sreset_clear            ; soft reset init, if any
        extrn   sreset_clear_end:near
sreset_clear:
        smsw    ax
        test    al,01h                  ; virtual mode ?
        jz      sreset_clear_00         ; no..skip generating CPU reset
        mov     ax,008fh                ; cmos reg 0Fh, shutdown code 00
        ret_sp  cmos_data_out_x
        ret_sp  enable_8042_bit_20      ; enable GateA20
        jmp     shutdown_cpu
sreset_clear_00:
        jmp     sreset_clear_end
;-----------------------------------------------------------------------;
;                               SHUTDOWN_7                              ;
;-----------------------------------------------------------------------;
; This routine is used to come back to real mode from virtual mode.     ;
; This shutdown code is not used by BIOS and can be used by porting if  ;
; necessary.                                                            ;
; input :                                                               ;
;       DS      0040h                                                   ;
;       ES      0000h                                                   ;
;       all registers are undefined                                     ;
;       stack   available                                               ;
;-----------------------------------------------------------------------;
        public  shutdown_7              ; can be used during memory config
        extrn   shutdown_77:near
shutdown_7:
        jmp     shutdown_77             ; USED IN MEMORY DETECTION
;-----------------------------------------------------------------------;
;                               SHUTDOWN_8                              ;
;-----------------------------------------------------------------------;
; This routine is used to come back to real mode from virtual mode.     ;
; This shutdown code is not used by BIOS and can be used by porting if  ;
; necessary.                                                            ;
; input :                                                               ;
;       DS      0040h                                                   ;
;       ES      0000h                                                   ;
;       all registers are undefined                                     ;
;       stack   available                                               ;
;-----------------------------------------------------------------------;
        public  shutdown_8              ; can be used during memory config
        extrn   shutdown_88:near
shutdown_8:                             ; user defined
        jmp     shutdown_88
;-----------------------------------------------------------------------;
;                               SHUTDOWN_INIT                           ;
;-----------------------------------------------------------------------;
; This routine is required if some special work involved during shutdown;
; processing before passing control to proper shutdown routine,         ;
; example:- CR0, 287/387 bit set/reset, 287/387 emulation bit.          ;
; input :                                                               ;
;       SS = CS                                                         ;
;       SI = shutdown code, (00..0A)                                    ;
;       stack   not available                                           ;
; output:                                                               ;
;       none                                                            ;
; register usage : can destroy any register except SI                   ;
;-----------------------------------------------------------------------;
        public  shutdown_init           ; any init during shutdown
        extrn   shutdown_init_end:near
        extrn   go_to_flat_mode_stack:near
        extrn   comeback_from_flat_mode_stack:near
        extrn   InitLocalApic:near
shutdown_init:
        mov     ax,si
        cmp     al,5
        jz      si_02                   ; for shutdown 5,9,A
        cmp     al,9
        jz      si_02
        cmp     al,0ah
        jnz     si_00
si_02:
        mov     ax,30h
        mov     ss,ax                   ; set SS and SP
        mov     sp,100h
if (MKF_NCPU eq 2)
        push    si
        call    go_to_flat_mode_stack
        call    InitLocalApic
        call    comeback_from_flat_mode_stack
        pop     si
endif
        call    enable_l1_cache         ; enable internal cache
si_00:
        jmp     shutdown_init_end
;-----------------------------------------------------------------------;
;                               SHUTDOWN_CPU                            ;
;-----------------------------------------------------------------------;
; this is called from INT-15 ISR                                        ;
; this routine gets control if CPU type is 80286 which needs reset to go;
; to real mode. if you have fast CPU reset option through chipset reg.  ;
; or any other mechanism, use that option else use standard shutdown    ;
; (8042 command FE)                                                     ;
;  input :                                                              ;
;       none                                                            ;
;       stack   available                                               ;
;  register usage : can destroy any register                            ;
;-----------------------------------------------------------------------;
        public  shutdown_cpu            ; shutdown processor
        public  shutdown_8042
shutdown_cpu:
        cli
;-- here write the code for fast reset--;
shutdown_8042:
        cli
;  control may come here from SRESET_CLEAR where SS/SP is not set..
;  so on-line coding is used..
        mov     al,0feh                 ; shutdown command to 8042
        out     64h,al                  ; issue command
        hlt                             ; goto system halt
        jmp     short $-1               ; ensure halt
;-----------------------------------------------------------------------;
;                               ENABLE_ADDR_BIT_20                      ;
;-----------------------------------------------------------------------;
;  this is called from INT-15 ISR.                                      ;
;  input :                                                              ;
;       none                                                            ;
;       stack   available                                               ;
; register usage : DO NOT destroy any register except AX, CX            ;
;-----------------------------------------------------------------------;
        public  enable_addr_bit_20      ; fast GA20 enable
        extrn   enable_8042_bit_20:near
        extrn   enable_fast_ga20:near
enable_addr_bit_20:
        mov     ax,offset cgroup:enable_fast_ga20
        mov     cx,offset cgroup:enable_8042_bit_20
eab20_00:
        test    cgroup:misc_info,fast_gate_a20_bit
        jz      eab20_01                ; fast GA20 not allowed
        push    cx
        call    ax                      ; use Fast Gate20 method
        pop     cx
        jz      eab20_02                ; done
eab20_01:
        call    cx                      ; use 8042 method
eab20_02:
        ret                             ; NZ/ZR = 0/1, error/no error
;-----------------------------------------------------------------------;
;                               DISABLE_ADDR_BIT_20                     ;
;-----------------------------------------------------------------------;
;  this is called from INT-15 ISR.                                      ;
;  input :                                                              ;
;       none                                                            ;
;       stack   available                                               ;
; register usage : DO NOT destroy any register except AX, CX            ;
;-----------------------------------------------------------------------;
        public  disable_addr_bit_20     ; fast GA20 disable
        extrn   disable_8042_bit_20:near
        extrn   disable_fast_ga20:near
disable_addr_bit_20:
        mov     ax,offset cgroup:disable_fast_ga20
        mov     cx,offset cgroup:disable_8042_bit_20
        jmp     short eab20_00
;-----------------------------------------------------------------------;
;                               INT-15.ASM MODULE                       ;
; this routine is called from INT-15 ISR to support any special int-15  ;
; function if any. if you do not have any special func, simply return   ;
; control to INT-15 ISR by RET. otherwise balance stack and return      ;
; control to caller of INT-15 by IRET or RET 2.                         ;
; here is how INT-15 code will look like.                               ;
;int_15 proc    far                                                     ;
;       cmp     ah,87h                                                  ;
;       jz      int_15_87                                               ;
;       call    special_int_15                                          ;
;       ...                                                             ;
;int_15_87:                                                             ;
;       ...                                                             ;
;int_15 endp                                                            ;
;=======================================================================;
; EXAMPLE:  INT15 function to GATE-A20 support.                         ;
;           input :     (ah)    24h                                     ;
;                       (al)    03h                                     ;
;           output:     (ah)    return code                             ;
;                               00h  successful                         ;
;                               86h  function not supported             ;
;                       (NC)    successful                              ;
;                       (CY)    unsuccessful                            ;
;                       if successful                                   ;
;                       (bx)    bit 0..0 = GateA20 not supported on 8042;
;                                      1 = GateA20 supported on 8042    ;
;                               bit 1..0 = GateA20 not supported with   ;
;                                          bit-1 of I/O port 92H        ;
;                                      1 = GateA20 supported with bit-1 ;
;                                          of I/O port 92H              ;
; Let us assume the chipset concerned has the support for GateA20 thru' ;
; bit-1 of I/O port 92H. In this case SPECIAL_INT_15 shoule be like as  ;
; follows:                                                              ;
;                                                                       ;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -