forked from KolibriOS/kolibrios
Unhardcode some PAGE_SIZE related numbers
4096 is PAGE_SIZE not 4095 is -PAGE_SIZE etc git-svn-id: svn://kolibrios.org@9899 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
c56f682434
commit
aae65fd398
@ -55,17 +55,17 @@ proc init_mem
|
|||||||
cmp byte [edi + e820entry.type], 1
|
cmp byte [edi + e820entry.type], 1
|
||||||
jne .unusable
|
jne .unusable
|
||||||
|
|
||||||
test eax, 0xFFF
|
test eax, PAGE_SIZE-1
|
||||||
jz @f
|
jz @f
|
||||||
neg eax
|
neg eax
|
||||||
and eax, 0xFFF
|
and eax, PAGE_SIZE-1
|
||||||
add [edi + e820entry.addr.lo], eax
|
add [edi + e820entry.addr.lo], eax
|
||||||
adc [edi + e820entry.addr.hi], 0
|
adc [edi + e820entry.addr.hi], 0
|
||||||
sub [edi + e820entry.size.lo], eax
|
sub [edi + e820entry.size.lo], eax
|
||||||
sbb [edi + e820entry.size.hi], 0
|
sbb [edi + e820entry.size.hi], 0
|
||||||
jc .unusable
|
jc .unusable
|
||||||
@@:
|
@@:
|
||||||
and [edi + e820entry.size.lo], not 0xFFF
|
and [edi + e820entry.size.lo], -PAGE_SIZE
|
||||||
jz .unusable
|
jz .unusable
|
||||||
; ignore memory after 4 GiB
|
; ignore memory after 4 GiB
|
||||||
cmp [edi + e820entry.addr.hi], 0
|
cmp [edi + e820entry.addr.hi], 0
|
||||||
@ -76,7 +76,7 @@ proc init_mem
|
|||||||
add eax, [edi + e820entry.size.lo]
|
add eax, [edi + e820entry.size.lo]
|
||||||
jnc @f
|
jnc @f
|
||||||
.overflow:
|
.overflow:
|
||||||
mov eax, 0xFFFFF000
|
mov eax, -PAGE_SIZE
|
||||||
@@:
|
@@:
|
||||||
cmp edx, eax
|
cmp edx, eax
|
||||||
jae @f
|
jae @f
|
||||||
@ -103,20 +103,20 @@ proc init_mem
|
|||||||
shr edx, 3
|
shr edx, 3
|
||||||
mov [pg_data.pagemap_size - OS_BASE], edx
|
mov [pg_data.pagemap_size - OS_BASE], edx
|
||||||
|
|
||||||
add edx, (sys_pgmap - OS_BASE)+4095
|
add edx, (sys_pgmap - OS_BASE)+PAGE_SIZE-1
|
||||||
and edx, not 4095
|
and edx, -PAGE_SIZE
|
||||||
mov [tmp_page_tabs], edx
|
mov [tmp_page_tabs], edx
|
||||||
|
|
||||||
mov edx, esi
|
mov edx, esi
|
||||||
and edx, -1024
|
and edx, -1024
|
||||||
cmp edx, (OS_BASE/4096)
|
cmp edx, (OS_BASE/PAGE_SIZE)
|
||||||
jbe @F
|
jbe @F
|
||||||
mov edx, (OS_BASE/4096)
|
mov edx, (OS_BASE/PAGE_SIZE)
|
||||||
jmp .set
|
jmp .set
|
||||||
@@:
|
@@:
|
||||||
cmp edx, (HEAP_BASE - OS_BASE + HEAP_MIN_SIZE)/4096
|
cmp edx, (HEAP_BASE - OS_BASE + HEAP_MIN_SIZE)/PAGE_SIZE
|
||||||
jae .set
|
jae .set
|
||||||
mov edx, (HEAP_BASE - OS_BASE + HEAP_MIN_SIZE)/4096
|
mov edx, (HEAP_BASE - OS_BASE + HEAP_MIN_SIZE)/PAGE_SIZE
|
||||||
.set:
|
.set:
|
||||||
mov [pg_data.kernel_pages - OS_BASE], edx
|
mov [pg_data.kernel_pages - OS_BASE], edx
|
||||||
shr edx, 10
|
shr edx, 10
|
||||||
@ -124,11 +124,11 @@ proc init_mem
|
|||||||
|
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
mov edi, sys_proc - OS_BASE
|
mov edi, sys_proc - OS_BASE
|
||||||
mov ecx, 8192/4
|
mov ecx, 2*PAGE_SIZE/4
|
||||||
cld
|
cld
|
||||||
rep stosd
|
rep stosd
|
||||||
|
|
||||||
mov edx, (sys_proc - OS_BASE + PROC.pdt_0) + 0x800; (OS_BASE shr 20)
|
mov edx, (sys_proc - OS_BASE + PROC.pdt_0) + (OS_BASE shr 20)
|
||||||
bt [cpu_caps - OS_BASE], CAPS_PSE
|
bt [cpu_caps - OS_BASE], CAPS_PSE
|
||||||
jnc .no_PSE
|
jnc .no_PSE
|
||||||
|
|
||||||
@ -151,7 +151,7 @@ proc init_mem
|
|||||||
mov edi, [tmp_page_tabs]
|
mov edi, [tmp_page_tabs]
|
||||||
@@: ;
|
@@: ;
|
||||||
stosd
|
stosd
|
||||||
add eax, 0x1000
|
add eax, PAGE_SIZE
|
||||||
dec ecx
|
dec ecx
|
||||||
jnz @B
|
jnz @B
|
||||||
|
|
||||||
@ -168,7 +168,7 @@ proc init_mem
|
|||||||
|
|
||||||
.map_kernel_tabs:
|
.map_kernel_tabs:
|
||||||
stosd
|
stosd
|
||||||
add eax, 0x1000
|
add eax, PAGE_SIZE
|
||||||
dec ecx
|
dec ecx
|
||||||
jnz .map_kernel_tabs
|
jnz .map_kernel_tabs
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user