Use mem_test from init.inc
This commit is contained in:
parent
cbcb3e1ddb
commit
40fa7218b1
116
umka.asm
116
umka.asm
@ -62,19 +62,26 @@ macro pubsym name, marg1, marg2 {
|
|||||||
; extrn name -> extrn name
|
; extrn name -> extrn name
|
||||||
; extrn name, 20 -> extrn name
|
; extrn name, 20 -> extrn name
|
||||||
macro extrn name, argsize, asname {
|
macro extrn name, argsize, asname {
|
||||||
if asname eq
|
|
||||||
__asname equ name
|
|
||||||
else
|
|
||||||
__asname equ asname
|
|
||||||
end if
|
|
||||||
if HOST eq windows
|
if HOST eq windows
|
||||||
if argsize > 0
|
if argsize eqtype 0 & argsize > 0
|
||||||
extrn '_' # `name # '@' # `argsize as __asname
|
if asname eqtype 'string'
|
||||||
|
extrn '_' # `name # '@' # `argsize as asname
|
||||||
else
|
else
|
||||||
|
extrn '_' # `name # '@' # `argsize as name
|
||||||
|
end if
|
||||||
|
else
|
||||||
|
if asname eqtype
|
||||||
extrn '_' # `name as name
|
extrn '_' # `name as name
|
||||||
|
else
|
||||||
|
extrn '_' # `name as asname
|
||||||
|
end if
|
||||||
end if
|
end if
|
||||||
else if HOST eq linux
|
else if HOST eq linux
|
||||||
|
if asname eqtype
|
||||||
extrn name
|
extrn name
|
||||||
|
else
|
||||||
|
extrn name as asname
|
||||||
|
end if
|
||||||
else
|
else
|
||||||
error "Your HOST is not supported"
|
error "Your HOST is not supported"
|
||||||
end if
|
end if
|
||||||
@ -245,14 +252,8 @@ include 'macros.inc'
|
|||||||
|
|
||||||
macro diff16 msg,blah2,blah3 {
|
macro diff16 msg,blah2,blah3 {
|
||||||
if msg eq "end of .data segment"
|
if msg eq "end of .data segment"
|
||||||
if HOST eq windows
|
; fasm doesn't align on 1MiB, but ld script does
|
||||||
section '.bss.8k' writeable align 8192
|
section '.bss.1M' writeable align 0x1000
|
||||||
else if HOST eq linux
|
|
||||||
; fasm doesn't align on 65536, but ld script does
|
|
||||||
section '.bss.aligned65k' writeable align 65536
|
|
||||||
else
|
|
||||||
error "Your HOST is not supported"
|
|
||||||
end if
|
|
||||||
bss_base:
|
bss_base:
|
||||||
end if
|
end if
|
||||||
}
|
}
|
||||||
@ -327,8 +328,9 @@ include 'system.inc'
|
|||||||
include 'fdo.inc'
|
include 'fdo.inc'
|
||||||
|
|
||||||
OS_BASE equ 0
|
OS_BASE equ 0
|
||||||
|
;OS_BASE equ os_base
|
||||||
macro mov target, source {
|
macro mov target, source {
|
||||||
if source eq (HEAP_BASE - 0 + HEAP_MIN_SIZE)/4096
|
if source eq (HEAP_BASE - OS_BASE + HEAP_MIN_SIZE)/PAGE_SIZE
|
||||||
push eax eax
|
push eax eax
|
||||||
mov eax, HEAP_BASE
|
mov eax, HEAP_BASE
|
||||||
add eax, HEAP_MIN_SIZE
|
add eax, HEAP_MIN_SIZE
|
||||||
@ -336,7 +338,7 @@ macro mov target, source {
|
|||||||
mov [esp+4], eax
|
mov [esp+4], eax
|
||||||
pop eax
|
pop eax
|
||||||
pop target
|
pop target
|
||||||
else if target eq dword [sys_proc-0+PROC.pdt_0+(page_tabs shr 20)]
|
else if target eq dword [sys_proc-OS_BASE+PROC.pdt_0+(page_tabs shr 20)]
|
||||||
push eax ecx
|
push eax ecx
|
||||||
mov eax, page_tabs
|
mov eax, page_tabs
|
||||||
shr eax, 20
|
shr eax, 20
|
||||||
@ -345,12 +347,37 @@ macro mov target, source {
|
|||||||
mov ecx, sys_proc+PROC.pdt_0+PG_SWR
|
mov ecx, sys_proc+PROC.pdt_0+PG_SWR
|
||||||
mov [eax], ecx
|
mov [eax], ecx
|
||||||
pop ecx eax
|
pop ecx eax
|
||||||
|
else if target eq [(pci_code_32 - OS_BASE)]
|
||||||
|
else if target eq [(pci_data_32 - OS_BASE)]
|
||||||
|
else if target eq [(pci_code_32 - OS_BASE)+2]
|
||||||
|
else if target eq [(pci_data_32 - OS_BASE)+2]
|
||||||
|
else if target eq [(pci_code_32 - OS_BASE)+4]
|
||||||
|
else if target eq [(pci_data_32 - OS_BASE)+4]
|
||||||
|
else if target eq [(pci_code_32 - OS_BASE)+6]
|
||||||
|
else if target eq [(pci_data_32 - OS_BASE)+6]
|
||||||
|
else if target eq [(pci_bios_entry - OS_BASE)]
|
||||||
|
else if source eq (OS_BASE/PAGE_SIZE)
|
||||||
|
push ecx
|
||||||
|
mov ecx, OS_BASE
|
||||||
|
shr ecx, 12
|
||||||
|
mov target, ecx
|
||||||
|
pop ecx
|
||||||
|
else if target eq dword [sys_proc-OS_BASE+PROC.pdt_0+(page_tabs shr 20)]
|
||||||
|
else if source eq (sys_proc - OS_BASE + PROC.pdt_0) + (OS_BASE shr 20)
|
||||||
|
push ecx
|
||||||
|
mov ecx, OS_BASE
|
||||||
|
shr ecx, 20
|
||||||
|
add ecx, sys_proc
|
||||||
|
add ecx, PROC.pdt_0
|
||||||
|
sub ecx, OS_BASE
|
||||||
|
mov target, ecx
|
||||||
|
pop ecx
|
||||||
else
|
else
|
||||||
mov target, source
|
mov target, source
|
||||||
end if
|
end if
|
||||||
}
|
}
|
||||||
macro cmp target, source {
|
macro cmp target, source {
|
||||||
if source eq (HEAP_BASE - 0 + HEAP_MIN_SIZE)/4096
|
if source eq (HEAP_BASE - OS_BASE + HEAP_MIN_SIZE)/PAGE_SIZE
|
||||||
push eax eax
|
push eax eax
|
||||||
mov eax, HEAP_BASE
|
mov eax, HEAP_BASE
|
||||||
add eax, HEAP_MIN_SIZE
|
add eax, HEAP_MIN_SIZE
|
||||||
@ -359,14 +386,33 @@ macro cmp target, source {
|
|||||||
mov eax, [esp+4]
|
mov eax, [esp+4]
|
||||||
cmp target, [esp]
|
cmp target, [esp]
|
||||||
pop eax eax
|
pop eax eax
|
||||||
|
else if source eq (OS_BASE/PAGE_SIZE)
|
||||||
|
push ecx
|
||||||
|
mov ecx, OS_BASE
|
||||||
|
shr ecx, 12
|
||||||
|
cmp target, ecx
|
||||||
|
pop ecx
|
||||||
else
|
else
|
||||||
cmp target, source
|
cmp target, source
|
||||||
end if
|
end if
|
||||||
}
|
}
|
||||||
|
macro lea target, source {
|
||||||
|
if source eq [edi + (OS_BASE shr 20)]
|
||||||
|
push ecx
|
||||||
|
mov ecx, OS_BASE
|
||||||
|
shr ecx, 20
|
||||||
|
add ecx, edi
|
||||||
|
mov target, ecx
|
||||||
|
pop ecx
|
||||||
|
else
|
||||||
|
lea target, source
|
||||||
|
end if
|
||||||
|
}
|
||||||
|
|
||||||
include 'init.inc'
|
include 'init.inc'
|
||||||
purge cmp
|
|
||||||
purge mov
|
purge mov
|
||||||
|
purge cmp
|
||||||
|
purge lea
|
||||||
restore OS_BASE
|
restore OS_BASE
|
||||||
include 'core/sync.inc'
|
include 'core/sync.inc'
|
||||||
macro call target {
|
macro call target {
|
||||||
@ -521,6 +567,12 @@ proc umka._.check_alignment
|
|||||||
sub ecx, eax
|
sub ecx, eax
|
||||||
DEBUGF 4, "HEAP_BASE must be aligned on PAGE_SIZE: 0x%x", HEAP_BASE
|
DEBUGF 4, "HEAP_BASE must be aligned on PAGE_SIZE: 0x%x", HEAP_BASE
|
||||||
DEBUGF 4, ", add 0x%x or sub 0x%x\n", ecx, eax
|
DEBUGF 4, ", add 0x%x or sub 0x%x\n", ecx, eax
|
||||||
|
mov eax, SLOT_BASE
|
||||||
|
and eax, 0x10000 - 1
|
||||||
|
jz @f
|
||||||
|
mov eax, os_base
|
||||||
|
and eax, 0x100000 - 1
|
||||||
|
jz @f
|
||||||
int3
|
int3
|
||||||
@@:
|
@@:
|
||||||
ret
|
ret
|
||||||
@ -597,6 +649,13 @@ proc umka_init c uses ebx esi edi ebp, _running
|
|||||||
mov [eax + boot_data.bpp], UMKA_BOOT_DEFAULT_DISPLAY_BPP
|
mov [eax + boot_data.bpp], UMKA_BOOT_DEFAULT_DISPLAY_BPP
|
||||||
mov [eax + boot_data.pitch], UMKA_BOOT_DEFAULT_DISPLAY_BPP * \
|
mov [eax + boot_data.pitch], UMKA_BOOT_DEFAULT_DISPLAY_BPP * \
|
||||||
UMKA_BOOT_DEFAULT_DISPLAY_WIDTH / 8
|
UMKA_BOOT_DEFAULT_DISPLAY_WIDTH / 8
|
||||||
|
mov [eax + boot_data.memmap_block_cnt], 1
|
||||||
|
lea ecx, [eax + boot_data.memmap_blocks]
|
||||||
|
mov [ecx + e820entry.addr.lo], mem_block
|
||||||
|
mov [ecx + e820entry.addr.hi], 0
|
||||||
|
mov [ecx + e820entry.size.lo], 256*0x10000
|
||||||
|
mov [ecx + e820entry.size.hi], 0
|
||||||
|
mov [ecx + e820entry.type], 1
|
||||||
; init umka context
|
; init umka context
|
||||||
mov eax, umka
|
mov eax, umka
|
||||||
mov [eax+umka_ctx.booted], 0
|
mov [eax+umka_ctx.booted], 0
|
||||||
@ -617,7 +676,7 @@ proc umka_boot uses ebx esi edi ebp
|
|||||||
xor eax, eax
|
xor eax, eax
|
||||||
rep stosb
|
rep stosb
|
||||||
|
|
||||||
; call mem_test
|
call mem_test
|
||||||
; call init_mem
|
; call init_mem
|
||||||
; call init_page_map
|
; call init_page_map
|
||||||
mov [irq_mode], IRQ_APIC
|
mov [irq_mode], IRQ_APIC
|
||||||
@ -824,7 +883,7 @@ endp
|
|||||||
|
|
||||||
pubsym skin_udata
|
pubsym skin_udata
|
||||||
proc idle uses ebx esi edi
|
proc idle uses ebx esi edi
|
||||||
extrn "pause" as libc_pause
|
extrn "pause", 0, libc_pause
|
||||||
sti
|
sti
|
||||||
@@:
|
@@:
|
||||||
mov [idle_reached], 1
|
mov [idle_reached], 1
|
||||||
@ -1052,7 +1111,6 @@ COVERAGE_TABLE_SIZE = 512*1024 ; 512k should be enough for the kernel
|
|||||||
coverage_table rb COVERAGE_TABLE_SIZE * sizeof.coverage_branch
|
coverage_table rb COVERAGE_TABLE_SIZE * sizeof.coverage_branch
|
||||||
pubsym coverage_table
|
pubsym coverage_table
|
||||||
|
|
||||||
|
|
||||||
; bt for boot; otherwide fasm complains with 'name too long' for MS COFF
|
; bt for boot; otherwide fasm complains with 'name too long' for MS COFF
|
||||||
section '.data.bt' writeable align 0x1000
|
section '.data.bt' writeable align 0x1000
|
||||||
BOOT boot_data
|
BOOT boot_data
|
||||||
@ -1061,21 +1119,21 @@ BOOT_LO boot_data
|
|||||||
end virtual
|
end virtual
|
||||||
|
|
||||||
|
|
||||||
if HOST eq windows
|
|
||||||
section '.data.8k' writeable align 8192
|
|
||||||
else if HOST eq linux
|
|
||||||
; fasm doesn't align on 65536, but ld script does
|
; fasm doesn't align on 65536, but ld script does
|
||||||
section '.data.aligned65k' writeable align 65536
|
; 64 for align on 64k; otherwide fasm complains with 'name too long' for MS COFF
|
||||||
else
|
section '.data.64' writeable align 0x1000
|
||||||
error "Your HOST is not supported"
|
|
||||||
end if
|
|
||||||
|
|
||||||
umka umka_ctx
|
umka umka_ctx
|
||||||
fpu_owner dd ?
|
fpu_owner dd ?
|
||||||
idle_reached dd ?
|
idle_reached dd ?
|
||||||
|
|
||||||
|
; mem for memory; otherwide fasm complains with 'name too long' for MS COFF
|
||||||
|
section '.bss.mem' writeable align 0x1000
|
||||||
|
mem_block rb 256*0x10000
|
||||||
|
|
||||||
uglobal
|
uglobal
|
||||||
align 64
|
align 64
|
||||||
|
rb 0x100000 - (($-bss_base) AND (0x100000-1)) ; align on 1MiB
|
||||||
os_base: rb PAGE_SIZE
|
os_base: rb PAGE_SIZE
|
||||||
window_data: rb sizeof.WDATA * 256
|
window_data: rb sizeof.WDATA * 256
|
||||||
CDDataBuf: rb 0x1000
|
CDDataBuf: rb 0x1000
|
||||||
|
15
umka.ld
15
umka.ld
@ -29,7 +29,7 @@ SECTIONS
|
|||||||
{
|
{
|
||||||
.data.aligned BLOCK(0x10000) :
|
.data.aligned BLOCK(0x10000) :
|
||||||
{
|
{
|
||||||
*(SORT_BY_NAME(.data.align*))
|
*(.data.64)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -37,9 +37,18 @@ INSERT AFTER .data;
|
|||||||
|
|
||||||
SECTIONS
|
SECTIONS
|
||||||
{
|
{
|
||||||
.bss.aligned BLOCK(0x10000) :
|
.bss.aligned BLOCK(0x100000) :
|
||||||
{
|
{
|
||||||
*(SORT_BY_NAME(.bss.align*))
|
*(.bss.1M)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
INSERT AFTER .bss;
|
||||||
|
|
||||||
|
SECTIONS
|
||||||
|
{
|
||||||
|
.bss.memory BLOCK(0x1000) :
|
||||||
|
{
|
||||||
|
*(.bss.mem)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
INSERT AFTER .bss;
|
INSERT AFTER .bss;
|
||||||
|
Loading…
Reference in New Issue
Block a user