Vous êtes sur la page 1sur 2

;*******************************************************************************

; tables for use in protected mode, including the gdt, idt, and relevant tss's *
;*******************************************************************************

;for use with v86.asm, etc.

;a gdt entry has the following form:


; dw ? ;segment limit
; db ?,?,? ;24 bits of absolute address
; db ? ;access rights
; db ? ;extended access rights
; db ? ;high 8 bits of 32 bit absolute
address

gdt dq 0 ;first gdt entry must be 0

dw 0ffffh ;bios data selector (at 0:0)


db 0,0,0
db typ_read_write or dtype_memory or dpl_0 or present
db granular_4k ;you can get at any @ in low
memory with this
db 0

dw tss_size ;tss for task 1 (startup)


dw offset tss_1
db 11h
db typ_task or dpl_0 or present
db 0,0

dw 0ffffh ;task 1 code segment selector


db 0,0,11h ;starts at 110000h
db typ_exec_read or dtype_memory or dpl_0 or present
db type_32,0

dw 0ffffh ;task 1 data selector


db 0,0,11h ;at 110000h
db typ_read_write or dtype_memory or dpl_0 or present
db type_32,0

dw tss_size+iomap_size ;tss for task 2


dw offset tss_2
db 11h
tss_typefl: db typ_task or dpl_3 or present
dw 0

dw 00fffh ;video ram selector


dw (video_seg shl 4) and 0ffffh
db video_seg shr 12
db typ_read_write or dtype_memory or dpl_0 or present
db 0,0

;end of gdt

;this is the task state segment for the virtual machine


tss_2 dw 0 ;back link
dw 0 ;filler
dd task2_stack0+stack_size ;esp0
dw data_1_sel ;ss0
dw 0 ;filler
dd 0 ;esp1
dw data_1_sel ;ss1
dw 0 ;filler
dd 0 ;esp2
dw data_1_sel ;ss2
dw 0 ;filler
dd 0 ;cr3
dd 7c00h ;eip
dd 23000h ;eflags (set vm flag, iopl=3)
dd 0 ;eax
dd 0 ;ecx
dd 0 ;edx
dd 0 ;ebx
dd stack_size ;esp
dd 0 ;ebp
dd 0 ;esi
dd 0 ;edi
dw 0 ;es
dw 0 ;filler
dw 0 ;cs
dw 0 ;filler
dw 0 ;ss
dw 0 ;filler
dw 0 ;ds
dw 0 ;filler
dw 0 ;fs
dw 0 ;filler
dw 0 ;gs
dw 0 ;filler
dw 0 ;ldt
dw 0 ;filler
dw 0 ;exception on task switch bit
dw offset tss2io - offset tss_2 ;iomap offfset pointer

tss2io db 3eh dup (0)


db 080h ;trap io to port 1f7h (hard disk
command register)
db iomap_size-40h dup (0)
db 0ffh ;dummy byte for end of io map

Vous aimerez peut-être aussi