/kernel/branches/Kolibri-acpi/const.inc |
---|
685,7 → 685,7 |
height dd ? |
bits_per_pixel dd ? |
vrefresh dd ? |
lfb dd ? |
current_lfb dd ? |
lfb_pitch dd ? |
win_map_lock RWSEM |
/kernel/branches/Kolibri-acpi/core/exports.inc |
---|
56,6 → 56,7 |
\ |
get_display, 'GetDisplay', \ |
set_screen, 'SetScreen', \ |
set_framebuffer, 'SetFramebuffer', \ ; gcc fastcall |
window._.get_rect, 'GetWindowRect', \ ; gcc fastcall |
pci_api_drv, 'PciApi', \ |
pci_read8, 'PciRead8', \ ; stdcall |
/kernel/branches/Kolibri-acpi/core/memory.inc |
---|
405,95 → 405,6 |
endp |
align 4 |
proc init_LFB |
locals |
pg_count dd ? |
endl |
cmp dword [LFBAddress], -1 |
jne @f |
mov [BOOT_VARS+BOOT_MTRR], byte 2 |
; max VGA=640*480*4=1228800 bytes |
; + 32*640*4=81920 bytes for mouse pointer |
stdcall alloc_pages, ((1228800+81920)/4096) |
push eax |
call alloc_page |
stdcall map_page_table, LFB_BASE, eax |
pop eax |
or eax, PG_UWR |
mov ebx, LFB_BASE |
; max VGA=640*480*4=1228800 bytes |
; + 32*640*4=81920 bytes for mouse pointer |
mov ecx, (1228800+81920)/4096 |
call commit_pages |
mov [LFBAddress], dword LFB_BASE |
ret |
@@: |
test [SCR_MODE], word 0100000000000000b |
jnz @f |
mov [BOOT_VARS+BOOT_MTRR], byte 2 |
ret |
@@: |
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, PDE_LARGE+PG_UWR |
mov edx, sys_proc+PROC.pdt_0+(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_proc+PROC.pdt_0+(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 |
mov eax, [LFBAddress] |
mov edi, page_tabs + (LFB_BASE shr 10) |
or eax, PG_GLOBAL+PG_UWR |
and eax, [pte_valid_mask] |
mov ecx, [pg_count] |
cld |
@@: |
stosd |
add eax, 0x1000 |
loop @B |
mov dword [LFBAddress], LFB_BASE |
mov eax, cr3 ;flush TLB |
mov cr3, eax |
ret |
endp |
align 4 |
proc new_mem_resize stdcall, new_size:dword |
push ebx |
/kernel/branches/Kolibri-acpi/kernel.asm |
---|
534,6 → 534,11 |
mov ax, tss0 |
ltr ax |
mov eax, sys_proc |
list_init eax |
add eax, PROC.thr_list |
list_init eax |
call init_video |
call init_mtrr |
mov [LFBAddress], LFB_BASE |
625,14 → 630,9 |
mov esi, boot_setostask |
call boot_log |
mov eax, sys_proc |
lea edi, [eax+PROC.heap_lock] |
mov edi, sys_proc+PROC.heap_lock |
mov ecx, (PROC.ht_free-PROC.heap_lock)/4 |
list_init eax |
add eax, PROC.thr_list |
list_init eax |
xor eax, eax |
cld |
rep stosd |
/kernel/branches/Kolibri-acpi/video/framebuffer.inc |
---|
203,14 → 203,41 |
align 4 |
set_framebuffer: |
mov edx, LFB_BASE shr 22 |
mov eax, [ecx+FRB.pde] |
mov dword [master_tab+edx*4], eax |
mov eax, [ecx+FRB.pde+4] |
mov dword [master_tab+edx*4+4], eax |
mov eax, [ecx+FRB.pde+8] |
mov dword [master_tab+edx*4+8], eax |
mov eax, [ecx+FRB.pde+12] |
mov dword [master_tab+edx*4+12], eax |
push esi |
push edi |
lea esi, [ecx+FRB.pde] |
mov eax, sys_proc |
pushfd |
cli |
mov [_display.current_lfb], ecx |
.patch_pde: |
lea edi, [eax+PROC.pdt_0+4096-32] ;last 8 pd entries up to 32Mb framebuffer |
mov ecx, 8 |
rep movsd ;patch pde |
sub esi, 32 |
mov edi, [eax+PROC.list.next] ;next process/address space |
xchg eax, edi |
cmp eax, edi |
jne .patch_pde |
bt [cpu_caps], CAPS_PGE |
jnc .cr3_flush |
mov eax, cr4 |
btr eax, 7 ;clear cr4.PGE |
mov cr4, eax ;flush TLB |
bts eax, 7 |
mov cr4, eax ;flush TLB |
.exit: |
popfd |
pop edi |
pop esi |
ret |
.cr3_flush: |
mov eax, cr3 |
mov cr3, eax ;flush TLB |
jmp .exit |