From 4c9dc158c881b7e3902f7f4a257428bbb7275f83 Mon Sep 17 00:00:00 2001 From: "Sergey Semyonov (Serge)" Date: Thu, 15 Mar 2007 18:07:22 +0000 Subject: [PATCH] memory layout git-svn-id: svn://kolibrios.org@418 a494cfbc-eb01-0410-851d-a64ba20cac60 --- kernel/branches/flat_kernel/const.inc | 10 ++++---- kernel/branches/flat_kernel/core/memory.inc | 7 +++++- kernel/branches/flat_kernel/core/taskman.inc | 25 +++++++++----------- 3 files changed, 23 insertions(+), 19 deletions(-) diff --git a/kernel/branches/flat_kernel/const.inc b/kernel/branches/flat_kernel/const.inc index 0864ee0209..26ef5c6e13 100644 --- a/kernel/branches/flat_kernel/const.inc +++ b/kernel/branches/flat_kernel/const.inc @@ -259,11 +259,13 @@ tmp_page_tab equ 0x98B000; draw_data+sizeof(drw_data) HEAP_BASE equ (OS_BASE+tmp_page_tab) -LFB_BASE equ 0xFE000000 -page_tabs equ 0x7FC00000 -master_tab equ 0x7FDFF000 -app_page_tabs equ 0x7FC00000 ;0x7FE00000 +page_tabs equ 0xFDC00000 +app_page_tabs equ 0xFDC00000 +kernel_tabs equ (page_tabs+ (OS_BASE shr 10)) ;0xFDE00000 +master_tab equ (page_tabs+ (page_tabs shr 10)) ;0xFDFF70000 + +LFB_BASE equ 0xFE000000 sys_pgdir equ (OS_BASE+0x00050000) sys_pgmap equ (OS_BASE+0x00052000) diff --git a/kernel/branches/flat_kernel/core/memory.inc b/kernel/branches/flat_kernel/core/memory.inc index dbead4aeb6..3f458ddf4c 100644 --- a/kernel/branches/flat_kernel/core/memory.inc +++ b/kernel/branches/flat_kernel/core/memory.inc @@ -448,8 +448,13 @@ get_pg_addr: and eax, 0xFFFFF000 ret + align 4 proc page_fault_handler + + .err_code equ ebp+32 + .err_addr equ ebp-4 + pushad push eax @@ -472,7 +477,7 @@ proc page_fault_handler inc [pg_data.pages_faults] - mov ebx, [ebp-4] + mov ebx, [.err_addr] cmp ebx, 0x80000000 jae .kernel_space diff --git a/kernel/branches/flat_kernel/core/taskman.inc b/kernel/branches/flat_kernel/core/taskman.inc index 68d1b12903..7d519764c4 100644 --- a/kernel/branches/flat_kernel/core/taskman.inc +++ b/kernel/branches/flat_kernel/core/taskman.inc @@ -147,9 +147,6 @@ proc fs_execute cmp eax, 0 jne .wait_lock -; pushfd -; cli - call set_application_table_status call get_new_process_place @@ -389,20 +386,20 @@ proc create_app_space stdcall, app_size:dword,img_base:dword,img_size:dword stdcall map_page,[tmp_task_pdir],eax,dword PG_SW mov edi, [tmp_task_pdir] - mov ecx, (page_tabs shr 20)/4 + mov ecx, (OS_BASE shr 20)/4 xor eax, eax + cld rep stosd - mov eax, [dir_addr] - or eax, PG_SW - stosd - - mov esi, sys_pgdir+(OS_BASE shr 20) mov ecx, (OS_BASE shr 20)/4 - cld + mov esi, sys_pgdir+(OS_BASE shr 20) rep movsd mov eax, [dir_addr] + or eax, PG_SW + mov [edi-4096+(page_tabs shr 20)], eax + + and eax, -4096 call set_cr3 mov edx, [app_tabs] @@ -551,7 +548,7 @@ proc destroy_app_space stdcall, pg_dir:dword and eax, not 0xFFF stdcall map_page,[tmp_task_pdir],eax,dword PG_SW mov esi, [tmp_task_pdir] - mov edi, (page_tabs shr 20)/4 + mov edi, (OS_BASE shr 20)/4 .destroy: mov eax, [esi] test eax, 1 @@ -942,10 +939,10 @@ proc set_app_params stdcall,slot:dword, params:dword,\ pl0_stack dd ? endl - stdcall kernel_alloc, 0x2000 + stdcall kernel_alloc, RING0_STACK_SIZE+512 mov [pl0_stack], eax - lea edi, [eax+0x2000-512] + lea edi, [eax+RING0_STACK_SIZE] mov eax, [slot] mov ebx, eax @@ -1070,7 +1067,7 @@ proc set_app_params stdcall,slot:dword, params:dword,\ mov [edi+TSS._io],word 128 mov [edi+TSS._ss0], os_data mov ebx, [pl0_stack] - add ebx, 0x2000-512 + add ebx, RING0_STACK_SIZE mov [edi+TSS._esp0],ebx mov ecx, edi ;ecx - address of application TSS