mirror of
https://github.com/hermitcore/libhermit.git
synced 2025-03-09 00:00:03 +01:00
map physical memory address of the graphic adapter
This commit is contained in:
parent
449824349b
commit
7ab3648814
2 changed files with 21 additions and 1 deletions
|
@ -85,6 +85,7 @@ align 4
|
|||
heap_start_address dq 0
|
||||
header_start_address dq 0
|
||||
disable_x2apic dd 1
|
||||
single_kernel dd 1
|
||||
|
||||
; Bootstrap page tables are used during the initialization.
|
||||
align 4096
|
||||
|
@ -122,8 +123,8 @@ start64:
|
|||
mov rax, kernel_end
|
||||
sub rax, kernel_start
|
||||
mov QWORD [image_size], rax
|
||||
xor rax, rax
|
||||
|
||||
xor rax, rax
|
||||
mov eax, DWORD [cpu_online]
|
||||
cmp eax, 0
|
||||
jne Lno_pml4_init
|
||||
|
@ -162,6 +163,15 @@ start64:
|
|||
add rax, [base]
|
||||
mov QWORD [rdi+511*8], rax
|
||||
|
||||
; map vga 1:1
|
||||
mov rax, VIDEO_MEM_ADDR ; map vga
|
||||
and rax, ~0xFFF ; page align lower half
|
||||
mov rdi, rax
|
||||
shr rdi, 9 ; (edi >> 12) * 8 (index for boot_pgt)
|
||||
add rdi, boot_pgt
|
||||
or rax, 0x113 ; set present, global, writable and cache disable bits
|
||||
mov QWORD [rdi], rax
|
||||
|
||||
; remap kernel
|
||||
mov rdi, kernel_start
|
||||
shr rdi, 18 ; (edi >> 21) * 8 (index for boot_pgd)
|
||||
|
@ -640,6 +650,11 @@ Lgo3:
|
|||
add rsp, 16
|
||||
iretq
|
||||
|
||||
global is_single_kernel
|
||||
is_single_kernel
|
||||
mov eax, DWORD [single_kernel]
|
||||
ret
|
||||
|
||||
SECTION .data
|
||||
|
||||
align 4096
|
||||
|
|
|
@ -69,6 +69,11 @@ int vma_init(void)
|
|||
if (BUILTIN_EXPECT(ret, 0))
|
||||
goto out;
|
||||
|
||||
// add VGA video memory
|
||||
ret = vma_add(VIDEO_MEM_ADDR, VIDEO_MEM_ADDR + PAGE_SIZE, VMA_READ|VMA_WRITE);
|
||||
if (BUILTIN_EXPECT(ret, 0))
|
||||
goto out;
|
||||
|
||||
out:
|
||||
return ret;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue