📄 crt0.s
字号:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; ;
; Copyright (c) 1995 Microtec Reseach Inc. ;
; ;
; All rights reserved. Microtec's source code is an unpublished ;
; work and the use of a copyright notice does not imply otherwise. ;
; This source code contains confidential, trade secret material of' ;
; Microtec. Any attempt or participation in deciphering, ;
; decoding, reverse engineering or in any way altering the source ;
; code is strictly prohibited, unless the prior written consent of ;
; Microtec is obtained. ;
; ;
; ;
; Module Name: crt0.s ;
; ;
; Identification: Versio 3.1 crt0.s for VRTXSAx86 ;
; ;
; Date: 6/15/95 ;
; ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; ;
; This module provides system start up when VRTX will run on top ;
; of the XDM Monitor in Protected Mode or will go into Protected ;
; if started in Real Mode. ;
; ;
; When started in Protect Mode it assumes: ;
; Code: Selector 18 FLAT ;
; Data: Selector 20 FLAT ;
; ;
; crt0 does the following if started in Protected Mode: ;
; 1. Set the VRTX boot_sys_* pointers. ;
; 2. Pass control to boot_warm_start. ;
; ;
; crt0 does the following if started in Real Mode: ;
; 1. Build a new GDT based on the information given by XCONFIG ;
; 2. Point the internal IDT pointer at XDM's IDT ;
; 2. Set the VRTX boot_sys_* pointers. ;
; 3. Pass control to boot_warm_start. ;
; ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
NAME crt0
$include(asm386de.inc)
IDT_BASE equ
IDT_SIZE equ ( * 8)
GDT_BASE equ (IDT_BASE + IDT_SIZE)
GDT_SIZE equ (FLAT_DATA_DES + 8)
;public PROM_start ; Begining of PROM
;public PROM_end ; End of Code to be copied
;public RAM_offset ; Offset in RAM to Copy
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; ;
; CRT0 Cold Start ;
; ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
assume ds: nothing, es: nothing
_START SEGMENT ER use16 public
public crt0_cold_start
crt0_cold_start:
cli
cld
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;; Clear New Tables ;;;;;;;;
;;;;; for GDT and IDT ;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; SWITCH MODE to protected mode
mov eax, cr0
or eax, 1 ; Set PE bit
mov cr0, eax
jmp flush ; Clear prefetch queue
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Intialize Segment Registers ;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
flush:
mov ax, FLAT_DATA_DES
mov ds, ax
mov es, ax
mov ss, ax
mov fs, ax
mov gs, ax
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;; Start up VRTX Config ;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
xor ebx, ebx ; 0 - started without XDM
db 0EAh ; Jmp Dword Pointer Absoulte
dd crt0_warm_start
dw FLAT_CODE_DES
;Unreal_Mode:
; nop
_START ends
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; ;
; CRT0 Warm Start Routine ;
; ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
CODE_cseg SEGMENT er use32 public
assume ds:DATA_dseg
extrn boot_startup: NEAR
public crt0_warm_start
;public panic
;public crt0_data_base
crt0_warm_start LABEL FAR
;panic:
mov started_from_xdm, ebx
mov boot_idt_size, IDT_SIZE
mov esp, offset base_stack_top
jmp boot_startup ; does not return
;crt0_data_base:
; dd 0 ; base address used by the FLAT selector
;PROM_end:
;RAM_offset:
;PROM_start:
; nop
CODE_cseg ends
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; ;
; Local Data Segment ;
; ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
DATA_dseg SEGMENT RW use32 public
assume ds:DATA_dseg
public started_from_xdm
started_from_xdm dd ?
;public base_stack
;public base_stack_top
base_stack db 1024 DUP (?) ; Temporary Stack
base_stack_top:
public boot_idt_size
boot_idt_size dw ?
DATA_dseg ends
END
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -