diff --git a/kernel/trunk/core/heap.inc b/kernel/trunk/core/heap.inc index abf1c36709..907fae6a99 100644 --- a/kernel/trunk/core/heap.inc +++ b/kernel/trunk/core/heap.inc @@ -129,15 +129,11 @@ proc init_kernel_heap loop @B stdcall alloc_pages, dword 32 + + or eax, PG_SW + mov ebx, HEAP_BASE mov ecx, 32 - mov edx, eax - mov edi, HEAP_BASE -.l1: - stdcall map_page, edi, edx, PG_SW - add edi, 0x1000 - add edx, 0x1000 - dec ecx - jnz .l1 + call commit_pages mov edi, HEAP_BASE ;descriptors mov ebx, HEAP_BASE+sizeof.MEM_BLOCK ;free space @@ -480,46 +476,39 @@ proc kernel_alloc stdcall, size:dword mov [pages_count], ebx stdcall alloc_kernel_space, eax + mov [lin_addr], eax + mov ebx, [pages_count] test eax, eax jz .err - mov [lin_addr], eax - mov ecx, [pages_count] mov edx, eax - mov ebx, ecx - shr ecx, 3 - jz .next + shr ebx, 3 + jz .tail - and ebx, not 7 - push ebx + shl ebx, 3 stdcall alloc_pages, ebx - pop ecx ; yes ecx!!! - and eax, eax + test eax, eax jz .err - mov edi, eax - mov edx, [lin_addr] -@@: - stdcall map_page, edx, edi, dword PG_SW - add edx, 0x1000 - add edi, 0x1000 - dec ecx - jnz @B -.next: - mov ecx, [pages_count] - and ecx, 7 + mov ecx, ebx + or eax, PG_SW + mov ebx, [lin_addr] + call commit_pages + + mov edx, ebx ; this dirty hack +.tail: + mov ebx, [pages_count] + and ebx, 7 jz .end @@: - push ecx call alloc_page - pop ecx test eax, eax jz .err stdcall map_page, edx, eax, dword PG_SW add edx, 0x1000 - dec ecx + dec ebx jnz @B .end: mov eax, [lin_addr] diff --git a/kernel/trunk/core/memory.inc b/kernel/trunk/core/memory.inc index 36a15a10fd..1df7f98444 100644 --- a/kernel/trunk/core/memory.inc +++ b/kernel/trunk/core/memory.inc @@ -123,19 +123,19 @@ proc alloc_pages stdcall, count:dword endp align 4 -proc map_page stdcall,lin_addr:dword,phis_addr:dword,flags:dword +;proc map_page stdcall,lin_addr:dword,phis_addr:dword,flags:dword +map_page: push ebx - mov eax, [phis_addr] + mov eax, [esp+12] ; phis_addr and eax, not 0xFFF - or eax, [flags] - mov ebx, [lin_addr] + or eax, [esp+16] ; flags + mov ebx, [esp+8] ; lin_addr shr ebx, 12 mov [page_tabs+ebx*4], eax - mov eax, [lin_addr] - invlpg [eax] + mov eax, [esp+8] ; lin_addr pop ebx - ret -endp + invlpg [eax] + ret 12 align 4 map_space: ;not implemented diff --git a/kernel/trunk/core/taskman.inc b/kernel/trunk/core/taskman.inc index 1e7731bbdf..3c43a8f276 100644 --- a/kernel/trunk/core/taskman.inc +++ b/kernel/trunk/core/taskman.inc @@ -517,6 +517,7 @@ end if add edi, page_tabs .remap: lodsd + and eax, 0xFFFFF000 or eax, ebx; force user level r/w access stosd add edx, 0x1000 diff --git a/kernel/trunk/gui/mouse.inc b/kernel/trunk/gui/mouse.inc index 227b4d17aa..33207f72cf 100644 --- a/kernel/trunk/gui/mouse.inc +++ b/kernel/trunk/gui/mouse.inc @@ -523,9 +523,6 @@ mouse._.find_sys_window_under_cursor: ;//////////////////////////////////////// ;< esi = process slot ;< edi = pointer to WDATA struct ;------------------------------------------------------------------------------ -; mov esi, [Screen_Max_X] -; inc esi -; imul esi, [mouse.state.pos.y] mov esi, [mouse.state.pos.y] mov esi, [d_width_calc_area + esi*4] diff --git a/kernel/trunk/gui/window.inc b/kernel/trunk/gui/window.inc index 7ab0659f83..bd6b82c2c8 100644 --- a/kernel/trunk/gui/window.inc +++ b/kernel/trunk/gui/window.inc @@ -1881,12 +1881,7 @@ align 4 ; get WinMap start push esi -; mov edi, [Screen_Max_X] -; inc edi -; mov esi, edi - mov esi, [Screen_Max_X] - inc esi -; imul edi, ebx + mov esi, [_display.width] mov edi, [d_width_calc_area + ebx*4] add edi, eax @@ -1929,9 +1924,6 @@ align 4 ; get WinMap start -> ebp push eax -; mov eax, [Screen_Max_X] ; screen_sx -; inc eax -; imul eax, ebx mov eax, [d_width_calc_area + ebx*4] add eax, [esp]