forked from KolibriOS/kolibrios
Update BOOT_DATA structure and use it instead of all the BOOT_* vars.
git-svn-id: svn://kolibrios.org@7132 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
b00728a5d1
commit
368d42ffae
@ -282,18 +282,18 @@ else
|
||||
jnz @f
|
||||
mov word [cs:cfgmanager.loader_block], si
|
||||
mov word [cs:cfgmanager.loader_block+2], ds
|
||||
mov word [es:BOOT_KERNEL_RESTART], kernel_restart_bootblock
|
||||
mov word [es:BOOT_LO.kernel_restart], kernel_restart_bootblock
|
||||
@@:
|
||||
; \end{diamond}[02.12.2005]
|
||||
|
||||
; if bootloader sets cx = 'HA' and dx = 'RD', then bx contains identifier of source disk
|
||||
; (see comment to BOOT_BX_FROM_LOAD and loader_doc.txt)
|
||||
mov word [es:BOOT_BX_FROM_LOAD], 'r1' ; default value: /rd/1
|
||||
; (see comment to BOOT_LO.bx_from_load and loader_doc.txt)
|
||||
mov word [es:BOOT_LO.bx_from_load], 'r1' ; default value: /rd/1
|
||||
cmp cx, 'HA'
|
||||
jnz no_hd_load
|
||||
cmp dx, 'RD'
|
||||
jnz no_hd_load
|
||||
mov [es:BOOT_BX_FROM_LOAD], bx
|
||||
mov [es:BOOT_LO.bx_from_load], bx
|
||||
no_hd_load:
|
||||
|
||||
; set up stack
|
||||
@ -441,15 +441,15 @@ sayerr:
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
sti
|
||||
; --------------- APM ---------------------
|
||||
and word [es:BOOT_APM_VERSION], 0 ; ver = 0.0 (APM not found)
|
||||
and word [es:BOOT_LO.apm_version], 0 ; ver = 0.0 (APM not found)
|
||||
mov ax, 0x5300
|
||||
xor bx, bx
|
||||
int 0x15
|
||||
jc apm_end ; APM not found
|
||||
test cx, 2
|
||||
jz apm_end ; APM 32-bit protected-mode interface not supported
|
||||
mov [es:BOOT_APM_VERSION], ax ; Save APM Version
|
||||
mov [es:BOOT_APM_FLAGS], cx ; Save APM flags
|
||||
mov [es:BOOT_LO.apm_version], ax ; Save APM Version
|
||||
mov [es:BOOT_LO.apm_flags], cx ; Save APM flags
|
||||
|
||||
; Write APM ver ----
|
||||
and ax, 0xf0f
|
||||
@ -468,10 +468,10 @@ sayerr:
|
||||
xor bx, bx
|
||||
int 0x15
|
||||
|
||||
mov [es:BOOT_APM_ENTRY], ebx
|
||||
mov [es:BOOT_APM_CODE_32], ax
|
||||
mov [es:BOOT_APM_CODE_16], cx
|
||||
mov [es:BOOT_APM_DATA_16], dx
|
||||
mov [es:BOOT_LO.apm_entry], ebx
|
||||
mov [es:BOOT_LO.apm_code_32], ax
|
||||
mov [es:BOOT_LO.apm_code_16], cx
|
||||
mov [es:BOOT_LO.apm_data_16], dx
|
||||
|
||||
apm_end:
|
||||
_setcursor d80x25_top_num, 0
|
||||
@ -951,33 +951,33 @@ end if
|
||||
|
||||
; GRAPHICS ACCELERATION
|
||||
; force yes
|
||||
mov [es:BOOT_MTRR], byte 1
|
||||
mov [es:BOOT_LO.mtrr], byte 1
|
||||
|
||||
; DMA ACCESS TO HD
|
||||
|
||||
mov al, [preboot_dma]
|
||||
mov [es:BOOT_DMA], al
|
||||
mov [es:BOOT_LO.dma], al
|
||||
|
||||
; Set kernel DEBUG mode - if nonzero, duplicates debug output to the screen.
|
||||
mov al, [preboot_debug]
|
||||
mov [es:BOOT_DEBUG_PRINT], al ;// 0x901E
|
||||
mov [es:BOOT_LO.debug_print], al ;// 0x901E
|
||||
|
||||
; Start the first app (right now it's LAUNCHER) after kernel is loaded?
|
||||
mov al, [preboot_launcher]
|
||||
mov [es:BOOT_LAUNCHER_START], al ;// 0x901D
|
||||
mov [es:BOOT_LO.launcher_start], al ;// 0x901D
|
||||
|
||||
; BOOT DEVICE
|
||||
|
||||
mov al, [preboot_device]
|
||||
dec al
|
||||
mov [es:BOOT_DEV], al
|
||||
mov [es:BOOT_LO.dev], al
|
||||
|
||||
; GET MEMORY MAP
|
||||
include '../detect/biosmem.inc'
|
||||
|
||||
; READ DISKETTE TO MEMORY
|
||||
|
||||
cmp byte [es:BOOT_DEV], 0
|
||||
cmp byte [es:BOOT_LO.dev], 0
|
||||
jne no_sys_on_floppy
|
||||
mov si, diskload
|
||||
call print
|
||||
@ -1304,7 +1304,7 @@ no_sys_on_floppy:
|
||||
out dx, al
|
||||
|
||||
if defined extended_primary_loader
|
||||
cmp [es:BOOT_DEV], 1
|
||||
cmp [es:BOOT_LO.dev], 1
|
||||
jne no_sys_from_primary
|
||||
; load kolibri.img using callback from primary loader
|
||||
and word [movedesc + 24 + 2], 0
|
||||
@ -1343,7 +1343,7 @@ end if
|
||||
xor ax, ax
|
||||
mov es, ax
|
||||
|
||||
mov ax, [es:BOOT_VESA_MODE] ; vga & 320x200
|
||||
mov ax, [es:BOOT_LO.vesa_mode] ; vga & 320x200
|
||||
mov bx, ax
|
||||
cmp ax, 0x13
|
||||
je setgr
|
||||
|
@ -731,9 +731,9 @@ set_vmode:
|
||||
mov bx, word [es:si+2] ; resolution Y
|
||||
|
||||
|
||||
mov word [es:BOOT_X_RES], ax ; resolution X
|
||||
mov word [es:BOOT_Y_RES], bx ; resolution Y
|
||||
mov word [es:BOOT_VESA_MODE], cx ; number of mode
|
||||
mov word [es:BOOT_LO.x_res], ax ; resolution X
|
||||
mov word [es:BOOT_LO.y_res], bx ; resolution Y
|
||||
mov word [es:BOOT_LO.vesa_mode], cx ; number of mode
|
||||
|
||||
cmp cx, 0x12
|
||||
je .mode0x12_0x13
|
||||
@ -752,11 +752,11 @@ set_vmode:
|
||||
int 0x10
|
||||
; LFB
|
||||
mov eax, [es:mi.PhysBasePtr];di+0x28]
|
||||
mov [es:BOOT_LFB], eax
|
||||
mov [es:BOOT_LO.lfb], eax
|
||||
; ---- vbe voodoo
|
||||
BytesPerLine equ 0x10
|
||||
mov ax, [es:di+BytesPerLine]
|
||||
mov [es:BOOT_PITCH], ax
|
||||
mov [es:BOOT_LO.pitch], ax
|
||||
; BPP
|
||||
cmp [es:mi.BitsPerPixel], 16
|
||||
jne .l0
|
||||
@ -765,12 +765,12 @@ set_vmode:
|
||||
mov [es:mi.BitsPerPixel], 15
|
||||
.l0:
|
||||
mov al, byte [es:di+0x19]
|
||||
mov [es:BOOT_BPP], al
|
||||
mov [es:BOOT_LO.bpp], al
|
||||
jmp .exit
|
||||
|
||||
.mode0x12_0x13:
|
||||
mov byte [es:BOOT_BPP], 32
|
||||
or dword [es:BOOT_LFB], 0xFFFFFFFF; 0x800000
|
||||
mov byte [es:BOOT_LO.bpp], 32
|
||||
or dword [es:BOOT_LO.lfb], 0xFFFFFFFF; 0x800000
|
||||
|
||||
|
||||
; VESA 1.2 PM BANK SWITCH ADDRESS
|
||||
@ -789,7 +789,7 @@ set_vmode:
|
||||
; add eax, ebx
|
||||
; push 0x0000
|
||||
; pop es
|
||||
; mov [es:BOOT_BANK_SW], eax
|
||||
; mov [es:BOOT_LO.bank_sw], eax
|
||||
.exit:
|
||||
ret
|
||||
|
||||
|
@ -11,7 +11,7 @@ $Revision$
|
||||
read_ramdisk:
|
||||
; READ RAMDISK IMAGE FROM HD (only for IDE0, IDE1, IDE2, IDE3)
|
||||
|
||||
cmp byte [BOOT_DEV+OS_BASE+0x10000], 1
|
||||
cmp byte [BOOT.dev+0x10000], 1
|
||||
jne no_sys_on_hd.1
|
||||
|
||||
xor ebp, ebp
|
||||
@ -112,7 +112,7 @@ no_sys_on_hd:
|
||||
DEBUGF 1, "K : RD not found\n"
|
||||
.1:
|
||||
; test_to_format_ram_disk (need if not using ram disk)
|
||||
cmp byte [BOOT_DEV+OS_BASE+0x10000], 3
|
||||
cmp byte [BOOT.dev+0x10000], 3
|
||||
jne not_format_ram_disk
|
||||
; format_ram_disk
|
||||
mov edi, RAMDISK
|
||||
|
@ -16,9 +16,9 @@ $Revision$
|
||||
align 4
|
||||
system_shutdown: ; shut down the system
|
||||
|
||||
cmp byte [BOOT_VARS+BOOT_SHUTDOWN_TYPE], SYSTEM_SHUTDOWN
|
||||
cmp byte [BOOT.shutdown_type], SYSTEM_SHUTDOWN
|
||||
jb @F
|
||||
cmp byte [BOOT_VARS+BOOT_SHUTDOWN_TYPE], SYSTEM_RESTART
|
||||
cmp byte [BOOT.shutdown_type], SYSTEM_RESTART
|
||||
jbe .valid
|
||||
@@:
|
||||
ret
|
||||
@ -62,7 +62,7 @@ yes_shutdown_param:
|
||||
cli
|
||||
call IRQ_mask_all
|
||||
|
||||
mov eax, [OS_BASE + BOOT_SHUTDOWN_TYPE]
|
||||
mov eax, dword[BOOT.shutdown_type]
|
||||
cmp al, SYSTEM_RESTART
|
||||
jne @F
|
||||
|
||||
@ -91,7 +91,7 @@ org $-OS_BASE
|
||||
mov eax, cr3
|
||||
mov cr3, eax
|
||||
|
||||
cmp byte [BOOT_SHUTDOWN_TYPE], SYSTEM_SHUTDOWN
|
||||
cmp byte [BOOT_LO.shutdown_type], SYSTEM_SHUTDOWN
|
||||
jne no_acpi_power_off
|
||||
|
||||
; system_power_off
|
||||
@ -179,7 +179,7 @@ align 4
|
||||
restart_code_start:
|
||||
org 0x50000
|
||||
|
||||
cmp byte [BOOT_SHUTDOWN_TYPE], SYSTEM_RESTART
|
||||
cmp byte [BOOT_LO.shutdown_type], SYSTEM_RESTART
|
||||
jne @F
|
||||
|
||||
mov esi, _CLEAN_ZONE-OS_BASE
|
||||
@ -277,7 +277,7 @@ align 4
|
||||
|
||||
xor ax, ax
|
||||
mov ds, ax
|
||||
mov al, [BOOT_SHUTDOWN_TYPE]
|
||||
mov al, [BOOT_LO.shutdown_type]
|
||||
cmp al, SYSTEM_RESTART
|
||||
je .restart
|
||||
|
||||
@ -350,7 +350,7 @@ align 4
|
||||
pop ds
|
||||
push 0
|
||||
pop es
|
||||
mov si, [es:BOOT_KERNEL_RESTART]
|
||||
mov si, [es:BOOT_LO.kernel_restart]
|
||||
mov ax, 'KL'
|
||||
jmp 0x1000:0000
|
||||
|
||||
|
@ -70,7 +70,7 @@ main:
|
||||
cmp [rdi + 8], rdx
|
||||
jnz .not_acpi20
|
||||
mov rax, [rdi + 16]
|
||||
mov rdx, BOOT_ACPI_RSDP
|
||||
mov rdx, BOOT_LO.acpi_rsdp
|
||||
mov [rdx], eax
|
||||
;jmp $
|
||||
jmp .all_tables_done
|
||||
@ -157,27 +157,27 @@ main:
|
||||
mov rcx, [gop_info]
|
||||
mov eax, [rcx + EFI_GRAPHICS_OUTPUT_MODE_INFORMATION.HorizontalResolution]
|
||||
xor rdx, rdx
|
||||
mov word [rdx + BOOT_X_RES], ax
|
||||
mov word [rdx + BOOT_LO.x_res], ax
|
||||
mov eax, [rcx + EFI_GRAPHICS_OUTPUT_MODE_INFORMATION.VerticalResolution]
|
||||
mov word [rdx + BOOT_Y_RES], ax
|
||||
mov word [rdx + BOOT_LO.y_res], ax
|
||||
mov eax, [rcx + EFI_GRAPHICS_OUTPUT_MODE_INFORMATION.PixelsPerScanLine]
|
||||
shl eax, 2
|
||||
mov word [rdx + BOOT_PITCH], ax
|
||||
mov word [rdx + BOOT_LO.pitch], ax
|
||||
|
||||
mov byte [rdx + BOOT_PCI_DATA + 0], 1
|
||||
mov byte [rdx + BOOT_PCI_DATA + 1], 0
|
||||
mov byte [rdx + BOOT_PCI_DATA + 2], 0x10
|
||||
mov byte [rdx + BOOT_PCI_DATA + 3], 0x02
|
||||
mov dword [rdx + BOOT_PCI_DATA + 4], 0xe3
|
||||
mov byte [rdx + BOOT_LO.pci_data + 0], 1
|
||||
mov byte [rdx + BOOT_LO.pci_data + 1], 0
|
||||
mov byte [rdx + BOOT_LO.pci_data + 2], 0x10
|
||||
mov byte [rdx + BOOT_LO.pci_data + 3], 0x02
|
||||
mov dword [rdx + BOOT_LO.pci_data + 4], 0xe3
|
||||
|
||||
|
||||
uefi_call_wrapper BootServices, GetMemoryMap, memory_map_size, memory_map, memory_map_key, descriptor_size, descriptor_ver
|
||||
cmp eax, EFI_SUCCESS
|
||||
jnz .error
|
||||
|
||||
mov rdi, BOOT_MEMMAP_BLOCK_CNT
|
||||
mov rdi, BOOT_LO.memmap_block_cnt
|
||||
mov dword[rdi], 0
|
||||
mov rdi, BOOT_MEMMAP_BLOCKS
|
||||
mov rdi, BOOT_LO.memmap_blocks
|
||||
mov rax, [memory_map_size]
|
||||
xor edx, edx
|
||||
mov rcx, [descriptor_size]
|
||||
@ -215,24 +215,24 @@ main:
|
||||
rep movsq
|
||||
|
||||
xor esi, esi
|
||||
mov byte[esi + BOOT_BPP], 32
|
||||
mov word[esi + BOOT_VESA_MODE], 0
|
||||
mov dword[esi + BOOT_BANK_SW], 0
|
||||
mov byte[esi + BOOT_LO.bpp], 32
|
||||
mov word[esi + BOOT_LO.vesa_mode], 0
|
||||
mov dword[esi + BOOT_LO.bank_switch], 0
|
||||
mov rdi, [fb_base]
|
||||
mov dword[esi + BOOT_LFB], edi
|
||||
mov byte[esi + BOOT_MTRR], 1
|
||||
mov byte[esi + BOOT_LAUNCHER_START], 1
|
||||
mov byte[esi + BOOT_DEBUG_PRINT], 1
|
||||
mov byte[esi + BOOT_DMA], 0
|
||||
; mov qword[esi + BOOT_PCI_DATA], 0
|
||||
mov dword[esi + BOOT_APM_ENTRY], 0
|
||||
mov word[esi + BOOT_APM_VERSION], 0
|
||||
mov dword[esi + BOOT_APM_FLAGS], 0
|
||||
mov word[esi + BOOT_APM_CODE_32], 0
|
||||
mov word[esi + BOOT_APM_CODE_16], 0
|
||||
mov word[esi + BOOT_APM_DATA_16], 0
|
||||
mov byte[esi + BOOT_BIOS_HD_CNT], 0
|
||||
mov word[esi + BOOT_BX_FROM_LOAD], 'r1' ; boot from /rd/1
|
||||
mov dword[esi + BOOT_LO.lfb], edi
|
||||
mov byte[esi + BOOT_LO.mtrr], 1
|
||||
mov byte[esi + BOOT_LO.launcher_start], 1
|
||||
mov byte[esi + BOOT_LO.debug_print], 1
|
||||
mov byte[esi + BOOT_LO.dma], 0
|
||||
; mov qword[esi + BOOT_LO.pci_data], 0
|
||||
mov dword[esi + BOOT_LO.apm_entry], 0
|
||||
mov word[esi + BOOT_LO.apm_version], 0
|
||||
mov dword[esi + BOOT_LO.apm_flags], 0
|
||||
mov word[esi + BOOT_LO.apm_code_32], 0
|
||||
mov word[esi + BOOT_LO.apm_code_16], 0
|
||||
mov word[esi + BOOT_LO.apm_data_16], 0
|
||||
mov byte[esi + BOOT_LO.bios_hd_cnt], 0
|
||||
mov word[esi + BOOT_LO.bx_from_load], 'r1' ; boot from /rd/1
|
||||
|
||||
|
||||
lgdt [cs:GDTR]
|
||||
@ -341,7 +341,7 @@ add_uefi_memmap:
|
||||
.done:
|
||||
mov [rdi + e820entry.type], eax
|
||||
|
||||
mov rax, BOOT_MEMMAP_BLOCK_CNT
|
||||
mov rax, BOOT_LO.memmap_block_cnt
|
||||
inc word[rax]
|
||||
|
||||
pop rdi rsi rdx rcx rbx rax
|
||||
|
@ -24,15 +24,15 @@ init_pci_16:
|
||||
|
||||
xor ax, ax
|
||||
mov es, ax
|
||||
mov byte [es:BOOT_PCI_DATA], 1;default mechanism:1
|
||||
mov byte [es:BOOT_LO.pci_data], 1;default mechanism:1
|
||||
mov ax, 0xb101
|
||||
int 0x1a
|
||||
or ah, ah
|
||||
jnz pci16skip
|
||||
|
||||
mov [es:BOOT_PCI_DATA+1], cl;last PCI bus in system
|
||||
mov [es:BOOT_PCI_DATA+2], bx
|
||||
mov [es:BOOT_PCI_DATA+4], edi
|
||||
mov [es:BOOT_LO.pci_data+1], cl;last PCI bus in system
|
||||
mov word[es:BOOT_LO.pci_data+2], bx
|
||||
mov dword[es:BOOT_LO.pci_data+4], edi
|
||||
|
||||
; we have a PCI BIOS, so check which configuration mechanism(s)
|
||||
; it supports
|
||||
@ -41,7 +41,7 @@ init_pci_16:
|
||||
jnz pci16skip
|
||||
test al, 2
|
||||
jz pci16skip
|
||||
mov byte [es:BOOT_PCI_DATA], 2; if (al&3)==2 => mechanism 2
|
||||
mov byte [es:BOOT_LO.pci_data], 2; if (al&3)==2 => mechanism 2
|
||||
|
||||
pci16skip:
|
||||
|
||||
|
@ -101,17 +101,17 @@ pci_api_drv:
|
||||
|
||||
pci_fn_0:
|
||||
; PCI function 0: get pci version (AH.AL)
|
||||
movzx eax, word [BOOT_VARS+BOOT_PCI_DATA+2]
|
||||
movzx eax, word [BOOT.pci_data+2]
|
||||
ret
|
||||
|
||||
pci_fn_1:
|
||||
; PCI function 1: get last bus in AL
|
||||
mov al, [BOOT_VARS+BOOT_PCI_DATA+1]
|
||||
mov al, [BOOT.pci_data+1]
|
||||
ret
|
||||
|
||||
pci_fn_2:
|
||||
; PCI function 2: get pci access mechanism
|
||||
mov al, [BOOT_VARS+BOOT_PCI_DATA]
|
||||
mov al, [BOOT.pci_data]
|
||||
ret
|
||||
|
||||
pci_service_not_supported:
|
||||
@ -156,7 +156,7 @@ align 4
|
||||
|
||||
pci_read_reg:
|
||||
push ebx esi
|
||||
cmp byte [BOOT_VARS+BOOT_PCI_DATA], 2;what mechanism will we use?
|
||||
cmp byte [BOOT.pci_data], 2;what mechanism will we use?
|
||||
je pci_read_reg_2
|
||||
|
||||
; mechanism 1
|
||||
@ -260,7 +260,7 @@ align 4
|
||||
|
||||
pci_write_reg:
|
||||
push esi ebx
|
||||
cmp byte [BOOT_VARS+BOOT_PCI_DATA], 2;what mechanism will we use?
|
||||
cmp byte [BOOT.pci_data], 2;what mechanism will we use?
|
||||
je pci_write_reg_2
|
||||
|
||||
; mechanism 1
|
||||
@ -519,9 +519,9 @@ sys_pcibios:
|
||||
cmp ebp, 1 ; PCI_FUNCTION_ID
|
||||
jnz .not_PCI_BIOS_PRESENT
|
||||
mov edx, 'PCI '
|
||||
mov al, [BOOT_VARS + BOOT_PCI_DATA]
|
||||
mov bx, [BOOT_VARS + BOOT_PCI_DATA + 2]
|
||||
mov cl, [BOOT_VARS + BOOT_PCI_DATA + 1]
|
||||
mov al, [BOOT.pci_data]
|
||||
mov bx, word[BOOT.pci_data + 2]
|
||||
mov cl, [BOOT.pci_data + 1]
|
||||
xor ah, ah
|
||||
jmp .return_abcd
|
||||
|
||||
@ -665,7 +665,7 @@ end virtual
|
||||
.next_func:
|
||||
inc dword [.devfn]
|
||||
mov ah, [.bus]
|
||||
cmp ah, [BOOT_VARS+BOOT_PCI_DATA+1]
|
||||
cmp ah, [BOOT.pci_data+1]
|
||||
jbe .loop
|
||||
.nomemory:
|
||||
leave
|
||||
|
@ -1,6 +1,6 @@
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; ;;
|
||||
;; Copyright (C) KolibriOS team 2004-2015. All rights reserved. ;;
|
||||
;; Copyright (C) KolibriOS team 2004-2017. All rights reserved. ;;
|
||||
;; Distributed under terms of the GNU General Public License ;;
|
||||
;; ;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
@ -229,7 +229,7 @@ CDDataBuf equ (OS_BASE+0x0005000)
|
||||
|
||||
;unused 0x6000 - 0x8fff
|
||||
|
||||
BOOT_VARS equ (OS_BASE) ;0x9000
|
||||
BOOT_VARS equ 0x9000
|
||||
|
||||
idts equ (OS_BASE+0x000B100)
|
||||
WIN_STACK equ (OS_BASE+0x000C000)
|
||||
@ -334,41 +334,6 @@ PAT_TYPE_UCM equ 7
|
||||
|
||||
PAT_VALUE equ 0x00070106; (UC<<24)|(UCM<<16)|(WC<<8)|WB
|
||||
|
||||
;;;;;;;;;;;boot time variables
|
||||
|
||||
BOOT_BPP equ 0x9000 ;byte bits per pixel
|
||||
BOOT_PITCH equ 0x9001 ;word scanline length
|
||||
BOOT_VESA_MODE equ 0x9008 ;word vesa video mode
|
||||
BOOT_X_RES equ 0x900A ;word X res
|
||||
BOOT_Y_RES equ 0x900C ;word Y res
|
||||
BOOT_BANK_SW equ 0x9014 ;dword Vesa 1.2 pm bank switch
|
||||
BOOT_LFB equ 0x9018 ;dword Vesa 2.0 LFB address
|
||||
BOOT_MTRR equ 0x901C ;byte 0 or 1 : enable MTRR graphics acceleration
|
||||
BOOT_LAUNCHER_START equ 0x901D ;byte (0 or 1) start the first app (right now it's LAUNCHER) after kernel is loaded?
|
||||
BOOT_DEBUG_PRINT equ 0x901E ;byte If nonzero, duplicates debug output to the screen.
|
||||
BOOT_DMA equ 0x901F ;byte DMA write : 1=yes, 2=no
|
||||
BOOT_PCI_DATA equ 0x9020 ;8bytes pci data
|
||||
BOOT_SHUTDOWN_TYPE equ 0x9030 ;byte shutdown type (see sysfn 18.9)
|
||||
BOOT_MEM_AMOUNT equ 0x9034 ;dword memory amount
|
||||
|
||||
BOOT_APM_ENTRY equ 0x9040
|
||||
BOOT_APM_VERSION equ 0x9044
|
||||
BOOT_APM_FLAGS equ 0x9046
|
||||
BOOT_APM_CODE_32 equ 0x9050
|
||||
BOOT_APM_CODE_16 equ 0x9052
|
||||
BOOT_APM_DATA_16 equ 0x9054
|
||||
BOOT_DEV equ 0x9056 ; byte
|
||||
BOOT_KERNEL_RESTART equ 0x9058 ; word
|
||||
BOOT_BX_FROM_LOAD equ 0x905A ; word
|
||||
; low byte: a,b,c,d -- hdX, r -- rdX
|
||||
; high byte: symbol 'X' as in the line above, e.g. '1', not 1
|
||||
; see loader_doc.txt for details
|
||||
BOOT_ACPI_RSDP equ 0x905C ; dword
|
||||
|
||||
BOOT_BIOS_HD_CNT equ 0x907F ; byte number of BIOS hard disks
|
||||
BOOT_BIOS_HD equ 0x9080 ; Nbytes BIOS hard disks
|
||||
BOOT_MEMMAP_BLOCK_CNT equ 0x9100 ; word available physical memory map: number of blocks
|
||||
BOOT_MEMMAP_BLOCKS equ 0x9104 ; available physical memory map: blocks, i.e. e820entry structs
|
||||
MAX_MEMMAP_BLOCKS equ 32
|
||||
|
||||
TMP_FILE_NAME equ 0
|
||||
@ -705,39 +670,67 @@ struct HDLL
|
||||
parent dd ? ;DLLDESCR
|
||||
ends
|
||||
|
||||
|
||||
struct BOOT_DATA
|
||||
bpp dd ?
|
||||
scanline dd ?
|
||||
vesa_mode dd ?
|
||||
x_res dd ?
|
||||
y_res dd ?
|
||||
mouse_port dd ?
|
||||
bank_switch dd ?
|
||||
lfb dd ?
|
||||
vesa_mem dd ?
|
||||
log dd ?
|
||||
direct_lfb dd ?
|
||||
pci_data dd ?
|
||||
dd ?
|
||||
ide_base dd ?
|
||||
mem_amount dd ?
|
||||
pages_count dd ?
|
||||
pagemap_size dd ?
|
||||
kernel_max dd ?
|
||||
kernel_pages dd ?
|
||||
kernel_tables dd ?
|
||||
|
||||
cpu_vendor dd ?
|
||||
dd ?
|
||||
dd ?
|
||||
cpu_sign dd ?
|
||||
cpu_info dd ?
|
||||
cpu_caps dd ?
|
||||
dd ?
|
||||
dd ?
|
||||
struct DQ
|
||||
lo dd ?
|
||||
hi dd ?
|
||||
ends
|
||||
|
||||
struct e820entry
|
||||
addr DQ ?
|
||||
size DQ ?
|
||||
type dd ?
|
||||
ends
|
||||
|
||||
struct boot_data
|
||||
bpp db ? ; bits per pixel
|
||||
pitch dw ? ; scanline length
|
||||
db ?
|
||||
dd ?
|
||||
vesa_mode dw ?
|
||||
x_res dw ?
|
||||
y_res dw ?
|
||||
dw ?
|
||||
dd ?
|
||||
bank_switch dd ? ; Vesa 1.2 pm bank switch
|
||||
lfb dd ? ; Vesa 2.0 LFB address
|
||||
mtrr db ? ; 0 or 1: enable MTRR graphics acceleration
|
||||
launcher_start db ? ; 0 or 1: start the first app (right now it's LAUNCHER) after kernel is loaded
|
||||
debug_print db ? ; if nonzero, duplicates debug output to the screen
|
||||
dma db ? ; DMA write: 1=yes, 2=no
|
||||
pci_data rb 8
|
||||
rb 8
|
||||
shutdown_type db ? ; see sysfn 18.9
|
||||
rb 15
|
||||
apm_entry dd ? ; entry point of APM BIOS
|
||||
apm_version dw ? ; BCD
|
||||
apm_flags dw ?
|
||||
rb 8
|
||||
apm_code_32 dw ?
|
||||
apm_code_16 dw ?
|
||||
apm_data_16 dw ?
|
||||
dev db ?
|
||||
db ?
|
||||
kernel_restart dw ?
|
||||
bx_from_load dw ?
|
||||
; low byte: a,b,c,d -- hdX, r -- rdX
|
||||
; high byte: symbol 'X' as in the line above, e.g. '1', not 1
|
||||
; see loader_doc.txt for details
|
||||
acpi_rsdp dd ?
|
||||
rb 0x1f
|
||||
bios_hd_cnt db ? ; number of BIOS hard disks
|
||||
bios_hd rb 0x80 ; BIOS hard disks
|
||||
memmap_block_cnt dd ? ; available physical memory map: number of blocks
|
||||
memmap_blocks e820entry
|
||||
rb sizeof.e820entry * (MAX_MEMMAP_BLOCKS - 1)
|
||||
ends
|
||||
|
||||
virtual at BOOT_VARS
|
||||
BOOT_LO boot_data
|
||||
end virtual
|
||||
virtual at OS_BASE + BOOT_VARS
|
||||
BOOT boot_data
|
||||
end virtual
|
||||
|
||||
struct display_t
|
||||
x dd ?
|
||||
y dd ?
|
||||
@ -972,14 +965,3 @@ struct IRQH
|
||||
num_ints dd ? ;how many times handled
|
||||
ends
|
||||
|
||||
struct DQ
|
||||
lo dd ?
|
||||
hi dd ?
|
||||
ends
|
||||
|
||||
struct e820entry
|
||||
addr DQ ?
|
||||
size DQ ?
|
||||
type dd ?
|
||||
ends
|
||||
|
||||
|
@ -1336,7 +1336,7 @@ endp
|
||||
|
||||
align 4
|
||||
proc print_mem
|
||||
mov edi, BOOT_VAR + BOOT_MEMMAP_BLOCKS
|
||||
mov edi, BOOT.memmap_blocks
|
||||
mov ecx, [edi-4]
|
||||
test ecx, ecx
|
||||
jz .done
|
||||
|
@ -10,7 +10,7 @@ $Revision$
|
||||
; Initializes MTRRs.
|
||||
proc init_mtrr
|
||||
|
||||
cmp [BOOT_VARS+BOOT_MTRR], byte 2
|
||||
cmp [BOOT.mtrr], byte 2
|
||||
je .exit
|
||||
|
||||
bt [cpu_caps], CAPS_MTRR
|
||||
|
@ -112,13 +112,18 @@ macro movi r,i
|
||||
|
||||
include '../kglobals.inc'
|
||||
CAPS_MTRR equ 12
|
||||
MSR_MTRR_DEF_TYPE equ 0x2FF
|
||||
CAPS_PGE equ 13
|
||||
CAPS_PAT equ 16
|
||||
MSR_CR_PAT equ 0x277
|
||||
PAT_VALUE equ 0x00070106 ; (UC<<24)|(UCM<<16)|(WC<<8)|WB
|
||||
MEM_WB equ 6 ;write-back memory
|
||||
MEM_WC equ 1 ;write combined memory
|
||||
MEM_UC equ 0 ;uncached memory
|
||||
include 'mtrr.inc'
|
||||
|
||||
BOOT_VARS = 0
|
||||
BOOT_MTRR db 1
|
||||
BOOT.mtrr db 1
|
||||
align 4
|
||||
cpu_caps dd 1 shl CAPS_MTRR
|
||||
LFBAddress dd 0xE0000000
|
||||
|
@ -15,7 +15,7 @@ $Revision$
|
||||
|
||||
xor cx, cx
|
||||
mov es, cx
|
||||
mov di, BOOT_BIOS_HD
|
||||
mov di, BOOT_LO.bios_hd
|
||||
mov byte [es:di-1], cl
|
||||
cmp [preboot_biosdisk], 1
|
||||
jnz bdde
|
||||
@ -62,7 +62,7 @@ bdds:
|
||||
jb .noide
|
||||
cmp word [es:si+1Ah], 0xFFFF
|
||||
jz .noide
|
||||
inc byte [es:BOOT_BIOS_HD_CNT]
|
||||
inc byte [es:BOOT_LO.bios_hd_cnt]
|
||||
mov al, dl
|
||||
stosb
|
||||
push ds
|
||||
@ -95,7 +95,7 @@ bdds:
|
||||
cmp byte [es:si+2Ah], 'B'
|
||||
jz bddc2
|
||||
.nousb:
|
||||
inc byte [es:BOOT_BIOS_HD_CNT]
|
||||
inc byte [es:BOOT_LO.bios_hd_cnt]
|
||||
mov al, dl
|
||||
stosb
|
||||
xor ax, ax
|
||||
|
@ -17,8 +17,8 @@ $Revision$
|
||||
xor ebx, ebx
|
||||
mov es, bx
|
||||
mov ds, bx
|
||||
mov di, BOOT_MEMMAP_BLOCKS
|
||||
mov [BOOT_MEMMAP_BLOCK_CNT], ebx ; no blocks yet
|
||||
mov di, BOOT_LO.memmap_blocks
|
||||
mov [BOOT_LO.memmap_block_cnt], ebx ; no blocks yet
|
||||
mov ecx, 20
|
||||
mov edx, 'PAMS' ; 'SMAP'
|
||||
int 15h
|
||||
@ -28,13 +28,13 @@ $Revision$
|
||||
e820_mem_loop:
|
||||
; cmp byte [di+16], 1 ; ignore non-free areas
|
||||
; jnz e820_mem_next
|
||||
inc byte [BOOT_MEMMAP_BLOCK_CNT]
|
||||
inc byte [BOOT_LO.memmap_block_cnt]
|
||||
add di, sizeof.e820entry
|
||||
e820_mem_next:
|
||||
; consequent calls to fn E820
|
||||
test ebx, ebx
|
||||
jz e820_test_done
|
||||
cmp byte [BOOT_MEMMAP_BLOCK_CNT], MAX_MEMMAP_BLOCKS
|
||||
cmp byte [BOOT_LO.memmap_block_cnt], MAX_MEMMAP_BLOCKS
|
||||
jz e820_test_done
|
||||
mov eax, 0xE820
|
||||
int 15h
|
||||
|
@ -28,7 +28,7 @@ proc Parser_params
|
||||
locals
|
||||
buff rb 4 ; for test cd
|
||||
endl
|
||||
mov ax, [OS_BASE+BOOT_BX_FROM_LOAD]
|
||||
mov ax, [BOOT.bx_from_load]
|
||||
mov ecx, sysdir_path
|
||||
mov [ecx-64], dword 'sys'
|
||||
mov [ecx-2], byte 3
|
||||
|
@ -15,7 +15,7 @@ MEM_UC equ 0 ;uncached memory
|
||||
align 4
|
||||
proc mem_test
|
||||
; if we have BIOS with fn E820, skip the test
|
||||
cmp dword [BOOT_VARS-OS_BASE + BOOT_MEMMAP_BLOCK_CNT], 0
|
||||
cmp dword [BOOT_LO.memmap_block_cnt], 0
|
||||
jnz .ret
|
||||
|
||||
mov eax, cr0
|
||||
@ -35,14 +35,14 @@ proc mem_test
|
||||
|
||||
and eax, not (CR0_CD+CR0_NW) ;enable caching
|
||||
mov cr0, eax
|
||||
inc dword [BOOT_VARS-OS_BASE + BOOT_MEMMAP_BLOCK_CNT]
|
||||
inc dword [BOOT_LO.memmap_block_cnt]
|
||||
xor eax, eax
|
||||
mov [BOOT_VARS-OS_BASE + BOOT_MEMMAP_BLOCKS + e820entry.addr.lo], eax
|
||||
mov [BOOT_VARS-OS_BASE + BOOT_MEMMAP_BLOCKS + e820entry.addr.hi], eax
|
||||
mov [BOOT_VARS-OS_BASE + BOOT_MEMMAP_BLOCKS + e820entry.size.lo], edi
|
||||
mov [BOOT_VARS-OS_BASE + BOOT_MEMMAP_BLOCKS + e820entry.size.hi], eax
|
||||
mov [BOOT_LO.memmap_blocks + e820entry.addr.lo], eax
|
||||
mov [BOOT_LO.memmap_blocks + e820entry.addr.hi], eax
|
||||
mov [BOOT_LO.memmap_blocks + e820entry.size.lo], edi
|
||||
mov [BOOT_LO.memmap_blocks + e820entry.size.hi], eax
|
||||
inc eax
|
||||
mov [BOOT_VARS-OS_BASE + BOOT_MEMMAP_BLOCKS + e820entry.type], eax
|
||||
mov [BOOT_LO.memmap_blocks + e820entry.type], eax
|
||||
.ret:
|
||||
ret
|
||||
endp
|
||||
@ -50,7 +50,7 @@ endp
|
||||
align 4
|
||||
proc init_mem
|
||||
; calculate maximum allocatable address and number of allocatable pages
|
||||
mov edi, BOOT_VARS-OS_BASE + BOOT_MEMMAP_BLOCKS
|
||||
mov edi, BOOT_LO.memmap_blocks
|
||||
mov ecx, [edi-4]
|
||||
xor esi, esi; esi will hold total amount of memory
|
||||
xor edx, edx; edx will hold maximum allocatable address
|
||||
@ -197,7 +197,7 @@ proc init_page_map
|
||||
rep stosd
|
||||
|
||||
; scan through memory map and mark free areas as available
|
||||
mov ebx, BOOT_VARS-OS_BASE + BOOT_MEMMAP_BLOCKS
|
||||
mov ebx, BOOT_LO.memmap_blocks
|
||||
mov edx, [ebx-4]
|
||||
.scanmap:
|
||||
cmp [ebx+16], byte 1
|
||||
@ -459,7 +459,7 @@ acpi_locate:
|
||||
|
||||
if defined UEFI
|
||||
; UEFI loader knows where RSDP is
|
||||
mov ebx, [BOOT_ACPI_RSDP]
|
||||
mov ebx, [BOOT_LO.acpi_rsdp]
|
||||
test ebx, ebx
|
||||
jz .done
|
||||
call .check
|
||||
|
@ -333,12 +333,12 @@ high_code:
|
||||
; --------------- APM ---------------------
|
||||
|
||||
; init selectors
|
||||
mov ebx, [BOOT_VARS+BOOT_APM_ENTRY] ; offset of APM entry point
|
||||
movzx eax, word [BOOT_VARS+BOOT_APM_CODE_32] ; real-mode segment base address of
|
||||
mov ebx, [BOOT.apm_entry] ; offset of APM entry point
|
||||
movzx eax, word [BOOT.apm_code_32] ; real-mode segment base address of
|
||||
; protected-mode 32-bit code segment
|
||||
movzx ecx, word [BOOT_VARS+BOOT_APM_CODE_16]; real-mode segment base address of
|
||||
movzx ecx, word [BOOT.apm_code_16] ; real-mode segment base address of
|
||||
; protected-mode 16-bit code segment
|
||||
movzx edx, word [BOOT_VARS+BOOT_APM_DATA_16]; real-mode segment base address of
|
||||
movzx edx, word [BOOT.apm_data_16] ; real-mode segment base address of
|
||||
; protected-mode 16-bit data segment
|
||||
|
||||
shl eax, 4
|
||||
@ -359,19 +359,19 @@ high_code:
|
||||
mov dword[apm_entry], ebx
|
||||
mov word [apm_entry + 4], apm_code_32 - gdts
|
||||
|
||||
mov eax, [BOOT_VARS + BOOT_APM_VERSION] ; version & flags
|
||||
mov eax, dword[BOOT.apm_version] ; version & flags
|
||||
mov [apm_vf], eax
|
||||
; -----------------------------------------
|
||||
mov al, [BOOT_VARS+BOOT_DMA] ; DMA access
|
||||
mov al, [BOOT.dma] ; DMA access
|
||||
mov [allow_dma_access], al
|
||||
|
||||
mov al, [BOOT_VARS+BOOT_DEBUG_PRINT] ; If nonzero, duplicates debug output to the screen
|
||||
mov al, [BOOT.debug_print] ; If nonzero, duplicates debug output to the screen
|
||||
mov [debug_direct_print], al
|
||||
|
||||
mov al, [BOOT_VARS+BOOT_LAUNCHER_START] ; Start the first app (LAUNCHER) after kernel is loaded?
|
||||
mov al, [BOOT.launcher_start] ; Start the first app (LAUNCHER) after kernel is loaded?
|
||||
mov [launcher_start], al
|
||||
|
||||
mov esi, BOOT_VARS+BOOT_BIOS_HD
|
||||
mov esi, BOOT.bios_hd
|
||||
movzx ecx, byte [esi-1]
|
||||
mov [NumBiosDisks], ecx
|
||||
mov edi, BiosDisksData
|
||||
@ -694,7 +694,7 @@ endg
|
||||
call PIT_init
|
||||
|
||||
; Register ramdisk file system
|
||||
cmp byte [BOOT_DEV+OS_BASE+0x10000], 1
|
||||
cmp byte [BOOT.dev+0x10000], 1
|
||||
je @f
|
||||
|
||||
call register_ramdisk
|
||||
@ -785,7 +785,7 @@ include 'detect/dev_fd.inc'
|
||||
include 'detect/init_ata.inc'
|
||||
;-----------------------------------------------------------------------------
|
||||
if 0
|
||||
mov ax, [OS_BASE+BOOT_BX_FROM_LOAD]
|
||||
mov ax, [BOOT.bx_from_load]
|
||||
cmp ax, 'r1'; if using not ram disk, then load librares and parameters {SPraid.simba}
|
||||
je no_lib_load
|
||||
|
||||
@ -1294,10 +1294,10 @@ set_variables:
|
||||
loop .fl60
|
||||
push eax
|
||||
|
||||
mov ax, [BOOT_VARS+BOOT_Y_RES]
|
||||
mov ax, [BOOT.y_res]
|
||||
shr ax, 1
|
||||
shl eax, 16
|
||||
mov ax, [BOOT_VARS+BOOT_X_RES]
|
||||
mov ax, [BOOT.x_res]
|
||||
shr ax, 1
|
||||
mov [MOUSE_X], eax
|
||||
call wakeup_osloop
|
||||
@ -2117,7 +2117,7 @@ sysfn_shutdown: ; 18.9 = system shutdown
|
||||
jl exit_for_anyone
|
||||
cmp ecx, SYSTEM_RESTART
|
||||
jg exit_for_anyone
|
||||
mov [BOOT_VARS+BOOT_SHUTDOWN_TYPE], cl
|
||||
mov [BOOT.shutdown_type], cl
|
||||
|
||||
mov eax, [TASK_COUNT]
|
||||
mov [SYS_SHUTDOWN], al
|
||||
|
@ -9,6 +9,7 @@
|
||||
;
|
||||
; Boot:
|
||||
;
|
||||
; BOOT_LO / boot_data structure
|
||||
; 0:9000 byte bits per pixel
|
||||
; 0:9001 word scanline length
|
||||
; 0:9008 word vesa video mode
|
||||
|
@ -40,37 +40,37 @@ align 4
|
||||
init_video:
|
||||
mov ebp, bios_fb
|
||||
|
||||
movzx eax, byte [BOOT_VARS+BOOT_BPP] ; bpp
|
||||
movzx eax, byte [BOOT.bpp] ; bpp
|
||||
mov [_display.bits_per_pixel], eax
|
||||
mov [_display.vrefresh], 60
|
||||
|
||||
movzx eax, word [BOOT_VARS+BOOT_X_RES]; X max
|
||||
movzx eax, word [BOOT.x_res]; X max
|
||||
mov [_display.width], eax
|
||||
mov [ebp+FRB.width], eax
|
||||
mov [display_width_standard], eax
|
||||
dec eax
|
||||
mov [screen_workarea.right], eax
|
||||
|
||||
movzx eax, word [BOOT_VARS+BOOT_Y_RES]; Y max
|
||||
movzx eax, word [BOOT.y_res]; Y max
|
||||
mov [_display.height], eax
|
||||
mov [ebp+FRB.height], eax
|
||||
mov [display_height_standard], eax
|
||||
dec eax
|
||||
mov [screen_workarea.bottom], eax
|
||||
|
||||
movzx eax, word [BOOT_VARS+BOOT_VESA_MODE] ; screen mode
|
||||
movzx eax, word [BOOT.vesa_mode] ; screen mode
|
||||
mov dword [SCR_MODE], eax
|
||||
mov eax, 640 *4 ; Bytes PerScanLine
|
||||
cmp [SCR_MODE], word 0x13 ; 320x200
|
||||
je @f
|
||||
cmp [SCR_MODE], word 0x12 ; VGA 640x480
|
||||
je @f
|
||||
movzx eax, word[BOOT_VARS+BOOT_PITCH] ; for other modes
|
||||
movzx eax, word[BOOT.pitch] ; for other modes
|
||||
@@:
|
||||
mov [_display.lfb_pitch], eax
|
||||
mov [ebp+FRB.pitch], eax
|
||||
|
||||
mov eax, [BOOT_VARS+BOOT_LFB]
|
||||
mov eax, [BOOT.lfb]
|
||||
mov [LFBAddress], eax
|
||||
|
||||
mov eax, [_display.width]
|
||||
@ -179,7 +179,7 @@ init_video:
|
||||
jmp .ok
|
||||
|
||||
.fake:
|
||||
mov [BOOT_VARS+BOOT_MTRR], byte 2
|
||||
mov [BOOT.mtrr], byte 2
|
||||
|
||||
stdcall alloc_kernel_space, 0x1000
|
||||
push eax ;store in stack for subsequent
|
||||
|
Loading…
Reference in New Issue
Block a user