Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2 | * Copyright (C) 1995-1999 Gary Thomas, Paul Mackerras, Cort Dougan. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3 | */ |
Kumar Gala | 5f7c690 | 2005-09-09 15:02:25 -0500 | [diff] [blame] | 4 | #ifndef _ASM_POWERPC_PPC_ASM_H |
| 5 | #define _ASM_POWERPC_PPC_ASM_H |
| 6 | |
Tim Abbott | 9203fc9 | 2009-04-27 14:02:24 -0400 | [diff] [blame] | 7 | #include <linux/init.h> |
Paul Mackerras | 40ef8cb | 2005-10-10 22:50:37 +1000 | [diff] [blame] | 8 | #include <linux/stringify.h> |
David Gibson | 3ddfbcf | 2005-11-10 12:56:55 +1100 | [diff] [blame] | 9 | #include <asm/asm-compat.h> |
Michael Neuling | 9c75a31 | 2008-06-26 17:07:48 +1000 | [diff] [blame] | 10 | #include <asm/processor.h> |
Kumar Gala | 16c57b3 | 2009-02-10 20:10:44 +0000 | [diff] [blame] | 11 | #include <asm/ppc-opcode.h> |
Paul Mackerras | cf9efce | 2010-08-26 19:56:43 +0000 | [diff] [blame] | 12 | #include <asm/firmware.h> |
Paul Mackerras | 40ef8cb | 2005-10-10 22:50:37 +1000 | [diff] [blame] | 13 | |
David Gibson | 3ddfbcf | 2005-11-10 12:56:55 +1100 | [diff] [blame] | 14 | #ifndef __ASSEMBLY__ |
| 15 | #error __FILE__ should only be used in assembler files |
| 16 | #else |
| 17 | |
| 18 | #define SZL (BITS_PER_LONG/8) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 19 | |
| 20 | /* |
Paul Mackerras | c6622f6 | 2006-02-24 10:06:59 +1100 | [diff] [blame] | 21 | * Stuff for accurate CPU time accounting. |
| 22 | * These macros handle transitions between user and system state |
| 23 | * in exception entry and exit and accumulate time to the |
| 24 | * user_time and system_time fields in the paca. |
| 25 | */ |
| 26 | |
| 27 | #ifndef CONFIG_VIRT_CPU_ACCOUNTING |
| 28 | #define ACCOUNT_CPU_USER_ENTRY(ra, rb) |
| 29 | #define ACCOUNT_CPU_USER_EXIT(ra, rb) |
Paul Mackerras | cf9efce | 2010-08-26 19:56:43 +0000 | [diff] [blame] | 30 | #define ACCOUNT_STOLEN_TIME |
Paul Mackerras | c6622f6 | 2006-02-24 10:06:59 +1100 | [diff] [blame] | 31 | #else |
| 32 | #define ACCOUNT_CPU_USER_ENTRY(ra, rb) \ |
Paul Mackerras | cf9efce | 2010-08-26 19:56:43 +0000 | [diff] [blame] | 33 | MFTB(ra); /* get timebase */ \ |
| 34 | ld rb,PACA_STARTTIME_USER(r13); \ |
| 35 | std ra,PACA_STARTTIME(r13); \ |
Paul Mackerras | c6622f6 | 2006-02-24 10:06:59 +1100 | [diff] [blame] | 36 | subf rb,rb,ra; /* subtract start value */ \ |
| 37 | ld ra,PACA_USER_TIME(r13); \ |
| 38 | add ra,ra,rb; /* add on to user time */ \ |
| 39 | std ra,PACA_USER_TIME(r13); \ |
Paul Mackerras | c6622f6 | 2006-02-24 10:06:59 +1100 | [diff] [blame] | 40 | |
| 41 | #define ACCOUNT_CPU_USER_EXIT(ra, rb) \ |
Paul Mackerras | cf9efce | 2010-08-26 19:56:43 +0000 | [diff] [blame] | 42 | MFTB(ra); /* get timebase */ \ |
| 43 | ld rb,PACA_STARTTIME(r13); \ |
| 44 | std ra,PACA_STARTTIME_USER(r13); \ |
Paul Mackerras | c6622f6 | 2006-02-24 10:06:59 +1100 | [diff] [blame] | 45 | subf rb,rb,ra; /* subtract start value */ \ |
| 46 | ld ra,PACA_SYSTEM_TIME(r13); \ |
Paul Mackerras | cf9efce | 2010-08-26 19:56:43 +0000 | [diff] [blame] | 47 | add ra,ra,rb; /* add on to system time */ \ |
| 48 | std ra,PACA_SYSTEM_TIME(r13) |
| 49 | |
| 50 | #ifdef CONFIG_PPC_SPLPAR |
| 51 | #define ACCOUNT_STOLEN_TIME \ |
| 52 | BEGIN_FW_FTR_SECTION; \ |
| 53 | beq 33f; \ |
| 54 | /* from user - see if there are any DTL entries to process */ \ |
| 55 | ld r10,PACALPPACAPTR(r13); /* get ptr to VPA */ \ |
| 56 | ld r11,PACA_DTL_RIDX(r13); /* get log read index */ \ |
| 57 | ld r10,LPPACA_DTLIDX(r10); /* get log write index */ \ |
| 58 | cmpd cr1,r11,r10; \ |
| 59 | beq+ cr1,33f; \ |
| 60 | bl .accumulate_stolen_time; \ |
Benjamin Herrenschmidt | 990118c | 2012-03-02 11:01:31 +1100 | [diff] [blame] | 61 | ld r12,_MSR(r1); \ |
| 62 | andi. r10,r12,MSR_PR; /* Restore cr0 (coming from user) */ \ |
Paul Mackerras | cf9efce | 2010-08-26 19:56:43 +0000 | [diff] [blame] | 63 | 33: \ |
| 64 | END_FW_FTR_SECTION_IFSET(FW_FEATURE_SPLPAR) |
| 65 | |
| 66 | #else /* CONFIG_PPC_SPLPAR */ |
| 67 | #define ACCOUNT_STOLEN_TIME |
| 68 | |
| 69 | #endif /* CONFIG_PPC_SPLPAR */ |
| 70 | |
| 71 | #endif /* CONFIG_VIRT_CPU_ACCOUNTING */ |
Paul Mackerras | c6622f6 | 2006-02-24 10:06:59 +1100 | [diff] [blame] | 72 | |
| 73 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 74 | * Macros for storing registers into and loading registers from |
| 75 | * exception frames. |
| 76 | */ |
Kumar Gala | 5f7c690 | 2005-09-09 15:02:25 -0500 | [diff] [blame] | 77 | #ifdef __powerpc64__ |
| 78 | #define SAVE_GPR(n, base) std n,GPR0+8*(n)(base) |
| 79 | #define REST_GPR(n, base) ld n,GPR0+8*(n)(base) |
| 80 | #define SAVE_NVGPRS(base) SAVE_8GPRS(14, base); SAVE_10GPRS(22, base) |
| 81 | #define REST_NVGPRS(base) REST_8GPRS(14, base); REST_10GPRS(22, base) |
| 82 | #else |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 83 | #define SAVE_GPR(n, base) stw n,GPR0+4*(n)(base) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 84 | #define REST_GPR(n, base) lwz n,GPR0+4*(n)(base) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 85 | #define SAVE_NVGPRS(base) SAVE_GPR(13, base); SAVE_8GPRS(14, base); \ |
| 86 | SAVE_10GPRS(22, base) |
| 87 | #define REST_NVGPRS(base) REST_GPR(13, base); REST_8GPRS(14, base); \ |
| 88 | REST_10GPRS(22, base) |
Kumar Gala | 5f7c690 | 2005-09-09 15:02:25 -0500 | [diff] [blame] | 89 | #endif |
| 90 | |
Kumar Gala | 5f7c690 | 2005-09-09 15:02:25 -0500 | [diff] [blame] | 91 | #define SAVE_2GPRS(n, base) SAVE_GPR(n, base); SAVE_GPR(n+1, base) |
| 92 | #define SAVE_4GPRS(n, base) SAVE_2GPRS(n, base); SAVE_2GPRS(n+2, base) |
| 93 | #define SAVE_8GPRS(n, base) SAVE_4GPRS(n, base); SAVE_4GPRS(n+4, base) |
| 94 | #define SAVE_10GPRS(n, base) SAVE_8GPRS(n, base); SAVE_2GPRS(n+8, base) |
| 95 | #define REST_2GPRS(n, base) REST_GPR(n, base); REST_GPR(n+1, base) |
| 96 | #define REST_4GPRS(n, base) REST_2GPRS(n, base); REST_2GPRS(n+2, base) |
| 97 | #define REST_8GPRS(n, base) REST_4GPRS(n, base); REST_4GPRS(n+4, base) |
| 98 | #define REST_10GPRS(n, base) REST_8GPRS(n, base); REST_2GPRS(n+8, base) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 99 | |
Michael Neuling | 9c75a31 | 2008-06-26 17:07:48 +1000 | [diff] [blame] | 100 | #define SAVE_FPR(n, base) stfd n,THREAD_FPR0+8*TS_FPRWIDTH*(n)(base) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 101 | #define SAVE_2FPRS(n, base) SAVE_FPR(n, base); SAVE_FPR(n+1, base) |
| 102 | #define SAVE_4FPRS(n, base) SAVE_2FPRS(n, base); SAVE_2FPRS(n+2, base) |
| 103 | #define SAVE_8FPRS(n, base) SAVE_4FPRS(n, base); SAVE_4FPRS(n+4, base) |
| 104 | #define SAVE_16FPRS(n, base) SAVE_8FPRS(n, base); SAVE_8FPRS(n+8, base) |
| 105 | #define SAVE_32FPRS(n, base) SAVE_16FPRS(n, base); SAVE_16FPRS(n+16, base) |
Michael Neuling | 9c75a31 | 2008-06-26 17:07:48 +1000 | [diff] [blame] | 106 | #define REST_FPR(n, base) lfd n,THREAD_FPR0+8*TS_FPRWIDTH*(n)(base) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 107 | #define REST_2FPRS(n, base) REST_FPR(n, base); REST_FPR(n+1, base) |
| 108 | #define REST_4FPRS(n, base) REST_2FPRS(n, base); REST_2FPRS(n+2, base) |
| 109 | #define REST_8FPRS(n, base) REST_4FPRS(n, base); REST_4FPRS(n+4, base) |
| 110 | #define REST_16FPRS(n, base) REST_8FPRS(n, base); REST_8FPRS(n+8, base) |
| 111 | #define REST_32FPRS(n, base) REST_16FPRS(n, base); REST_16FPRS(n+16, base) |
| 112 | |
Michael Wolf | 23e55f9 | 2009-08-20 13:21:45 +0000 | [diff] [blame] | 113 | #define SAVE_VR(n,b,base) li b,THREAD_VR0+(16*(n)); stvx n,base,b |
Kumar Gala | 5f7c690 | 2005-09-09 15:02:25 -0500 | [diff] [blame] | 114 | #define SAVE_2VRS(n,b,base) SAVE_VR(n,b,base); SAVE_VR(n+1,b,base) |
| 115 | #define SAVE_4VRS(n,b,base) SAVE_2VRS(n,b,base); SAVE_2VRS(n+2,b,base) |
| 116 | #define SAVE_8VRS(n,b,base) SAVE_4VRS(n,b,base); SAVE_4VRS(n+4,b,base) |
| 117 | #define SAVE_16VRS(n,b,base) SAVE_8VRS(n,b,base); SAVE_8VRS(n+8,b,base) |
| 118 | #define SAVE_32VRS(n,b,base) SAVE_16VRS(n,b,base); SAVE_16VRS(n+16,b,base) |
Michael Wolf | 23e55f9 | 2009-08-20 13:21:45 +0000 | [diff] [blame] | 119 | #define REST_VR(n,b,base) li b,THREAD_VR0+(16*(n)); lvx n,base,b |
Kumar Gala | 5f7c690 | 2005-09-09 15:02:25 -0500 | [diff] [blame] | 120 | #define REST_2VRS(n,b,base) REST_VR(n,b,base); REST_VR(n+1,b,base) |
| 121 | #define REST_4VRS(n,b,base) REST_2VRS(n,b,base); REST_2VRS(n+2,b,base) |
| 122 | #define REST_8VRS(n,b,base) REST_4VRS(n,b,base); REST_4VRS(n+4,b,base) |
| 123 | #define REST_16VRS(n,b,base) REST_8VRS(n,b,base); REST_8VRS(n+8,b,base) |
| 124 | #define REST_32VRS(n,b,base) REST_16VRS(n,b,base); REST_16VRS(n+16,b,base) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 125 | |
Michael Neuling | 72ffff5 | 2008-06-25 14:07:18 +1000 | [diff] [blame] | 126 | /* Save the lower 32 VSRs in the thread VSR region */ |
Michael Neuling | 0b7673c | 2012-06-25 13:33:23 +0000 | [diff] [blame] | 127 | #define SAVE_VSR(n,b,base) li b,THREAD_VSR0+(16*(n)); STXVD2X(n,R##base,R##b) |
Michael Neuling | 72ffff5 | 2008-06-25 14:07:18 +1000 | [diff] [blame] | 128 | #define SAVE_2VSRS(n,b,base) SAVE_VSR(n,b,base); SAVE_VSR(n+1,b,base) |
| 129 | #define SAVE_4VSRS(n,b,base) SAVE_2VSRS(n,b,base); SAVE_2VSRS(n+2,b,base) |
| 130 | #define SAVE_8VSRS(n,b,base) SAVE_4VSRS(n,b,base); SAVE_4VSRS(n+4,b,base) |
| 131 | #define SAVE_16VSRS(n,b,base) SAVE_8VSRS(n,b,base); SAVE_8VSRS(n+8,b,base) |
| 132 | #define SAVE_32VSRS(n,b,base) SAVE_16VSRS(n,b,base); SAVE_16VSRS(n+16,b,base) |
Michael Neuling | 0b7673c | 2012-06-25 13:33:23 +0000 | [diff] [blame] | 133 | #define REST_VSR(n,b,base) li b,THREAD_VSR0+(16*(n)); LXVD2X(n,R##base,R##b) |
Michael Neuling | 72ffff5 | 2008-06-25 14:07:18 +1000 | [diff] [blame] | 134 | #define REST_2VSRS(n,b,base) REST_VSR(n,b,base); REST_VSR(n+1,b,base) |
| 135 | #define REST_4VSRS(n,b,base) REST_2VSRS(n,b,base); REST_2VSRS(n+2,b,base) |
| 136 | #define REST_8VSRS(n,b,base) REST_4VSRS(n,b,base); REST_4VSRS(n+4,b,base) |
| 137 | #define REST_16VSRS(n,b,base) REST_8VSRS(n,b,base); REST_8VSRS(n+8,b,base) |
| 138 | #define REST_32VSRS(n,b,base) REST_16VSRS(n,b,base); REST_16VSRS(n+16,b,base) |
| 139 | /* Save the upper 32 VSRs (32-63) in the thread VSX region (0-31) */ |
Michael Neuling | 0b7673c | 2012-06-25 13:33:23 +0000 | [diff] [blame] | 140 | #define SAVE_VSRU(n,b,base) li b,THREAD_VR0+(16*(n)); STXVD2X(n+32,R##base,R##b) |
Michael Neuling | 72ffff5 | 2008-06-25 14:07:18 +1000 | [diff] [blame] | 141 | #define SAVE_2VSRSU(n,b,base) SAVE_VSRU(n,b,base); SAVE_VSRU(n+1,b,base) |
| 142 | #define SAVE_4VSRSU(n,b,base) SAVE_2VSRSU(n,b,base); SAVE_2VSRSU(n+2,b,base) |
| 143 | #define SAVE_8VSRSU(n,b,base) SAVE_4VSRSU(n,b,base); SAVE_4VSRSU(n+4,b,base) |
| 144 | #define SAVE_16VSRSU(n,b,base) SAVE_8VSRSU(n,b,base); SAVE_8VSRSU(n+8,b,base) |
| 145 | #define SAVE_32VSRSU(n,b,base) SAVE_16VSRSU(n,b,base); SAVE_16VSRSU(n+16,b,base) |
Michael Neuling | 0b7673c | 2012-06-25 13:33:23 +0000 | [diff] [blame] | 146 | #define REST_VSRU(n,b,base) li b,THREAD_VR0+(16*(n)); LXVD2X(n+32,R##base,R##b) |
Michael Neuling | 72ffff5 | 2008-06-25 14:07:18 +1000 | [diff] [blame] | 147 | #define REST_2VSRSU(n,b,base) REST_VSRU(n,b,base); REST_VSRU(n+1,b,base) |
| 148 | #define REST_4VSRSU(n,b,base) REST_2VSRSU(n,b,base); REST_2VSRSU(n+2,b,base) |
| 149 | #define REST_8VSRSU(n,b,base) REST_4VSRSU(n,b,base); REST_4VSRSU(n+4,b,base) |
| 150 | #define REST_16VSRSU(n,b,base) REST_8VSRSU(n,b,base); REST_8VSRSU(n+8,b,base) |
| 151 | #define REST_32VSRSU(n,b,base) REST_16VSRSU(n,b,base); REST_16VSRSU(n+16,b,base) |
| 152 | |
Scott Wood | c51584d | 2011-06-14 18:34:27 -0500 | [diff] [blame] | 153 | /* |
| 154 | * b = base register for addressing, o = base offset from register of 1st EVR |
| 155 | * n = first EVR, s = scratch |
| 156 | */ |
| 157 | #define SAVE_EVR(n,s,b,o) evmergehi s,s,n; stw s,o+4*(n)(b) |
| 158 | #define SAVE_2EVRS(n,s,b,o) SAVE_EVR(n,s,b,o); SAVE_EVR(n+1,s,b,o) |
| 159 | #define SAVE_4EVRS(n,s,b,o) SAVE_2EVRS(n,s,b,o); SAVE_2EVRS(n+2,s,b,o) |
| 160 | #define SAVE_8EVRS(n,s,b,o) SAVE_4EVRS(n,s,b,o); SAVE_4EVRS(n+4,s,b,o) |
| 161 | #define SAVE_16EVRS(n,s,b,o) SAVE_8EVRS(n,s,b,o); SAVE_8EVRS(n+8,s,b,o) |
| 162 | #define SAVE_32EVRS(n,s,b,o) SAVE_16EVRS(n,s,b,o); SAVE_16EVRS(n+16,s,b,o) |
| 163 | #define REST_EVR(n,s,b,o) lwz s,o+4*(n)(b); evmergelo n,s,n |
| 164 | #define REST_2EVRS(n,s,b,o) REST_EVR(n,s,b,o); REST_EVR(n+1,s,b,o) |
| 165 | #define REST_4EVRS(n,s,b,o) REST_2EVRS(n,s,b,o); REST_2EVRS(n+2,s,b,o) |
| 166 | #define REST_8EVRS(n,s,b,o) REST_4EVRS(n,s,b,o); REST_4EVRS(n+4,s,b,o) |
| 167 | #define REST_16EVRS(n,s,b,o) REST_8EVRS(n,s,b,o); REST_8EVRS(n+8,s,b,o) |
| 168 | #define REST_32EVRS(n,s,b,o) REST_16EVRS(n,s,b,o); REST_16EVRS(n+16,s,b,o) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 169 | |
Michael Ellerman | 8c71632 | 2005-10-24 15:07:27 +1000 | [diff] [blame] | 170 | /* Macros to adjust thread priority for hardware multithreading */ |
| 171 | #define HMT_VERY_LOW or 31,31,31 # very low priority |
| 172 | #define HMT_LOW or 1,1,1 |
| 173 | #define HMT_MEDIUM_LOW or 6,6,6 # medium low priority |
| 174 | #define HMT_MEDIUM or 2,2,2 |
| 175 | #define HMT_MEDIUM_HIGH or 5,5,5 # medium high priority |
| 176 | #define HMT_HIGH or 3,3,3 |
Benjamin Herrenschmidt | 50fb8eb | 2011-01-12 17:41:28 +1100 | [diff] [blame] | 177 | #define HMT_EXTRA_HIGH or 7,7,7 # power7 only |
Kumar Gala | 5f7c690 | 2005-09-09 15:02:25 -0500 | [diff] [blame] | 178 | |
Michael Neuling | d72be89 | 2012-06-25 13:33:15 +0000 | [diff] [blame] | 179 | #ifdef CONFIG_PPC64 |
| 180 | #define ULONG_SIZE 8 |
| 181 | #else |
| 182 | #define ULONG_SIZE 4 |
| 183 | #endif |
Michael Neuling | 0b7673c | 2012-06-25 13:33:23 +0000 | [diff] [blame] | 184 | #define __VCPU_GPR(n) (VCPU_GPRS + (n * ULONG_SIZE)) |
| 185 | #define VCPU_GPR(n) __VCPU_GPR(__REG_##n) |
Michael Neuling | d72be89 | 2012-06-25 13:33:15 +0000 | [diff] [blame] | 186 | |
Arnd Bergmann | 88ced03 | 2005-12-16 22:43:46 +0100 | [diff] [blame] | 187 | #ifdef __KERNEL__ |
Paul Mackerras | 40ef8cb | 2005-10-10 22:50:37 +1000 | [diff] [blame] | 188 | #ifdef CONFIG_PPC64 |
| 189 | |
Michael Neuling | 44ce6a5 | 2012-06-25 13:33:14 +0000 | [diff] [blame] | 190 | #define STACKFRAMESIZE 256 |
Michael Neuling | 0b7673c | 2012-06-25 13:33:23 +0000 | [diff] [blame] | 191 | #define __STK_REG(i) (112 + ((i)-14)*8) |
| 192 | #define STK_REG(i) __STK_REG(__REG_##i) |
Michael Neuling | 44ce6a5 | 2012-06-25 13:33:14 +0000 | [diff] [blame] | 193 | |
Michael Neuling | 0b7673c | 2012-06-25 13:33:23 +0000 | [diff] [blame] | 194 | #define __STK_PARAM(i) (48 + ((i)-3)*8) |
| 195 | #define STK_PARAM(i) __STK_PARAM(__REG_##i) |
Michael Neuling | 44ce6a5 | 2012-06-25 13:33:14 +0000 | [diff] [blame] | 196 | |
Paul Mackerras | 40ef8cb | 2005-10-10 22:50:37 +1000 | [diff] [blame] | 197 | #define XGLUE(a,b) a##b |
| 198 | #define GLUE(a,b) XGLUE(a,b) |
| 199 | |
| 200 | #define _GLOBAL(name) \ |
| 201 | .section ".text"; \ |
| 202 | .align 2 ; \ |
| 203 | .globl name; \ |
| 204 | .globl GLUE(.,name); \ |
| 205 | .section ".opd","aw"; \ |
| 206 | name: \ |
| 207 | .quad GLUE(.,name); \ |
| 208 | .quad .TOC.@tocbase; \ |
| 209 | .quad 0; \ |
| 210 | .previous; \ |
| 211 | .type GLUE(.,name),@function; \ |
| 212 | GLUE(.,name): |
| 213 | |
Stephen Rothwell | fc68e86 | 2007-08-22 13:44:58 +1000 | [diff] [blame] | 214 | #define _INIT_GLOBAL(name) \ |
Tim Abbott | 9203fc9 | 2009-04-27 14:02:24 -0400 | [diff] [blame] | 215 | __REF; \ |
Stephen Rothwell | fc68e86 | 2007-08-22 13:44:58 +1000 | [diff] [blame] | 216 | .align 2 ; \ |
| 217 | .globl name; \ |
| 218 | .globl GLUE(.,name); \ |
| 219 | .section ".opd","aw"; \ |
| 220 | name: \ |
| 221 | .quad GLUE(.,name); \ |
| 222 | .quad .TOC.@tocbase; \ |
| 223 | .quad 0; \ |
| 224 | .previous; \ |
| 225 | .type GLUE(.,name),@function; \ |
| 226 | GLUE(.,name): |
| 227 | |
Paul Mackerras | 40ef8cb | 2005-10-10 22:50:37 +1000 | [diff] [blame] | 228 | #define _KPROBE(name) \ |
| 229 | .section ".kprobes.text","a"; \ |
| 230 | .align 2 ; \ |
| 231 | .globl name; \ |
| 232 | .globl GLUE(.,name); \ |
| 233 | .section ".opd","aw"; \ |
| 234 | name: \ |
| 235 | .quad GLUE(.,name); \ |
| 236 | .quad .TOC.@tocbase; \ |
| 237 | .quad 0; \ |
| 238 | .previous; \ |
| 239 | .type GLUE(.,name),@function; \ |
| 240 | GLUE(.,name): |
| 241 | |
| 242 | #define _STATIC(name) \ |
| 243 | .section ".text"; \ |
| 244 | .align 2 ; \ |
| 245 | .section ".opd","aw"; \ |
| 246 | name: \ |
| 247 | .quad GLUE(.,name); \ |
| 248 | .quad .TOC.@tocbase; \ |
| 249 | .quad 0; \ |
| 250 | .previous; \ |
| 251 | .type GLUE(.,name),@function; \ |
| 252 | GLUE(.,name): |
| 253 | |
Stephen Rothwell | c40b91b | 2007-07-25 09:27:35 +1000 | [diff] [blame] | 254 | #define _INIT_STATIC(name) \ |
Tim Abbott | 9203fc9 | 2009-04-27 14:02:24 -0400 | [diff] [blame] | 255 | __REF; \ |
Stephen Rothwell | c40b91b | 2007-07-25 09:27:35 +1000 | [diff] [blame] | 256 | .align 2 ; \ |
| 257 | .section ".opd","aw"; \ |
| 258 | name: \ |
| 259 | .quad GLUE(.,name); \ |
| 260 | .quad .TOC.@tocbase; \ |
| 261 | .quad 0; \ |
| 262 | .previous; \ |
| 263 | .type GLUE(.,name),@function; \ |
| 264 | GLUE(.,name): |
| 265 | |
Paul Mackerras | 40ef8cb | 2005-10-10 22:50:37 +1000 | [diff] [blame] | 266 | #else /* 32-bit */ |
| 267 | |
Kumar Gala | 748a768 | 2007-09-13 15:42:35 -0500 | [diff] [blame] | 268 | #define _ENTRY(n) \ |
| 269 | .globl n; \ |
| 270 | n: |
| 271 | |
Paul Mackerras | 40ef8cb | 2005-10-10 22:50:37 +1000 | [diff] [blame] | 272 | #define _GLOBAL(n) \ |
| 273 | .text; \ |
| 274 | .stabs __stringify(n:F-1),N_FUN,0,0,n;\ |
| 275 | .globl n; \ |
| 276 | n: |
| 277 | |
| 278 | #define _KPROBE(n) \ |
| 279 | .section ".kprobes.text","a"; \ |
| 280 | .globl n; \ |
| 281 | n: |
| 282 | |
| 283 | #endif |
| 284 | |
Kumar Gala | 5f7c690 | 2005-09-09 15:02:25 -0500 | [diff] [blame] | 285 | /* |
David Gibson | e58c349 | 2006-01-13 14:56:25 +1100 | [diff] [blame] | 286 | * LOAD_REG_IMMEDIATE(rn, expr) |
| 287 | * Loads the value of the constant expression 'expr' into register 'rn' |
| 288 | * using immediate instructions only. Use this when it's important not |
| 289 | * to reference other data (i.e. on ppc64 when the TOC pointer is not |
Paul Mackerras | e31aa45 | 2008-08-30 11:41:12 +1000 | [diff] [blame] | 290 | * valid) and when 'expr' is a constant or absolute address. |
Kumar Gala | 5f7c690 | 2005-09-09 15:02:25 -0500 | [diff] [blame] | 291 | * |
David Gibson | e58c349 | 2006-01-13 14:56:25 +1100 | [diff] [blame] | 292 | * LOAD_REG_ADDR(rn, name) |
| 293 | * Loads the address of label 'name' into register 'rn'. Use this when |
| 294 | * you don't particularly need immediate instructions only, but you need |
| 295 | * the whole address in one register (e.g. it's a structure address and |
| 296 | * you want to access various offsets within it). On ppc32 this is |
| 297 | * identical to LOAD_REG_IMMEDIATE. |
| 298 | * |
| 299 | * LOAD_REG_ADDRBASE(rn, name) |
| 300 | * ADDROFF(name) |
| 301 | * LOAD_REG_ADDRBASE loads part of the address of label 'name' into |
| 302 | * register 'rn'. ADDROFF(name) returns the remainder of the address as |
| 303 | * a constant expression. ADDROFF(name) is a signed expression < 16 bits |
| 304 | * in size, so is suitable for use directly as an offset in load and store |
| 305 | * instructions. Use this when loading/storing a single word or less as: |
| 306 | * LOAD_REG_ADDRBASE(rX, name) |
| 307 | * ld rY,ADDROFF(name)(rX) |
Kumar Gala | 5f7c690 | 2005-09-09 15:02:25 -0500 | [diff] [blame] | 308 | */ |
| 309 | #ifdef __powerpc64__ |
David Gibson | e58c349 | 2006-01-13 14:56:25 +1100 | [diff] [blame] | 310 | #define LOAD_REG_IMMEDIATE(reg,expr) \ |
Michael Neuling | 564aa5c | 2012-06-25 13:33:09 +0000 | [diff] [blame] | 311 | lis reg,(expr)@highest; \ |
| 312 | ori reg,reg,(expr)@higher; \ |
| 313 | rldicr reg,reg,32,31; \ |
| 314 | oris reg,reg,(expr)@h; \ |
| 315 | ori reg,reg,(expr)@l; |
Kumar Gala | 5f7c690 | 2005-09-09 15:02:25 -0500 | [diff] [blame] | 316 | |
David Gibson | e58c349 | 2006-01-13 14:56:25 +1100 | [diff] [blame] | 317 | #define LOAD_REG_ADDR(reg,name) \ |
Michael Neuling | 564aa5c | 2012-06-25 13:33:09 +0000 | [diff] [blame] | 318 | ld reg,name@got(r2) |
Kumar Gala | 5f7c690 | 2005-09-09 15:02:25 -0500 | [diff] [blame] | 319 | |
David Gibson | e58c349 | 2006-01-13 14:56:25 +1100 | [diff] [blame] | 320 | #define LOAD_REG_ADDRBASE(reg,name) LOAD_REG_ADDR(reg,name) |
| 321 | #define ADDROFF(name) 0 |
Paul Mackerras | b85a046 | 2005-10-06 10:59:19 +1000 | [diff] [blame] | 322 | |
Paul Mackerras | f78541dc | 2005-10-28 22:53:37 +1000 | [diff] [blame] | 323 | /* offsets for stack frame layout */ |
| 324 | #define LRSAVE 16 |
Paul Mackerras | b85a046 | 2005-10-06 10:59:19 +1000 | [diff] [blame] | 325 | |
| 326 | #else /* 32-bit */ |
Stephen Rothwell | 7062018 | 2005-10-12 17:44:55 +1000 | [diff] [blame] | 327 | |
David Gibson | e58c349 | 2006-01-13 14:56:25 +1100 | [diff] [blame] | 328 | #define LOAD_REG_IMMEDIATE(reg,expr) \ |
Michael Neuling | 564aa5c | 2012-06-25 13:33:09 +0000 | [diff] [blame] | 329 | lis reg,(expr)@ha; \ |
| 330 | addi reg,reg,(expr)@l; |
Paul Mackerras | b85a046 | 2005-10-06 10:59:19 +1000 | [diff] [blame] | 331 | |
David Gibson | e58c349 | 2006-01-13 14:56:25 +1100 | [diff] [blame] | 332 | #define LOAD_REG_ADDR(reg,name) LOAD_REG_IMMEDIATE(reg, name) |
| 333 | |
Michael Neuling | 564aa5c | 2012-06-25 13:33:09 +0000 | [diff] [blame] | 334 | #define LOAD_REG_ADDRBASE(reg, name) lis reg,name@ha |
David Gibson | e58c349 | 2006-01-13 14:56:25 +1100 | [diff] [blame] | 335 | #define ADDROFF(name) name@l |
Paul Mackerras | b85a046 | 2005-10-06 10:59:19 +1000 | [diff] [blame] | 336 | |
Paul Mackerras | f78541dc | 2005-10-28 22:53:37 +1000 | [diff] [blame] | 337 | /* offsets for stack frame layout */ |
| 338 | #define LRSAVE 4 |
Paul Mackerras | b85a046 | 2005-10-06 10:59:19 +1000 | [diff] [blame] | 339 | |
Kumar Gala | 5f7c690 | 2005-09-09 15:02:25 -0500 | [diff] [blame] | 340 | #endif |
| 341 | |
| 342 | /* various errata or part fixups */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 343 | #ifdef CONFIG_PPC601_SYNC_FIX |
| 344 | #define SYNC \ |
| 345 | BEGIN_FTR_SECTION \ |
| 346 | sync; \ |
| 347 | isync; \ |
| 348 | END_FTR_SECTION_IFSET(CPU_FTR_601) |
| 349 | #define SYNC_601 \ |
| 350 | BEGIN_FTR_SECTION \ |
| 351 | sync; \ |
| 352 | END_FTR_SECTION_IFSET(CPU_FTR_601) |
| 353 | #define ISYNC_601 \ |
| 354 | BEGIN_FTR_SECTION \ |
| 355 | isync; \ |
| 356 | END_FTR_SECTION_IFSET(CPU_FTR_601) |
| 357 | #else |
| 358 | #define SYNC |
| 359 | #define SYNC_601 |
| 360 | #define ISYNC_601 |
| 361 | #endif |
| 362 | |
Benjamin Herrenschmidt | 859deea | 2006-10-20 14:37:05 +1000 | [diff] [blame] | 363 | #ifdef CONFIG_PPC_CELL |
| 364 | #define MFTB(dest) \ |
| 365 | 90: mftb dest; \ |
| 366 | BEGIN_FTR_SECTION_NESTED(96); \ |
| 367 | cmpwi dest,0; \ |
| 368 | beq- 90b; \ |
| 369 | END_FTR_SECTION_NESTED(CPU_FTR_CELL_TB_BUG, CPU_FTR_CELL_TB_BUG, 96) |
| 370 | #else |
| 371 | #define MFTB(dest) mftb dest |
| 372 | #endif |
Kumar Gala | 5f7c690 | 2005-09-09 15:02:25 -0500 | [diff] [blame] | 373 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 374 | #ifndef CONFIG_SMP |
| 375 | #define TLBSYNC |
| 376 | #else /* CONFIG_SMP */ |
| 377 | /* tlbsync is not implemented on 601 */ |
| 378 | #define TLBSYNC \ |
| 379 | BEGIN_FTR_SECTION \ |
| 380 | tlbsync; \ |
| 381 | sync; \ |
| 382 | END_FTR_SECTION_IFCLR(CPU_FTR_601) |
| 383 | #endif |
| 384 | |
Anton Blanchard | 694caf0 | 2012-04-18 02:21:52 +0000 | [diff] [blame] | 385 | #ifdef CONFIG_PPC64 |
| 386 | #define MTOCRF(FXM, RS) \ |
| 387 | BEGIN_FTR_SECTION_NESTED(848); \ |
Michael Neuling | 86e32fd | 2012-06-25 13:33:16 +0000 | [diff] [blame] | 388 | mtcrf (FXM), RS; \ |
Anton Blanchard | 694caf0 | 2012-04-18 02:21:52 +0000 | [diff] [blame] | 389 | FTR_SECTION_ELSE_NESTED(848); \ |
Michael Neuling | 86e32fd | 2012-06-25 13:33:16 +0000 | [diff] [blame] | 390 | mtocrf (FXM), RS; \ |
Anton Blanchard | 694caf0 | 2012-04-18 02:21:52 +0000 | [diff] [blame] | 391 | ALT_FTR_SECTION_END_NESTED_IFCLR(CPU_FTR_NOEXECUTE, 848) |
Haren Myneni | 13e7a8e | 2012-12-06 21:50:32 +0000 | [diff] [blame^] | 392 | |
| 393 | /* |
| 394 | * PPR restore macros used in entry_64.S |
| 395 | * Used for P7 or later processors |
| 396 | */ |
| 397 | #define HMT_MEDIUM_LOW_HAS_PPR \ |
| 398 | BEGIN_FTR_SECTION_NESTED(944) \ |
| 399 | HMT_MEDIUM_LOW; \ |
| 400 | END_FTR_SECTION_NESTED(CPU_FTR_HAS_PPR,CPU_FTR_HAS_PPR,944) |
| 401 | |
| 402 | #define SET_DEFAULT_THREAD_PPR(ra, rb) \ |
| 403 | BEGIN_FTR_SECTION_NESTED(945) \ |
| 404 | lis ra,INIT_PPR@highest; /* default ppr=3 */ \ |
| 405 | ld rb,PACACURRENT(r13); \ |
| 406 | sldi ra,ra,32; /* 11- 13 bits are used for ppr */ \ |
| 407 | std ra,TASKTHREADPPR(rb); \ |
| 408 | END_FTR_SECTION_NESTED(CPU_FTR_HAS_PPR,CPU_FTR_HAS_PPR,945) |
| 409 | |
| 410 | #define RESTORE_PPR(ra, rb) \ |
| 411 | BEGIN_FTR_SECTION_NESTED(946) \ |
| 412 | ld ra,PACACURRENT(r13); \ |
| 413 | ld rb,TASKTHREADPPR(ra); \ |
| 414 | mtspr SPRN_PPR,rb; /* Restore PPR */ \ |
| 415 | END_FTR_SECTION_NESTED(CPU_FTR_HAS_PPR,CPU_FTR_HAS_PPR,946) |
| 416 | |
Anton Blanchard | 694caf0 | 2012-04-18 02:21:52 +0000 | [diff] [blame] | 417 | #endif |
| 418 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 419 | /* |
| 420 | * This instruction is not implemented on the PPC 603 or 601; however, on |
| 421 | * the 403GCX and 405GP tlbia IS defined and tlbie is not. |
| 422 | * All of these instructions exist in the 8xx, they have magical powers, |
| 423 | * and they must be used. |
| 424 | */ |
| 425 | |
| 426 | #if !defined(CONFIG_4xx) && !defined(CONFIG_8xx) |
| 427 | #define tlbia \ |
| 428 | li r4,1024; \ |
| 429 | mtctr r4; \ |
| 430 | lis r4,KERNELBASE@h; \ |
| 431 | 0: tlbie r4; \ |
| 432 | addi r4,r4,0x1000; \ |
| 433 | bdnz 0b |
| 434 | #endif |
| 435 | |
Kumar Gala | 5f7c690 | 2005-09-09 15:02:25 -0500 | [diff] [blame] | 436 | |
Kumar Gala | 5f7c690 | 2005-09-09 15:02:25 -0500 | [diff] [blame] | 437 | #ifdef CONFIG_IBM440EP_ERR42 |
| 438 | #define PPC440EP_ERR42 isync |
| 439 | #else |
| 440 | #define PPC440EP_ERR42 |
| 441 | #endif |
| 442 | |
Benjamin Herrenschmidt | 44c58cc | 2009-07-23 23:15:20 +0000 | [diff] [blame] | 443 | /* |
| 444 | * toreal/fromreal/tophys/tovirt macros. 32-bit BookE makes them |
| 445 | * keep the address intact to be compatible with code shared with |
| 446 | * 32-bit classic. |
| 447 | * |
| 448 | * On the other hand, I find it useful to have them behave as expected |
| 449 | * by their name (ie always do the addition) on 64-bit BookE |
| 450 | */ |
| 451 | #if defined(CONFIG_BOOKE) && !defined(CONFIG_PPC64) |
Paul Mackerras | 6316222 | 2005-10-27 22:44:39 +1000 | [diff] [blame] | 452 | #define toreal(rd) |
| 453 | #define fromreal(rd) |
| 454 | |
Roland McGrath | 2ca7633 | 2008-05-11 10:40:47 +1000 | [diff] [blame] | 455 | /* |
| 456 | * We use addis to ensure compatibility with the "classic" ppc versions of |
| 457 | * these macros, which use rs = 0 to get the tophys offset in rd, rather than |
| 458 | * converting the address in r0, and so this version has to do that too |
| 459 | * (i.e. set register rd to 0 when rs == 0). |
| 460 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 461 | #define tophys(rd,rs) \ |
| 462 | addis rd,rs,0 |
| 463 | |
| 464 | #define tovirt(rd,rs) \ |
| 465 | addis rd,rs,0 |
| 466 | |
Kumar Gala | 5f7c690 | 2005-09-09 15:02:25 -0500 | [diff] [blame] | 467 | #elif defined(CONFIG_PPC64) |
Paul Mackerras | 6316222 | 2005-10-27 22:44:39 +1000 | [diff] [blame] | 468 | #define toreal(rd) /* we can access c000... in real mode */ |
| 469 | #define fromreal(rd) |
| 470 | |
Kumar Gala | 5f7c690 | 2005-09-09 15:02:25 -0500 | [diff] [blame] | 471 | #define tophys(rd,rs) \ |
Paul Mackerras | 6316222 | 2005-10-27 22:44:39 +1000 | [diff] [blame] | 472 | clrldi rd,rs,2 |
Kumar Gala | 5f7c690 | 2005-09-09 15:02:25 -0500 | [diff] [blame] | 473 | |
| 474 | #define tovirt(rd,rs) \ |
Paul Mackerras | 6316222 | 2005-10-27 22:44:39 +1000 | [diff] [blame] | 475 | rotldi rd,rs,16; \ |
| 476 | ori rd,rd,((KERNELBASE>>48)&0xFFFF);\ |
| 477 | rotldi rd,rd,48 |
Kumar Gala | 5f7c690 | 2005-09-09 15:02:25 -0500 | [diff] [blame] | 478 | #else |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 479 | /* |
| 480 | * On APUS (Amiga PowerPC cpu upgrade board), we don't know the |
| 481 | * physical base address of RAM at compile time. |
| 482 | */ |
Paul Mackerras | 6316222 | 2005-10-27 22:44:39 +1000 | [diff] [blame] | 483 | #define toreal(rd) tophys(rd,rd) |
| 484 | #define fromreal(rd) tovirt(rd,rd) |
| 485 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 486 | #define tophys(rd,rs) \ |
Dale Farnsworth | ccdcef7 | 2008-12-17 10:09:13 +0000 | [diff] [blame] | 487 | 0: addis rd,rs,-PAGE_OFFSET@h; \ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 488 | .section ".vtop_fixup","aw"; \ |
| 489 | .align 1; \ |
| 490 | .long 0b; \ |
| 491 | .previous |
| 492 | |
| 493 | #define tovirt(rd,rs) \ |
Dale Farnsworth | ccdcef7 | 2008-12-17 10:09:13 +0000 | [diff] [blame] | 494 | 0: addis rd,rs,PAGE_OFFSET@h; \ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 495 | .section ".ptov_fixup","aw"; \ |
| 496 | .align 1; \ |
| 497 | .long 0b; \ |
| 498 | .previous |
Kumar Gala | 5f7c690 | 2005-09-09 15:02:25 -0500 | [diff] [blame] | 499 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 500 | |
Benjamin Herrenschmidt | 44c58cc | 2009-07-23 23:15:20 +0000 | [diff] [blame] | 501 | #ifdef CONFIG_PPC_BOOK3S_64 |
Paul Mackerras | 40ef8cb | 2005-10-10 22:50:37 +1000 | [diff] [blame] | 502 | #define RFI rfid |
| 503 | #define MTMSRD(r) mtmsrd r |
Benjamin Herrenschmidt | b38c77d | 2012-07-04 14:49:12 +1000 | [diff] [blame] | 504 | #define MTMSR_EERI(reg) mtmsrd reg,1 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 505 | #else |
| 506 | #define FIX_SRR1(ra, rb) |
| 507 | #ifndef CONFIG_40x |
| 508 | #define RFI rfi |
| 509 | #else |
| 510 | #define RFI rfi; b . /* Prevent prefetch past rfi */ |
| 511 | #endif |
| 512 | #define MTMSRD(r) mtmsr r |
Benjamin Herrenschmidt | b38c77d | 2012-07-04 14:49:12 +1000 | [diff] [blame] | 513 | #define MTMSR_EERI(reg) mtmsr reg |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 514 | #define CLR_TOP32(r) |
Matt Porter | c9cf73a | 2005-07-31 22:34:52 -0700 | [diff] [blame] | 515 | #endif |
| 516 | |
Arnd Bergmann | 88ced03 | 2005-12-16 22:43:46 +0100 | [diff] [blame] | 517 | #endif /* __KERNEL__ */ |
| 518 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 519 | /* The boring bits... */ |
| 520 | |
| 521 | /* Condition Register Bit Fields */ |
| 522 | |
| 523 | #define cr0 0 |
| 524 | #define cr1 1 |
| 525 | #define cr2 2 |
| 526 | #define cr3 3 |
| 527 | #define cr4 4 |
| 528 | #define cr5 5 |
| 529 | #define cr6 6 |
| 530 | #define cr7 7 |
| 531 | |
| 532 | |
Michael Neuling | 9a13a52 | 2012-06-25 13:33:12 +0000 | [diff] [blame] | 533 | /* |
| 534 | * General Purpose Registers (GPRs) |
| 535 | * |
| 536 | * The lower case r0-r31 should be used in preference to the upper |
| 537 | * case R0-R31 as they provide more error checking in the assembler. |
| 538 | * Use R0-31 only when really nessesary. |
| 539 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 540 | |
Michael Neuling | 9a13a52 | 2012-06-25 13:33:12 +0000 | [diff] [blame] | 541 | #define r0 %r0 |
| 542 | #define r1 %r1 |
| 543 | #define r2 %r2 |
| 544 | #define r3 %r3 |
| 545 | #define r4 %r4 |
| 546 | #define r5 %r5 |
| 547 | #define r6 %r6 |
| 548 | #define r7 %r7 |
| 549 | #define r8 %r8 |
| 550 | #define r9 %r9 |
| 551 | #define r10 %r10 |
| 552 | #define r11 %r11 |
| 553 | #define r12 %r12 |
| 554 | #define r13 %r13 |
| 555 | #define r14 %r14 |
| 556 | #define r15 %r15 |
| 557 | #define r16 %r16 |
| 558 | #define r17 %r17 |
| 559 | #define r18 %r18 |
| 560 | #define r19 %r19 |
| 561 | #define r20 %r20 |
| 562 | #define r21 %r21 |
| 563 | #define r22 %r22 |
| 564 | #define r23 %r23 |
| 565 | #define r24 %r24 |
| 566 | #define r25 %r25 |
| 567 | #define r26 %r26 |
| 568 | #define r27 %r27 |
| 569 | #define r28 %r28 |
| 570 | #define r29 %r29 |
| 571 | #define r30 %r30 |
| 572 | #define r31 %r31 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 573 | |
| 574 | |
| 575 | /* Floating Point Registers (FPRs) */ |
| 576 | |
| 577 | #define fr0 0 |
| 578 | #define fr1 1 |
| 579 | #define fr2 2 |
| 580 | #define fr3 3 |
| 581 | #define fr4 4 |
| 582 | #define fr5 5 |
| 583 | #define fr6 6 |
| 584 | #define fr7 7 |
| 585 | #define fr8 8 |
| 586 | #define fr9 9 |
| 587 | #define fr10 10 |
| 588 | #define fr11 11 |
| 589 | #define fr12 12 |
| 590 | #define fr13 13 |
| 591 | #define fr14 14 |
| 592 | #define fr15 15 |
| 593 | #define fr16 16 |
| 594 | #define fr17 17 |
| 595 | #define fr18 18 |
| 596 | #define fr19 19 |
| 597 | #define fr20 20 |
| 598 | #define fr21 21 |
| 599 | #define fr22 22 |
| 600 | #define fr23 23 |
| 601 | #define fr24 24 |
| 602 | #define fr25 25 |
| 603 | #define fr26 26 |
| 604 | #define fr27 27 |
| 605 | #define fr28 28 |
| 606 | #define fr29 29 |
| 607 | #define fr30 30 |
| 608 | #define fr31 31 |
| 609 | |
Kumar Gala | 5f7c690 | 2005-09-09 15:02:25 -0500 | [diff] [blame] | 610 | /* AltiVec Registers (VPRs) */ |
| 611 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 612 | #define vr0 0 |
| 613 | #define vr1 1 |
| 614 | #define vr2 2 |
| 615 | #define vr3 3 |
| 616 | #define vr4 4 |
| 617 | #define vr5 5 |
| 618 | #define vr6 6 |
| 619 | #define vr7 7 |
| 620 | #define vr8 8 |
| 621 | #define vr9 9 |
| 622 | #define vr10 10 |
| 623 | #define vr11 11 |
| 624 | #define vr12 12 |
| 625 | #define vr13 13 |
| 626 | #define vr14 14 |
| 627 | #define vr15 15 |
| 628 | #define vr16 16 |
| 629 | #define vr17 17 |
| 630 | #define vr18 18 |
| 631 | #define vr19 19 |
| 632 | #define vr20 20 |
| 633 | #define vr21 21 |
| 634 | #define vr22 22 |
| 635 | #define vr23 23 |
| 636 | #define vr24 24 |
| 637 | #define vr25 25 |
| 638 | #define vr26 26 |
| 639 | #define vr27 27 |
| 640 | #define vr28 28 |
| 641 | #define vr29 29 |
| 642 | #define vr30 30 |
| 643 | #define vr31 31 |
| 644 | |
Michael Neuling | 72ffff5 | 2008-06-25 14:07:18 +1000 | [diff] [blame] | 645 | /* VSX Registers (VSRs) */ |
| 646 | |
| 647 | #define vsr0 0 |
| 648 | #define vsr1 1 |
| 649 | #define vsr2 2 |
| 650 | #define vsr3 3 |
| 651 | #define vsr4 4 |
| 652 | #define vsr5 5 |
| 653 | #define vsr6 6 |
| 654 | #define vsr7 7 |
| 655 | #define vsr8 8 |
| 656 | #define vsr9 9 |
| 657 | #define vsr10 10 |
| 658 | #define vsr11 11 |
| 659 | #define vsr12 12 |
| 660 | #define vsr13 13 |
| 661 | #define vsr14 14 |
| 662 | #define vsr15 15 |
| 663 | #define vsr16 16 |
| 664 | #define vsr17 17 |
| 665 | #define vsr18 18 |
| 666 | #define vsr19 19 |
| 667 | #define vsr20 20 |
| 668 | #define vsr21 21 |
| 669 | #define vsr22 22 |
| 670 | #define vsr23 23 |
| 671 | #define vsr24 24 |
| 672 | #define vsr25 25 |
| 673 | #define vsr26 26 |
| 674 | #define vsr27 27 |
| 675 | #define vsr28 28 |
| 676 | #define vsr29 29 |
| 677 | #define vsr30 30 |
| 678 | #define vsr31 31 |
| 679 | #define vsr32 32 |
| 680 | #define vsr33 33 |
| 681 | #define vsr34 34 |
| 682 | #define vsr35 35 |
| 683 | #define vsr36 36 |
| 684 | #define vsr37 37 |
| 685 | #define vsr38 38 |
| 686 | #define vsr39 39 |
| 687 | #define vsr40 40 |
| 688 | #define vsr41 41 |
| 689 | #define vsr42 42 |
| 690 | #define vsr43 43 |
| 691 | #define vsr44 44 |
| 692 | #define vsr45 45 |
| 693 | #define vsr46 46 |
| 694 | #define vsr47 47 |
| 695 | #define vsr48 48 |
| 696 | #define vsr49 49 |
| 697 | #define vsr50 50 |
| 698 | #define vsr51 51 |
| 699 | #define vsr52 52 |
| 700 | #define vsr53 53 |
| 701 | #define vsr54 54 |
| 702 | #define vsr55 55 |
| 703 | #define vsr56 56 |
| 704 | #define vsr57 57 |
| 705 | #define vsr58 58 |
| 706 | #define vsr59 59 |
| 707 | #define vsr60 60 |
| 708 | #define vsr61 61 |
| 709 | #define vsr62 62 |
| 710 | #define vsr63 63 |
| 711 | |
Kumar Gala | 5f7c690 | 2005-09-09 15:02:25 -0500 | [diff] [blame] | 712 | /* SPE Registers (EVPRs) */ |
| 713 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 714 | #define evr0 0 |
| 715 | #define evr1 1 |
| 716 | #define evr2 2 |
| 717 | #define evr3 3 |
| 718 | #define evr4 4 |
| 719 | #define evr5 5 |
| 720 | #define evr6 6 |
| 721 | #define evr7 7 |
| 722 | #define evr8 8 |
| 723 | #define evr9 9 |
| 724 | #define evr10 10 |
| 725 | #define evr11 11 |
| 726 | #define evr12 12 |
| 727 | #define evr13 13 |
| 728 | #define evr14 14 |
| 729 | #define evr15 15 |
| 730 | #define evr16 16 |
| 731 | #define evr17 17 |
| 732 | #define evr18 18 |
| 733 | #define evr19 19 |
| 734 | #define evr20 20 |
| 735 | #define evr21 21 |
| 736 | #define evr22 22 |
| 737 | #define evr23 23 |
| 738 | #define evr24 24 |
| 739 | #define evr25 25 |
| 740 | #define evr26 26 |
| 741 | #define evr27 27 |
| 742 | #define evr28 28 |
| 743 | #define evr29 29 |
| 744 | #define evr30 30 |
| 745 | #define evr31 31 |
| 746 | |
| 747 | /* some stab codes */ |
| 748 | #define N_FUN 36 |
| 749 | #define N_RSYM 64 |
| 750 | #define N_SLINE 68 |
| 751 | #define N_SO 100 |
Kumar Gala | 5f7c690 | 2005-09-09 15:02:25 -0500 | [diff] [blame] | 752 | |
Kumar Gala | 5f7c690 | 2005-09-09 15:02:25 -0500 | [diff] [blame] | 753 | #endif /* __ASSEMBLY__ */ |
| 754 | |
| 755 | #endif /* _ASM_POWERPC_PPC_ASM_H */ |