background image

Vol. 3A 9-19

PROCESSOR MANAGEMENT AND INITIALIZATION

 100  

 101  ; offset of GDT and IDT descriptors in builder generated GDT

 102  GDT_DESC_OFF    EQU 1*SIZE(DESC)

 103  IDT_DESC_OFF    EQU 2*SIZE(DESC)

 104  

 105  ; equates for building temporary GDT in RAM

 106  LINEAR_SEL          EQU     1*SIZE (DESC)

 107  LINEAR_PROTO_LO     EQU     00000FFFFH  ; LINEAR_ALIAS

 108  LINEAR_PROTO_HI     EQU     000CF9200H

 109  

 110  ; Protection Enable Bit in CR0

 111  PE_BIT  EQU 1B

 112  

 113  ; ------------------------------------------------------------

 114  

 115  ; ------------------------- DATA SEGMENT----------------------

 116  

 117  ; Initially, this  data segment starts at linear 0, according

 118  ; to the processor’s power-up state.

 119  

 120  STARTUP_DATA    SEGMENT RW

 121  

 122  free_mem_linear_base    LABEL   DWORD

 123  TEMP_GDT                LABEL   BYTE  ; must be first in segment

 124  TEMP_GDT_NULL_DESC   DESC    <>

 125  TEMP_GDT_LINEAR_DESC DESC    <>

 126  

 127  ; scratch areas for LGDT and LIDT instructions

 128  TEMP_GDT_SCRATCH TABLE_REG   <>

 129  APP_GDT_RAM     TABLE_REG    <>

 130  APP_IDT_RAM     TABLE_REG    <>

 131          ; align end_data

 132  fill    DW      ?

 133   

 134  ; last thing in this segment - should be on a dword boundary

 135  end_data    LABEL   BYTE

 136  

 137  STARTUP_DATA    ENDS

 138  ; ------------------------------------------------------------

 139  

 140  

 141  ; ------------------------- CODE SEGMENT----------------------

 142  STARTUP_CODE SEGMENT ER PUBLIC USE16

 143  

 144  ; filled in by builder

 145      PUBLIC  GDT_EPROM

 146  GDT_EPROM   TABLE_REG   <>

 147  

 148  ; filled in by builder

 149      PUBLIC  IDT_EPROM

 150  IDT_EPROM   TABLE_REG   <>

 151  

 152  ; entry point into startup code - the bootstrap will vector

 153  ; here  with a  near JMP  generated by  the builder.   This