First pass at x86_64. Mostly consists of branching i386 stuff over.
[newos.git] / kernel / arch / x86_64 / arch_vm.c
blob3d581c57aab363e262dc53879c89cddb42cf5c1c
1 /*
2 ** Copyright 2001, Travis Geiselbrecht. All rights reserved.
3 ** Distributed under the terms of the NewOS License.
4 */
5 #include <kernel/kernel.h>
6 #include <kernel/console.h>
7 #include <kernel/vm.h>
8 #include <kernel/vm_page.h>
9 #include <kernel/vm_priv.h>
10 #include <kernel/debug.h>
12 #include <kernel/arch/vm.h>
13 #include <kernel/arch/int.h>
14 #include <kernel/arch/cpu.h>
16 #include <kernel/arch/i386/interrupts.h>
18 int arch_vm_init(kernel_args *ka)
20 dprintf("arch_vm_init: entry\n");
21 return 0;
24 int arch_vm_init2(kernel_args *ka)
26 dprintf("arch_vm_init2: entry\n");
28 // account for DMA area and mark the pages unusable
29 vm_mark_page_range_inuse(0x0, 0xa0000 / PAGE_SIZE);
31 return 0;
34 int arch_vm_init_existing_maps(kernel_args *ka)
36 return 0;
39 int arch_vm_init_endvm(kernel_args *ka)
41 region_id id;
42 void *ptr;
44 dprintf("arch_vm_init_endvm: entry\n");
46 // map 0 - 0xa0000 directly
47 id = vm_map_physical_memory(vm_get_kernel_aspace_id(), "dma_region", &ptr,
48 REGION_ADDR_ANY_ADDRESS, 0xa0000, LOCK_RW|LOCK_KERNEL, 0x0);
49 if(id < 0) {
50 panic("arch_vm_init_endvm: unable to map dma region\n");
51 return ERR_NO_MEMORY;
53 return 0;
56 void arch_vm_aspace_swap(vm_address_space *aspace)
58 i386_swap_pgdir(vm_translation_map_get_pgdir(&aspace->translation_map));