1 /* 2 * Copyright 2003-2005, Axel Dörfler, axeld@pinc-software.de. 3 * Distributed under the terms of the MIT License. 4 * 5 * Copyright 2001, Travis Geiselbrecht. All rights reserved. 6 * Distributed under the terms of the NewOS License. 7 */ 8 9 10 #include <kernel.h> 11 #include <boot/kernel_args.h> 12 13 #include <arch/vm.h> 14 #include <arch_mmu.h> 15 16 17 status_t 18 arch_vm_init(kernel_args *args) 19 { 20 return B_OK; 21 } 22 23 24 status_t 25 arch_vm_init2(kernel_args *args) 26 { 27 // int bats[8]; 28 // int i; 29 30 #if 0 31 // print out any bat mappings 32 getibats(bats); 33 dprintf("ibats:\n"); 34 for(i = 0; i < 4; i++) 35 dprintf("0x%x 0x%x\n", bats[i*2], bats[i*2+1]); 36 getdbats(bats); 37 dprintf("dbats:\n"); 38 for(i = 0; i < 4; i++) 39 dprintf("0x%x 0x%x\n", bats[i*2], bats[i*2+1]); 40 #endif 41 42 #if 1 43 // turn off the first 2 BAT mappings (3 & 4 are used by the lower level code) 44 block_address_translation bat; 45 bat.Clear(); 46 47 set_ibat0(&bat); 48 set_ibat1(&bat); 49 set_dbat0(&bat); 50 set_dbat1(&bat); 51 /* getibats(bats); 52 memset(bats, 0, 2 * 2); 53 setibats(bats); 54 getdbats(bats); 55 memset(bats, 0, 2 * 2); 56 setdbats(bats); 57 */ 58 #endif 59 #if 0 60 // just clear the first BAT mapping (0 - 256MB) 61 dprintf("msr 0x%x\n", getmsr()); 62 { 63 unsigned int reg; 64 asm("mr %0,1" : "=r"(reg)); 65 dprintf("sp 0x%x\n", reg); 66 } 67 dprintf("ka %p\n", ka); 68 69 getibats(bats); 70 dprintf("ibats:\n"); 71 for(i = 0; i < 4; i++) 72 dprintf("0x%x 0x%x\n", bats[i*2], bats[i*2+1]); 73 bats[0] = bats[1] = 0; 74 setibats(bats); 75 getdbats(bats); 76 dprintf("dbats:\n"); 77 for(i = 0; i < 4; i++) 78 dprintf("0x%x 0x%x\n", bats[i*2], bats[i*2+1]); 79 bats[0] = bats[1] = 0; 80 setdbats(bats); 81 #endif 82 return B_OK; 83 } 84 85 86 status_t 87 arch_vm_init_post_area(kernel_args *args) 88 { 89 return B_OK; 90 } 91 92 93 status_t 94 arch_vm_init_end(kernel_args *args) 95 { 96 // throw away anything in the kernel_args.pgtable[] that's not yet mapped 97 //vm_free_unused_boot_loader_range(KERNEL_BASE, 0x400000 * args->arch_args.num_pgtables); 98 99 return B_OK; 100 } 101 102 103 void 104 arch_vm_aspace_swap(vm_address_space *aspace) 105 { 106 } 107 108 109 bool 110 arch_vm_supports_protection(uint32 protection) 111 { 112 return true; 113 } 114 115 116 void 117 arch_vm_init_area(vm_area *area) 118 { 119 } 120 121 122 void 123 arch_vm_unset_memory_type(vm_area *area) 124 { 125 } 126 127 128 status_t 129 arch_vm_set_memory_type(vm_area *area, uint32 type) 130 { 131 if (type == 0) 132 return B_OK; 133 134 return B_ERROR; 135 } 136