From cc2baba95dc11ae9e049dc1c283474ecde910e84 Mon Sep 17 00:00:00 2001 From: "Sergey Semyonov (Serge)" Date: Thu, 21 Nov 2013 09:59:47 +0000 Subject: [PATCH] kolibri-acpi:prerequisites for user-defined framebuffers, indirect rendering, page flipping, etc git-svn-id: svn://kolibrios.org@4269 a494cfbc-eb01-0410-851d-a64ba20cac60 --- kernel/branches/Kolibri-acpi/const.inc | 6 +- kernel/branches/Kolibri-acpi/core/memory.inc | 74 ++++++-------------- 2 files changed, 27 insertions(+), 53 deletions(-) diff --git a/kernel/branches/Kolibri-acpi/const.inc b/kernel/branches/Kolibri-acpi/const.inc index 443a693fd7..a6607227df 100644 --- a/kernel/branches/Kolibri-acpi/const.inc +++ b/kernel/branches/Kolibri-acpi/const.inc @@ -221,6 +221,10 @@ TASK_ACTIVATE equ (OS_BASE+0x000FF01) TMP_STACK_TOP equ 0x006CC00 sys_pgdir equ (OS_BASE+0x006F000) +lfb_pd_0 equ (OS_BASE+0x0070000) +lfb_pd_1 equ (OS_BASE+0x0071000) +lfb_pd_2 equ (OS_BASE+0x0072000) +lfb_pd_3 equ (OS_BASE+0x0073000) SLOT_BASE equ (OS_BASE+0x0080000) @@ -248,7 +252,7 @@ kernel_tabs equ (page_tabs+ (OS_BASE shr 10)) ;0xFDE00000 master_tab equ (page_tabs+ (page_tabs shr 10)) ;0xFDFF70000 LFB_BASE equ 0xFE000000 - +LFB_SIZE equ 12*1024*1024 new_app_base equ 0; diff --git a/kernel/branches/Kolibri-acpi/core/memory.inc b/kernel/branches/Kolibri-acpi/core/memory.inc index 6fa719d0f9..b2f50daaa2 100644 --- a/kernel/branches/Kolibri-acpi/core/memory.inc +++ b/kernel/branches/Kolibri-acpi/core/memory.inc @@ -351,10 +351,8 @@ proc map_page_table stdcall, lin_addr:dword, phis_addr:dword endp align 4 -proc init_LFB - locals - pg_count dd ? - endl +init_LFB: + xchg bx, bx cmp dword [LFBAddress], -1 jne @f @@ -383,61 +381,33 @@ proc init_LFB @@: call init_mtrr - mov edx, LFB_BASE - mov esi, [LFBAddress] - mov edi, 0x00C00000 - mov dword [exp_lfb+4], edx - - shr edi, 12 - mov [pg_count], edi - shr edi, 10 - - bt [cpu_caps], CAPS_PSE - jnc .map_page_tables - or esi, PG_LARGE+PG_UW - mov edx, sys_pgdir+(LFB_BASE shr 20) -@@: - mov [edx], esi - add edx, 4 - add esi, 0x00400000 - dec edi - jnz @B - - bt [cpu_caps], CAPS_PGE - jnc @F - or dword [sys_pgdir+(LFB_BASE shr 20)], PG_GLOBAL -@@: - mov dword [LFBAddress], LFB_BASE - mov eax, cr3 ;flush TLB - mov cr3, eax - ret - -.map_page_tables: - -@@: - call alloc_page - stdcall map_page_table, edx, eax - add edx, 0x00400000 - dec edi - jnz @B - + xor edx, edx mov eax, [LFBAddress] - mov edi, page_tabs + (LFB_BASE shr 10) - or eax, PG_UW - mov ecx, [pg_count] - cld -@@: + bt [cpu_caps], CAPS_PGE + setc dh ;eliminate branch and + mov ecx, LFB_SIZE/4096 + mov edi, lfb_pd_0 + lea eax, [eax+edx+PG_UW] ;set PG_GLOBAL if supported + +.map_pte: stosd add eax, 0x1000 - dec ecx - jnz @B + loop .map_pte + mov ecx, (LFB_SIZE/4096)/1024 + mov edi, sys_pgdir+(LFB_BASE shr 20) + lea eax, [(lfb_pd_0-OS_BASE)+PG_UW] + +.map_pde: + stosd + add eax, 0x1000 + loop .map_pde + + mov dword [exp_lfb+4], LFB_BASE mov dword [LFBAddress], LFB_BASE - mov eax, cr3 ;flush TLB + mov eax, cr3 ;flush TLB mov cr3, eax - ret -endp align 4 proc new_mem_resize stdcall, new_size:dword