headers/bsd: Add sys/queue.h.
[haiku.git] / src / system / kernel / arch / m68k / arch_vm.cpp
blob45ad9792a220ed21e6fafcefd72b7cd22b1ac217
1 /*
2 * Copyright 2007, François Revol, revol@free.fr.
3 * Distributed under the terms of the MIT License.
5 * Copyright 2003-2005, Axel Dörfler, axeld@pinc-software.de.
6 * Distributed under the terms of the MIT License.
8 * Copyright 2001, Travis Geiselbrecht. All rights reserved.
9 * Distributed under the terms of the NewOS License.
12 #include <KernelExport.h>
14 #include <kernel.h>
15 #include <boot/kernel_args.h>
17 #include <vm/vm.h>
18 #include <vm/vm_types.h>
19 #include <vm/VMAddressSpace.h>
20 #include <arch/vm.h>
21 #include <arch_mmu.h>
24 //#define TRACE_ARCH_VM
25 #ifdef TRACE_ARCH_VM
26 # define TRACE(x) dprintf x
27 #else
28 # define TRACE(x) ;
29 #endif
31 #warning M68K: WRITEME
33 status_t
34 arch_vm_init(kernel_args *args)
36 return B_OK;
40 status_t
41 arch_vm_init2(kernel_args *args)
43 // int bats[8];
44 // int i;
46 /**/
47 #warning M68K: disable TT0 and TT1, set up pmmu
49 return B_OK;
53 status_t
54 arch_vm_init_post_area(kernel_args *args)
56 return B_OK;
60 status_t
61 arch_vm_init_end(kernel_args *args)
63 #if 0
64 TRACE(("arch_vm_init_end(): %lu virtual ranges to keep:\n",
65 args->arch_args.num_virtual_ranges_to_keep));
67 for (int i = 0; i < (int)args->arch_args.num_virtual_ranges_to_keep; i++) {
68 addr_range &range = args->arch_args.virtual_ranges_to_keep[i];
70 TRACE((" start: %p, size: 0x%lx\n", (void*)range.start, range.size));
72 // skip ranges outside the kernel address space
73 if (!IS_KERNEL_ADDRESS(range.start)) {
74 TRACE((" no kernel address, skipping...\n"));
75 continue;
78 void *address = (void*)range.start;
79 area_id area = create_area("boot loader reserved area", &address,
80 B_EXACT_ADDRESS, range.size, B_ALREADY_WIRED,
81 B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA);
82 if (area < 0) {
83 panic("arch_vm_init_end(): Failed to create area for boot loader "
84 "reserved area: %p - %p\n", (void*)range.start,
85 (void*)(range.start + range.size));
89 // Throw away any address space mappings we've inherited from the boot
90 // loader and have not yet turned into an area.
91 vm_free_unused_boot_loader_range(0, 0xffffffff - B_PAGE_SIZE + 1);
92 #endif
94 #warning M68K: unset TT0 now
95 return B_OK;
99 status_t
100 arch_vm_init_post_modules(kernel_args *args)
102 return B_OK;
106 void
107 arch_vm_aspace_swap(struct VMAddressSpace *from, struct VMAddressSpace *to)
109 // This functions is only invoked when a userland thread is in the process
110 // of dying. It switches to the kernel team and does whatever cleanup is
111 // necessary (in case it is the team's main thread, it will delete the
112 // team).
113 // It is however not necessary to change the page directory. Userland team's
114 // page directories include all kernel mappings as well. Furthermore our
115 // arch specific translation map data objects are ref-counted, so they won't
116 // go away as long as they are still used on any CPU.
120 bool
121 arch_vm_supports_protection(uint32 protection)
123 return true;
127 void
128 arch_vm_unset_memory_type(VMArea *area)
133 status_t
134 arch_vm_set_memory_type(VMArea *area, addr_t physicalBase, uint32 type)
136 if (type == 0)
137 return B_OK;
139 return B_ERROR;