Synchronize memmap.inc and const.inc, replace hardcoded numbers with macros.

git-svn-id: svn://kolibrios.org@7122 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Ivan Baravy 2017-11-29 22:03:58 +00:00
parent 16d9a4a4bc
commit 09684c0db9
12 changed files with 78 additions and 68 deletions

View File

@ -789,7 +789,7 @@ set_vmode:
; add eax, ebx ; add eax, ebx
; push 0x0000 ; push 0x0000
; pop es ; pop es
; mov [es:0x9014], eax ; mov [es:BOOT_BANK_SW], eax
.exit: .exit:
ret ret

View File

@ -24,15 +24,15 @@ init_pci_16:
xor ax, ax xor ax, ax
mov es, ax mov es, ax
mov byte [es:0x9020], 1;default mechanism:1 mov byte [es:BOOT_PCI_DATA], 1;default mechanism:1
mov ax, 0xb101 mov ax, 0xb101
int 0x1a int 0x1a
or ah, ah or ah, ah
jnz pci16skip jnz pci16skip
mov [es:0x9021], cl;last PCI bus in system mov [es:BOOT_PCI_DATA+1], cl;last PCI bus in system
mov [es:0x9022], bx mov [es:BOOT_PCI_DATA+2], bx
mov [es:0x9024], edi mov [es:BOOT_PCI_DATA+4], edi
; we have a PCI BIOS, so check which configuration mechanism(s) ; we have a PCI BIOS, so check which configuration mechanism(s)
; it supports ; it supports
@ -41,7 +41,7 @@ init_pci_16:
jnz pci16skip jnz pci16skip
test al, 2 test al, 2
jz pci16skip jz pci16skip
mov byte [es:0x9020], 2; if (al&3)==2 => mechanism 2 mov byte [es:BOOT_PCI_DATA], 2; if (al&3)==2 => mechanism 2
pci16skip: pci16skip:

View File

@ -101,17 +101,17 @@ pci_api_drv:
pci_fn_0: pci_fn_0:
; PCI function 0: get pci version (AH.AL) ; PCI function 0: get pci version (AH.AL)
movzx eax, word [BOOT_VARS+0x9022] movzx eax, word [BOOT_VARS+BOOT_PCI_DATA+2]
ret ret
pci_fn_1: pci_fn_1:
; PCI function 1: get last bus in AL ; PCI function 1: get last bus in AL
mov al, [BOOT_VARS+0x9021] mov al, [BOOT_VARS+BOOT_PCI_DATA+1]
ret ret
pci_fn_2: pci_fn_2:
; PCI function 2: get pci access mechanism ; PCI function 2: get pci access mechanism
mov al, [BOOT_VARS+0x9020] mov al, [BOOT_VARS+BOOT_PCI_DATA]
ret ret
pci_service_not_supported: pci_service_not_supported:
@ -156,7 +156,7 @@ align 4
pci_read_reg: pci_read_reg:
push ebx esi push ebx esi
cmp byte [BOOT_VARS+0x9020], 2;what mechanism will we use? cmp byte [BOOT_VARS+BOOT_PCI_DATA], 2;what mechanism will we use?
je pci_read_reg_2 je pci_read_reg_2
; mechanism 1 ; mechanism 1
@ -260,7 +260,7 @@ align 4
pci_write_reg: pci_write_reg:
push esi ebx push esi ebx
cmp byte [BOOT_VARS+0x9020], 2;what mechanism will we use? cmp byte [BOOT_VARS+BOOT_PCI_DATA], 2;what mechanism will we use?
je pci_write_reg_2 je pci_write_reg_2
; mechanism 1 ; mechanism 1
@ -519,9 +519,9 @@ sys_pcibios:
cmp ebp, 1 ; PCI_FUNCTION_ID cmp ebp, 1 ; PCI_FUNCTION_ID
jnz .not_PCI_BIOS_PRESENT jnz .not_PCI_BIOS_PRESENT
mov edx, 'PCI ' mov edx, 'PCI '
mov al, [BOOT_VARS + 0x9020] mov al, [BOOT_VARS + BOOT_PCI_DATA]
mov bx, [BOOT_VARS + 0x9022] mov bx, [BOOT_VARS + BOOT_PCI_DATA + 2]
mov cl, [BOOT_VARS + 0x9021] mov cl, [BOOT_VARS + BOOT_PCI_DATA + 1]
xor ah, ah xor ah, ah
jmp .return_abcd jmp .return_abcd
@ -665,7 +665,7 @@ end virtual
.next_func: .next_func:
inc dword [.devfn] inc dword [.devfn]
mov ah, [.bus] mov ah, [.bus]
cmp ah, [BOOT_VARS+0x9021] cmp ah, [BOOT_VARS+BOOT_PCI_DATA+1]
jbe .loop jbe .loop
.nomemory: .nomemory:
leave leave

View File

@ -313,28 +313,25 @@ BOOT_Y_RES equ 0x900C ;word Y res
BOOT_BANK_SW equ 0x9014 ;dword Vesa 1.2 pm bank switch BOOT_BANK_SW equ 0x9014 ;dword Vesa 1.2 pm bank switch
BOOT_LFB equ 0x9018 ;dword Vesa 2.0 LFB address BOOT_LFB equ 0x9018 ;dword Vesa 2.0 LFB address
BOOT_MTRR equ 0x901C ;byte 0 or 1 : enable MTRR graphics acceleration BOOT_MTRR equ 0x901C ;byte 0 or 1 : enable MTRR graphics acceleration
;BOOT_LOG equ 0x901D ;byte not used anymore (0 or 1 : enable system log display) BOOT_LAUNCHER_START equ 0x901D ;byte (0 or 1) start the first app (right now it's LAUNCHER) after kernel is loaded?
BOOT_LAUNCHER_START equ 0x901D ;byte (0 or 1) start the first app (right now it's LAUNCHER) after kernel is loaded?
;BOOT_DIRECT_LFB equ 0x901E ;byte 0 or 1 : enable direct lfb write, paging disabled
BOOT_DEBUG_PRINT equ 0x901E ;byte If nonzero, duplicates debug output to the screen. BOOT_DEBUG_PRINT equ 0x901E ;byte If nonzero, duplicates debug output to the screen.
BOOT_DMA equ 0x901F ; BOOT_DMA equ 0x901F ;byte DMA write : 1=yes, 2=no
BOOT_PCI_DATA equ 0x9020 ;8bytes pci data BOOT_PCI_DATA equ 0x9020 ;8bytes pci data
BOOT_SHUTDOWN_TYPE equ 0x9030 ;byte shutdown type (see sysfn 18.9) BOOT_SHUTDOWN_TYPE equ 0x9030 ;byte shutdown type (see sysfn 18.9)
;BOOT_IDE_BASE_ADDR equ 0x9031 ;word IDEContrRegsBaseAddr ; now free and is not used
BOOT_MEM_AMOUNT equ 0x9034 ;dword memory amount BOOT_MEM_AMOUNT equ 0x9034 ;dword memory amount
BOOT_APM_ENTRY equ 0x9040 BOOT_APM_ENTRY equ 0x9040
BOOT_APM_VERSION equ 0x9044 BOOT_APM_VERSION equ 0x9044
BOOT_APM_FLAGS equ 0x9046 ;unused BOOT_APM_FLAGS equ 0x9046
BOOT_APM_CODE_32 equ 0x9050 BOOT_APM_CODE_32 equ 0x9050
BOOT_APM_CODE_16 equ 0x9052 BOOT_APM_CODE_16 equ 0x9052
BOOT_APM_DATA_16 equ 0x9054 BOOT_APM_DATA_16 equ 0x9054
;BOOT_IDE_BAR0_16 equ 0x9056 ; now free and is not used
;BOOT_IDE_BAR1_16 equ 0x9058 ; now free and is not used BOOT_BIOS_HD_CNT equ 0x907F ; byte number of BIOS hard disks
;BOOT_IDE_BAR2_16 equ 0x905A ; now free and is not used BOOT_BIOS_HD equ 0x9080 ; Nbytes BIOS hard disks
;BOOT_IDE_BAR3_16 equ 0x905C ; now free and is not used BOOT_MEMMAP_BLOCK_CNT equ 0x9100 ; word available physical memory map: number of blocks
;BOOT_IDE_PI_16 equ 0x905E ; now free and is not used BOOT_MEMMAP_BLOCKS equ 0x9104 ; available physical memory map: blocks, i.e. e820entry structs
;BOOT_IDE_INTERR_16 equ 0x9060 ; now free and is not used MAX_MEMMAP_BLOCKS equ 32
TMP_FILE_NAME equ 0 TMP_FILE_NAME equ 0
TMP_CMD_LINE equ 1024 TMP_CMD_LINE equ 1024
@ -936,3 +933,15 @@ struct IRQH
data dd ? ;user-specific data data dd ? ;user-specific data
num_ints dd ? ;how many times handled num_ints dd ? ;how many times handled
ends ends
struct DQ
lo dd ?
hi dd ?
ends
struct e820entry
addr DQ ?
size DQ ?
type dd ?
ends

View File

@ -476,7 +476,7 @@ proc load_file stdcall, file_name:dword
jne .cleanup jne .cleanup
mov eax, [file] mov eax, [file]
cmp dword [eax], 0x4B43504B cmp dword [eax], 'KPCK'
jne .exit jne .exit
mov ebx, [eax+4] mov ebx, [eax+4]
mov [file_size], ebx mov [file_size], ebx
@ -583,7 +583,7 @@ proc load_file_umode stdcall, file_name:dword
jne .err_2 jne .err_2
mov eax, [km_file] mov eax, [km_file]
cmp dword [eax], 0x4B43504B ; check kpack signature cmp dword [eax], 'KPCK' ; check kpack signature
jne .raw_file jne .raw_file
mov ebx, [eax+4] ;get real size of file mov ebx, [eax+4] ;get real size of file

View File

@ -1336,7 +1336,7 @@ endp
align 4 align 4
proc print_mem proc print_mem
mov edi, BOOT_VAR + 0x9104 mov edi, BOOT_VAR + BOOT_MEMMAP_BLOCKS
mov ecx, [edi-4] mov ecx, [edi-4]
test ecx, ecx test ecx, ecx
jz .done jz .done

View File

@ -15,7 +15,7 @@ $Revision$
xor cx, cx xor cx, cx
mov es, cx mov es, cx
mov di, 0x9080 mov di, BOOT_BIOS_HD
mov byte [es:di-1], cl mov byte [es:di-1], cl
cmp [preboot_biosdisk], 1 cmp [preboot_biosdisk], 1
jnz bdde jnz bdde
@ -62,7 +62,7 @@ bdds:
jb .noide jb .noide
cmp word [es:si+1Ah], 0xFFFF cmp word [es:si+1Ah], 0xFFFF
jz .noide jz .noide
inc byte [es:0x907F] inc byte [es:BOOT_BIOS_HD_CNT]
mov al, dl mov al, dl
stosb stosb
push ds push ds
@ -95,7 +95,7 @@ bdds:
cmp byte [es:si+2Ah], 'B' cmp byte [es:si+2Ah], 'B'
jz bddc2 jz bddc2
.nousb: .nousb:
inc byte [es:0x907F] inc byte [es:BOOT_BIOS_HD_CNT]
mov al, dl mov al, dl
stosb stosb
xor ax, ax xor ax, ax

View File

@ -1,6 +1,6 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;; ;; ;;
;; Copyright (C) KolibriOS team 2009-2015. All rights reserved. ;; ;; Copyright (C) KolibriOS team 2009-2017. All rights reserved. ;;
;; Distributed under terms of the GNU General Public License ;; ;; Distributed under terms of the GNU General Public License ;;
;; ;; ;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@ -17,25 +17,25 @@ $Revision$
xor ebx, ebx xor ebx, ebx
mov es, bx mov es, bx
mov ds, bx mov ds, bx
mov di, 0x9104 mov di, BOOT_MEMMAP_BLOCKS
mov [di-4], ebx ; no blocks yet mov [BOOT_MEMMAP_BLOCK_CNT], ebx ; no blocks yet
mov ecx, 20 mov ecx, 20
mov edx, 0x534D4150 mov edx, 'PAMS' ; 'SMAP'
int 15h int 15h
jc no_E820 jc no_E820
cmp eax, 0x534D4150 cmp eax, 'PAMS'
jnz no_E820 jnz no_E820
e820_mem_loop: e820_mem_loop:
; cmp byte [di+16], 1 ; ignore non-free areas ; cmp byte [di+16], 1 ; ignore non-free areas
; jnz e820_mem_next ; jnz e820_mem_next
inc byte [0x9100] inc byte [BOOT_MEMMAP_BLOCK_CNT]
add di, 20 add di, sizeof.e820entry
e820_mem_next: e820_mem_next:
; consequent calls to fn E820 ; consequent calls to fn E820
test ebx, ebx test ebx, ebx
jz e820_test_done jz e820_test_done
cmp byte [0x9100], 32 cmp byte [BOOT_MEMMAP_BLOCK_CNT], MAX_MEMMAP_BLOCKS
jae e820_test_done jz e820_test_done
mov eax, 0xE820 mov eax, 0xE820
int 15h int 15h
jc e820_test_done jc e820_test_done

View File

@ -12,7 +12,7 @@
$Revision$ $Revision$
VORTEX86DEBUG = 0 ; For testing in emulators and in non-Vortex86 CPU computers, set this to 1 VORTEX86DEBUG = 0 ; For testing in emulators and in non-Vortex86 CPU computers, set this to 1
VORTEX86DEBUGVALUE = 0x35504d44 ; FAKE port output = used for testing VORTEX86DEBUGVALUE = 'DMP5' ; FAKE port output = used for testing
NORTH_BRIDGE = 0x80000000 ; Base address of Vortex86 PCI North Bridge NORTH_BRIDGE = 0x80000000 ; Base address of Vortex86 PCI North Bridge
SOUTH_BRIDGE = 0x80003800 ; Base address of Vortex86 PCI South Bridge SOUTH_BRIDGE = 0x80003800 ; Base address of Vortex86 PCI South Bridge

View File

@ -15,7 +15,7 @@ MEM_UC equ 0 ;uncached memory
align 4 align 4
proc mem_test proc mem_test
; if we have BIOS with fn E820, skip the test ; if we have BIOS with fn E820, skip the test
cmp dword [BOOT_VARS-OS_BASE + 0x9100], 0 cmp dword [BOOT_VARS-OS_BASE + BOOT_MEMMAP_BLOCK_CNT], 0
jnz .ret jnz .ret
mov eax, cr0 mov eax, cr0
@ -35,14 +35,14 @@ proc mem_test
and eax, not (CR0_CD+CR0_NW) ;enable caching and eax, not (CR0_CD+CR0_NW) ;enable caching
mov cr0, eax mov cr0, eax
inc dword [BOOT_VARS-OS_BASE + 0x9100] inc dword [BOOT_VARS-OS_BASE + BOOT_MEMMAP_BLOCK_CNT]
xor eax, eax xor eax, eax
mov [BOOT_VARS-OS_BASE + 0x9104], eax mov [BOOT_VARS-OS_BASE + BOOT_MEMMAP_BLOCKS + e820entry.addr.lo], eax
mov [BOOT_VARS-OS_BASE + 0x9108], eax mov [BOOT_VARS-OS_BASE + BOOT_MEMMAP_BLOCKS + e820entry.addr.hi], eax
mov [BOOT_VARS-OS_BASE + 0x910C], edi mov [BOOT_VARS-OS_BASE + BOOT_MEMMAP_BLOCKS + e820entry.size.lo], edi
mov [BOOT_VARS-OS_BASE + 0x9110], eax mov [BOOT_VARS-OS_BASE + BOOT_MEMMAP_BLOCKS + e820entry.size.hi], eax
inc eax inc eax
mov [BOOT_VARS-OS_BASE + 0x9114], eax mov [BOOT_VARS-OS_BASE + BOOT_MEMMAP_BLOCKS + e820entry.type], eax
.ret: .ret:
ret ret
endp endp
@ -50,7 +50,7 @@ endp
align 4 align 4
proc init_mem proc init_mem
; calculate maximum allocatable address and number of allocatable pages ; calculate maximum allocatable address and number of allocatable pages
mov edi, BOOT_VARS-OS_BASE + 0x9104 mov edi, BOOT_VARS-OS_BASE + BOOT_MEMMAP_BLOCKS
mov ecx, [edi-4] mov ecx, [edi-4]
xor esi, esi; esi will hold total amount of memory xor esi, esi; esi will hold total amount of memory
xor edx, edx; edx will hold maximum allocatable address xor edx, edx; edx will hold maximum allocatable address
@ -197,7 +197,7 @@ proc init_page_map
rep stosd rep stosd
; scan through memory map and mark free areas as available ; scan through memory map and mark free areas as available
mov ebx, BOOT_VARS-OS_BASE + 0x9104 mov ebx, BOOT_VARS-OS_BASE + BOOT_MEMMAP_BLOCKS
mov edx, [ebx-4] mov edx, [ebx-4]
.scanmap: .scanmap:
cmp [ebx+16], byte 1 cmp [ebx+16], byte 1
@ -448,9 +448,9 @@ ACPI_HI_RSDP_WINDOW_START equ 0x000E0000
ACPI_HI_RSDP_WINDOW_END equ 0x00100000 ACPI_HI_RSDP_WINDOW_END equ 0x00100000
ACPI_RSDP_CHECKSUM_LENGTH equ 20 ACPI_RSDP_CHECKSUM_LENGTH equ 20
ACPI_HPET_SIGN equ 0x54455048 ACPI_HPET_SIGN equ 'HPET'
ACPI_MADT_SIGN equ 0x43495041 ACPI_MADT_SIGN equ 'APIC'
ACPI_FADT_SIGN equ 0x50434146 ACPI_FADT_SIGN equ 'FACP'
acpi_locate: acpi_locate:
@ -477,9 +477,9 @@ acpi_locate:
ret ret
.check: .check:
cmp [ebx], dword 0x20445352 cmp [ebx], dword 'RSD '
jne .next jne .next
cmp [ebx+4], dword 0x20525450 cmp [ebx+4], dword 'PTR '
jne .next jne .next
mov edx, ebx mov edx, ebx

View File

@ -447,7 +447,7 @@ high_code:
mov al, [BOOT_VARS+BOOT_LAUNCHER_START] ; Start the first app (LAUNCHER) after kernel is loaded? mov al, [BOOT_VARS+BOOT_LAUNCHER_START] ; Start the first app (LAUNCHER) after kernel is loaded?
mov [launcher_start], al mov [launcher_start], al
mov esi, BOOT_VARS+0x9080 mov esi, BOOT_VARS+BOOT_BIOS_HD
movzx ecx, byte [esi-1] movzx ecx, byte [esi-1]
mov [NumBiosDisks], ecx mov [NumBiosDisks], ecx
mov edi, BiosDisksData mov edi, BiosDisksData
@ -2188,9 +2188,9 @@ sys_system:
ret ret
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
sysfn_shutdown: ; 18.9 = system shutdown sysfn_shutdown: ; 18.9 = system shutdown
cmp ecx, 1 cmp ecx, SYSTEM_SHUTDOWN
jl exit_for_anyone jl exit_for_anyone
cmp ecx, 4 cmp ecx, SYSTEM_RESTART
jg exit_for_anyone jg exit_for_anyone
mov [BOOT_VARS+BOOT_SHUTDOWN_TYPE], cl mov [BOOT_VARS+BOOT_SHUTDOWN_TYPE], cl

View File

@ -14,19 +14,20 @@
; 0:9008 word vesa video mode ; 0:9008 word vesa video mode
; 0:900A word X res ; 0:900A word X res
; 0:900C word Y res ; 0:900C word Y res
; 0:9010 byte mouse port - not used
; 0:9014 dword Vesa 1.2 pm bank switch ; 0:9014 dword Vesa 1.2 pm bank switch
; 0:9018 dword Vesa 2.0 LFB address ; 0:9018 dword Vesa 2.0 LFB address
; 0:901C byte 0 or 1 : enable MTRR graphics acceleration ; 0:901C byte 0 or 1 : enable MTRR graphics acceleration
; 0:901D byte not used anymore (0 or 1 : enable system log display) ; 0:901D byte (0 or 1) start the first app (right now it's LAUNCHER) after kernel is loaded?
; 0:901E byte 0 or 1 : enable direct lfb write, paging disabled ; 0:901E byte If nonzero, duplicates debug output to the screen.
; 0:901F byte DMA write : 1=yes, 2=no ; 0:901F byte DMA write : 1=yes, 2=no
; 0:9020 8bytes pci data ; 0:9020 8bytes pci data
; 0:9030 byte shutdown type (see sysfn 18.9) ; 0:9030 byte shutdown type (see sysfn 18.9)
; 0:9031 word IDEContrRegsBaseAddr ; 0:9040 dword entry point of APM BIOS
; 0x9040 - dword - entry point of APM BIOS ; 0:9044 word version (BCD)
; 0x9044 - word - version (BCD) ; 0:9046 word flags
; 0x9046 - word - flags ; 0:9050 word APM_CODE_32
; 0:9052 word APM_CODE_16
; 0:9054 word APM_DATA_16
; 0:907F byte number of BIOS hard disks ; 0:907F byte number of BIOS hard disks
; 0:9080 Nbytes BIOS hard disks ; 0:9080 Nbytes BIOS hard disks
; 0:9100 word available physical memory map: number of blocks ; 0:9100 word available physical memory map: number of blocks