xref: /haiku/src/system/kernel/arch/arm/arch_vm.cpp (revision 1e60bdeab63fa7a57bc9a55b032052e95a18bd2c)
1 /*
2  * Copyright 2007, François Revol, revol@free.fr.
3  * Distributed under the terms of the MIT License.
4  *
5  * Copyright 2003-2005, Axel Dörfler, axeld@pinc-software.de.
6  * Distributed under the terms of the MIT License.
7  *
8  * Copyright 2001, Travis Geiselbrecht. All rights reserved.
9  * Distributed under the terms of the NewOS License.
10  */
11 
12 
13 #include <KernelExport.h>
14 
15 #include <kernel.h>
16 #include <boot/kernel_args.h>
17 
18 #include <vm/vm.h>
19 #include <vm/vm_types.h>
20 #include <arch/vm.h>
21 //#include <arch_mmu.h>
22 
23 
24 //#define TRACE_ARCH_VM
25 #ifdef TRACE_ARCH_VM
26 #	define TRACE(x) dprintf x
27 #else
28 #	define TRACE(x) ;
29 #endif
30 
31 
32 status_t
33 arch_vm_init(kernel_args *args)
34 {
35 	TRACE(("arch_vm_init: entry\n"));
36 	return B_OK;
37 }
38 
39 
40 status_t
41 arch_vm_init2(kernel_args *args)
42 {
43 	return B_OK;
44 }
45 
46 
47 status_t
48 arch_vm_init_post_area(kernel_args *args)
49 {
50 	TRACE(("arch_vm_init_post_area: entry\n"));
51 	return B_OK;
52 }
53 
54 
55 status_t
56 arch_vm_init_end(kernel_args *args)
57 {
58 	// Throw away all mappings that are unused by the kernel
59 	vm_free_unused_boot_loader_range(KERNEL_LOAD_BASE, KERNEL_SIZE);
60 
61 	return B_OK;
62 }
63 
64 
65 status_t
66 arch_vm_init_post_modules(kernel_args *args)
67 {
68 	return B_OK;
69 }
70 
71 
72 void
73 arch_vm_aspace_swap(struct VMAddressSpace *from, struct VMAddressSpace *to)
74 {
75 	// This functions is only invoked when a userland thread is in the process
76 	// of dying. It switches to the kernel team and does whatever cleanup is
77 	// necessary (in case it is the team's main thread, it will delete the
78 	// team).
79 	// It is however not necessary to change the page directory. Userland team's
80 	// page directories include all kernel mappings as well. Furthermore our
81 	// arch specific translation map data objects are ref-counted, so they won't
82 	// go away as long as they are still used on any CPU.
83 }
84 
85 
86 bool
87 arch_vm_supports_protection(uint32 protection)
88 {
89 	// TODO check ARM protection possibilities
90 	return true;
91 }
92 
93 
94 void
95 arch_vm_unset_memory_type(VMArea *area)
96 {
97 	// TODO
98 }
99 
100 
101 status_t
102 arch_vm_set_memory_type(VMArea *area, phys_addr_t physicalBase, uint32 type)
103 {
104 	if (type != 0)
105 		dprintf("%s: undefined type %lx!\n", __PRETTY_FUNCTION__, type);
106 
107 	return B_OK;
108 }
109