1/* 2** Copyright 2003, Axel D�fler, axeld@pinc-software.de. All rights reserved. 3** Distributed under the terms of the OpenBeOS License. 4*/ 5 6#define FUNCTION(x) .global x; .type x,@function; x 7 8.text 9 10/* uint32 get_sdr1(void); 11 */ 12FUNCTION(get_sdr1): 13 mfsdr1 %r3 14 blr 15 16/* void set_sdr1(uint32 value); 17 * r3 18 */ 19FUNCTION(set_sdr1): 20 mtsdr1 %r3 21 blr 22 23/* uint32 get_sr(void *virtualAddress); 24 * r3 25 */ 26FUNCTION(get_sr): 27 mfsrin %r3, %r3 28 blr 29 30/* void set_sr(void *virtualAddress, uint32 value); 31 * r3 r4 32 */ 33FUNCTION(set_sr): 34 mtsrin %r4, %r3 35 blr 36 37/* uint32 get_msr(void); 38 */ 39FUNCTION(get_msr): 40 mfmsr %r3 41 blr 42 43/* uint32 set_msr(uint32 value); 44 * r3 45 */ 46FUNCTION(set_msr): 47 mtmsr %r3 48 blr 49 50/* uint32 get_pvr(void); 51 */ 52FUNCTION(get_pvr): 53 mfpvr %r3 54 blr 55 56 57#define get_ibat(num) \ 58 mfibatu %r4, num; \ 59 stw %r4, 0(%r3); \ 60 mfibatl %r4, num; \ 61 stw %r4, 4(%r3); \ 62 63#define set_ibat(num); \ 64 lwz %r4, 0(%r3); \ 65 mtibatu num, %r4; \ 66 lwz %r4, 4(%r3); \ 67 mtibatl num, %r4; 68 69/* void get_ibat0-3(block_address_translation *bat); 70 * r3 71 */ 72FUNCTION(get_ibat0): 73 get_ibat(0) 74 blr 75FUNCTION(get_ibat1): 76 get_ibat(1) 77 blr 78FUNCTION(get_ibat2): 79 get_ibat(2) 80 blr 81FUNCTION(get_ibat3): 82 get_ibat(3) 83 blr 84 85/* void set_ibat0-3(block_address_translation *bat); 86 * r3 87 */ 88FUNCTION(set_ibat0): 89 set_ibat(0) 90 blr 91FUNCTION(set_ibat1): 92 set_ibat(1) 93 blr 94FUNCTION(set_ibat2): 95 set_ibat(2) 96 blr 97FUNCTION(set_ibat3): 98 set_ibat(3) 99 blr 100 101/* void reset_ibats(void) 102 */ 103FUNCTION(reset_ibats): 104 li %r3, 0 105 mtibatu 0, %r3 106 mtibatl 0, %r3 107 mtibatu 1, %r3 108 mtibatl 1, %r3 109 mtibatu 2, %r3 110 mtibatl 2, %r3 111 mtibatu 3, %r3 112 mtibatl 3, %r3 113 blr 114 115#define get_dbat(num) \ 116 mfdbatu %r4, num; \ 117 stw %r4, 0(%r3); \ 118 mfdbatl %r4, num; \ 119 stw %r4, 4(%r3); 120 121#define set_dbat(num) \ 122 lwz %r4, 0(%r3); \ 123 mtdbatu num, %r4; \ 124 lwz %r4, 4(%r3); \ 125 mtdbatl num, %r4; 126 127/* void get_dbat0-3(block_address_translation *bat); 128 * r3 129 */ 130FUNCTION(get_dbat0): 131 get_dbat(0) 132 blr 133FUNCTION(get_dbat1): 134 get_dbat(1) 135 blr 136FUNCTION(get_dbat2): 137 get_dbat(2) 138 blr 139FUNCTION(get_dbat3): 140 get_dbat(3) 141 blr 142 143/* void set_dbat0-3(block_address_translation *bat); 144 * r3 145 */ 146FUNCTION(set_dbat0): 147 set_dbat(0) 148 blr 149FUNCTION(set_dbat1): 150 set_dbat(1) 151 blr 152FUNCTION(set_dbat2): 153 set_dbat(2) 154 blr 155FUNCTION(set_dbat3): 156 set_dbat(3) 157 blr 158 159/* void reset_dbats(void) 160 */ 161FUNCTION(reset_dbats): 162 li %r3, 0 163 mtdbatu 0, %r3 164 mtdbatl 0, %r3 165 mtdbatu 1, %r3 166 mtdbatl 1, %r3 167 mtdbatu 2, %r3 168 mtdbatl 2, %r3 169 mtdbatu 3, %r3 170 mtdbatl 3, %r3 171 blr 172 173/* void __eieio(void) 174 */ 175FUNCTION(__eieio): 176 eieio 177 blr 178 179