1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345
|
//Original:/proj/frio/dv/testcases/lmu/lmu_excpt_align/lmu_excpt_align.dsp
// Description: LMU data alignment exceptions
# mach: bfin
# sim: --environment operating
#include "test.h"
.include "testutils.inc"
start
include(selfcheck.inc)
include(std.inc)
include(mmrs.inc)
CHECK_INIT(p5, 0xE0000000);
// test address for DAG0
// test address for DAG1
// setup interrupt controller with exception handler address
WR_MMR_LABEL(EVT3, handler, p0, r1);
// Write fault addr MMR to known state
WR_MMR(DCPLB_FAULT_ADDR, 0, p0, r6);
//nop;nop;nop;nop;nop; // in lieu of CSYNC
CSYNC;
A0 = 0;
// go to user mode. and enable exceptions
LD32_LABEL(r0, User);
RETI = R0;
RTI;
// Nops to work around ICache bug
NOP;NOP;NOP;NOP;NOP;
NOP;NOP;NOP;NOP;NOP;
User:
NOP;NOP;NOP;NOP;NOP;
//-------------------------------------------------------
// First do stores
//-------------------------------------------------------
// 16-bit alignment, DAG0
LD32(i1, ((0x1000 + 1)));
LD32(p2, ((0x1000 + 1) & 0xFFFFFFFE)); // Aligned version
LD32(r1, 0xDEADBEEF);
R5 = 0;R6 = 0;R7 = 0; // Exception handler will set these, reset them first
X01: W [ I1 ] = R1.L; // Exception should occur here
CHECKREG(r5,0x24); // supv and EXCPT_ALIGN
CHECKREG(r6, (0x1000 + 1)); // FAULT_ADDR should contain fail address
CHECKREG_SYM(r7, X01, r0); // RETX should be value of X01 (HARDCODED ADDR!!)
//-------------------------------------------------------
// 32-bit alignment, DAG0
LD32(i1, ((0x1000 + 1)));
LD32(p2, ((0x1000 + 1) & 0xFFFFFFFC)); // Aligned version
LD32(r1, 0xDEADBEEF);
R5 = 0;R6 = 0;R7 = 0; // Exception handler will set these, reset them first
X02: [ I1 ] = R1; // Exception should occur here
CHECKREG(r5,0x24); // supv and EXCPT_ALIGN
CHECKREG(r6, (0x1000 + 1)); // FAULT_ADDR should contain fail address
CHECKREG_SYM(r7, X02, r0); // RETX should be value of X02 (HARDCODED ADDR!!)
//-------------------------------------------------------
// 32-bit alignment, DAG0
LD32(i1, ((0x1000 + 2)));
LD32(p2, ((0x1000 + 2) & 0xFFFFFFFC)); // Aligned version
LD32(r1, 0xDEADBEEF);
R5 = 0;R6 = 0;R7 = 0; // Exception handler will set these, reset them first
X03: [ I1 ] = R1; // Exception should occur here
CHECKREG(r5,0x24); // supv and EXCPT_ALIGN
CHECKREG(r6, (0x1000 + 2)); // FAULT_ADDR should contain fail address
CHECKREG_SYM(r7, X03, r0); // RETX should be value of X03 (HARDCODED ADDR!!)
//-------------------------------------------------------
// 32-bit alignment, DAG0
LD32(i1, ((0x1000 + 3)));
LD32(p2, ((0x1000 + 3) & 0xFFFFFFFC)); // Aligned version
LD32(r1, 0xDEADBEEF);
R5 = 0;R6 = 0;R7 = 0; // Exception handler will set these, reset them first
X04: [ I1 ] = R1; // Exception should occur here
CHECKREG(r5,0x24); // supv and EXCPT_ALIGN
CHECKREG(r6, (0x1000 + 3)); // FAULT_ADDR should contain fail address
CHECKREG_SYM(r7, X04, r0); // RETX should be value of X04 (HARDCODED ADDR!!)
//-------------------------------------------------------
// 16-bit alignment, DAG1
LD32(i1, ((0x1000 + 1)));
LD32(p2, ((0x1000 + 1) & 0xFFFFFFFE)); // Aligned version
LD32(r1, 0xDEADBEEF);
R5 = 0;R6 = 0;R7 = 0; // Exception handler will set these, reset them first
X05: A0 = 0 || NOP || W [ I1 ] = R1.L; // Exception should occur here
CHECKREG(r5,0x24); // supv and EXCPT_ALIGN
CHECKREG(r6, (0x1000 + 1)); // FAULT_ADDR should contain fail address
CHECKREG_SYM(r7, X05, r0); // RETX should be value of X05 (HARDCODED ADDR!!)
//-------------------------------------------------------
// 32-bit alignment, DAG1
LD32(i1, ((0x1000 + 1)));
LD32(p2, ((0x1000 + 1) & 0xFFFFFFFC)); // Aligned version
LD32(r1, 0xDEADBEEF);
R5 = 0;R6 = 0;R7 = 0; // Exception handler will set these, reset them first
X06: A0 = 0 || NOP || [ I1 ] = R1; // Exception should occur here
CHECKREG(r5,0x24); // supv and EXCPT_ALIGN
CHECKREG(r6, (0x1000 + 1)); // FAULT_ADDR should contain fail address
CHECKREG_SYM(r7, X06, r0); // RETX should be value of X06 (HARDCODED ADDR!!)
//-------------------------------------------------------
// 32-bit alignment, DAG1
LD32(i1, ((0x1000 + 2)));
LD32(p2, ((0x1000 + 2) & 0xFFFFFFFC)); // Aligned version
LD32(r1, 0xDEADBEEF);
R5 = 0;R6 = 0;R7 = 0; // Exception handler will set these, reset them first
X07: A0 = 0 || NOP || [ I1 ] = R1; // Exception should occur here
CHECKREG(r5,0x24); // supv and EXCPT_ALIGN
CHECKREG(r6, (0x1000 + 2)); // FAULT_ADDR should contain fail address
CHECKREG_SYM(r7, X07, r0); // RETX should be value of X07 (HARDCODED ADDR!!)
//-------------------------------------------------------
// 32-bit alignment, DAG1
LD32(i1, ((0x1000 + 3)));
LD32(p2, ((0x1000 + 3) & 0xFFFFFFFC)); // Aligned version
LD32(r1, 0xDEADBEEF);
R5 = 0;R6 = 0;R7 = 0; // Exception handler will set these, reset them first
X08: A0 = 0 || NOP || [ I1 ] = R1; // Exception should occur here
CHECKREG(r5,0x24); // supv and EXCPT_ALIGN
CHECKREG(r6, (0x1000 + 3)); // FAULT_ADDR should contain fail address
CHECKREG_SYM(r7, X08, r0); // RETX should be value of X08 (HARDCODED ADDR!!)
//-------------------------------------------------------
// Now repeat for Loads
//-------------------------------------------------------
// 16-bit alignment, DAG0
LD32(i1, ((0x1000 + 1)));
LD32(p2, ((0x1000 + 1) & 0xFFFFFFFE)); // Aligned version
LD32(r1, 0xDEADBEEF);
R5 = 0;R6 = 0;R7 = 0; // Exception handler will set these, reset them first
X11: R1.L = W [ I1 ]; // Exception should occur here
CHECKREG(r5,0x24); // supv and EXCPT_ALIGN
CHECKREG(r6, (0x1000 + 1)); // FAULT_ADDR should contain fail address
CHECKREG_SYM(r7, X11, r0); // RETX should be value of X11 (HARDCODED ADDR!!)
//-------------------------------------------------------
// 32-bit alignment, DAG0
LD32(i1, ((0x1000 + 1)));
LD32(p2, ((0x1000 + 1) & 0xFFFFFFFC)); // Aligned version
LD32(r1, 0xDEADBEEF);
R5 = 0;R6 = 0;R7 = 0; // Exception handler will set these, reset them first
X12: R1 = [ I1 ]; // Exception should occur here
CHECKREG(r5,0x24); // supv and EXCPT_ALIGN
CHECKREG(r6, (0x1000 + 1)); // FAULT_ADDR should contain fail address
CHECKREG_SYM(r7, X12, r0); // RETX should be value of X12 (HARDCODED ADDR!!)
//-------------------------------------------------------
// 32-bit alignment, DAG0
LD32(i1, ((0x1000 + 2)));
LD32(p2, ((0x1000 + 2) & 0xFFFFFFFC)); // Aligned version
LD32(r1, 0xDEADBEEF);
R5 = 0;R6 = 0;R7 = 0; // Exception handler will set these, reset them first
X13: R1 = [ I1 ]; // Exception should occur here
CHECKREG(r5,0x24); // supv and EXCPT_ALIGN
CHECKREG(r6, (0x1000 + 2)); // FAULT_ADDR should contain fail address
CHECKREG_SYM(r7, X13, r0); // RETX should be value of X13 (HARDCODED ADDR!!)
//-------------------------------------------------------
// 32-bit alignment, DAG0
LD32(i1, ((0x1000 + 3)));
LD32(p2, ((0x1000 + 3) & 0xFFFFFFFC)); // Aligned version
LD32(r1, 0xDEADBEEF);
R5 = 0;R6 = 0;R7 = 0; // Exception handler will set these, reset them first
X14: R1 = [ I1 ]; // Exception should occur here
CHECKREG(r5,0x24); // supv and EXCPT_ALIGN
CHECKREG(r6, (0x1000 + 3)); // FAULT_ADDR should contain fail address
CHECKREG_SYM(r7, X14, r0); // RETX should be value of X14 (HARDCODED ADDR!!)
//-------------------------------------------------------
// 16-bit alignment, DAG1
LD32(i1, ((0x1000 + 1)));
LD32(p2, ((0x1000 + 1) & 0xFFFFFFFE)); // Aligned version
LD32(r1, 0xDEADBEEF);
R5 = 0;R6 = 0;R7 = 0; // Exception handler will set these, reset them first
X15: A0 = 0 || NOP || R1.L = W [ I1 ]; // Exception should occur here
CHECKREG(r5,0x24); // supv and EXCPT_ALIGN
CHECKREG(r6, (0x1000 + 1)); // FAULT_ADDR should contain fail address
CHECKREG_SYM(r7, X15, r0); // RETX should be value of X15 (HARDCODED ADDR!!)
//-------------------------------------------------------
// 32-bit alignment, DAG1
LD32(i1, ((0x1000 + 1)));
LD32(p2, ((0x1000 + 1) & 0xFFFFFFFC)); // Aligned version
LD32(r1, 0xDEADBEEF);
R5 = 0;R6 = 0;R7 = 0; // Exception handler will set these, reset them first
X16: A0 = 0 || NOP || R1 = [ I1 ]; // Exception should occur here
CHECKREG(r5,0x24); // supv and EXCPT_ALIGN
CHECKREG(r6, (0x1000 + 1)); // FAULT_ADDR should contain fail address
CHECKREG_SYM(r7, X16, r0); // RETX should be value of X16 (HARDCODED ADDR!!)
//-------------------------------------------------------
// 32-bit alignment, DAG1
LD32(i1, ((0x1000 + 2)));
LD32(p2, ((0x1000 + 2) & 0xFFFFFFFC)); // Aligned version
LD32(r1, 0xDEADBEEF);
R5 = 0;R6 = 0;R7 = 0; // Exception handler will set these, reset them first
X17: A0 = 0 || NOP || R1 = [ I1 ]; // Exception should occur here
CHECKREG(r5,0x24); // supv and EXCPT_ALIGN
CHECKREG(r6, (0x1000 + 2)); // FAULT_ADDR should contain fail address
CHECKREG_SYM(r7, X17, r0); // RETX should be value of X17 (HARDCODED ADDR!!)
//-------------------------------------------------------
// 32-bit alignment, DAG1
LD32(i1, ((0x1000 + 3)));
LD32(p2, ((0x1000 + 3) & 0xFFFFFFFC)); // Aligned version
LD32(r1, 0xDEADBEEF);
R5 = 0;R6 = 0;R7 = 0; // Exception handler will set these, reset them first
X18: A0 = 0 || NOP || R1 = [ I1 ]; // Exception should occur here
CHECKREG(r5,0x24); // supv and EXCPT_ALIGN
CHECKREG(r6, (0x1000 + 3)); // FAULT_ADDR should contain fail address
CHECKREG_SYM(r7, X18, r0); // RETX should be value of X18 (HARDCODED ADDR!!)
//-------------------------------------------------------
dbg_pass;
handler:
R5 = SEQSTAT; // Get exception cause
// read and check fail addr (addr_which_causes_exception)
// should not be set for alignment exception
RD_MMR(DCPLB_FAULT_ADDR, p0, r6);
R7 = RETX; // get address of excepting instruction
// align the offending address
I1 = P2;
RTX;
// Nops to work around ICache bug
NOP;NOP;NOP;NOP;NOP;
NOP;NOP;NOP;NOP;NOP;
.section MEM_0x1000,"aw"
.dd 0x00000000
.dd 0x00000000
.dd 0x00000000
.dd 0x00000000
|