1
1
/ *
2
2
* arch/xtensa/kernel/align.S
3
3
*
4
- * Handle unalignment exceptions in kernel space .
4
+ * Handle unalignment and load/store exceptions .
5
5
*
6
6
* This file is subject to the terms and conditions of the GNU General
7
7
* Public License. See the file "COPYING" in the main directory of
26
26
#define LOAD_EXCEPTION_HANDLER
27
27
#endif
28
28
29
- #if XCHAL_UNALIGNED_STORE_EXCEPTION || defined LOAD_EXCEPTION_HANDLER
29
+ #if XCHAL_UNALIGNED_STORE_EXCEPTION || defined CONFIG_XTENSA_LOAD_STORE
30
+ #define STORE_EXCEPTION_HANDLER
31
+ #endif
32
+
33
+ #if defined LOAD_EXCEPTION_HANDLER || defined STORE_EXCEPTION_HANDLER
30
34
#define ANY_EXCEPTION_HANDLER
31
35
#endif
32
36
33
- #if XCHAL_HAVE_WINDOWED
37
+ #if XCHAL_HAVE_WINDOWED && defined CONFIG_MMU
34
38
#define UNALIGNED_USER_EXCEPTION
35
39
#endif
36
40
37
- / * First - level exception handler for unaligned exceptions.
38
- *
39
- * Note: This handler works only for kernel exceptions. Unaligned user
40
- * access should get a seg fault.
41
- * /
42
-
43
41
/ * Big and little endian 16 - bit values are located in
44
42
* different halves of a register. HWORD_START helps to
45
43
* abstract the notion of extracting a 16 - bit value from a
@@ -228,8 +226,6 @@ ENDPROC(fast_load_store)
228
226
#ifdef ANY_EXCEPTION_HANDLER
229
227
ENTRY(fast_unaligned)
230
228
231
- #if XCHAL_UNALIGNED_LOAD_EXCEPTION || XCHAL_UNALIGNED_STORE_EXCEPTION
232
-
233
229
call0 .Lsave_and_load_instruction
234
230
235
231
/ * Analyze the instruction (load or store?). * /
@@ -244,8 +240,7 @@ ENTRY(fast_unaligned)
244
240
/ * 'store indicator bit' not set , jump * /
245
241
_bbci.l a4 , OP1_SI_BIT + INSN_OP1 , .Lload
246
242
247
- #endif
248
- #if XCHAL_UNALIGNED_STORE_EXCEPTION
243
+ #ifdef STORE_EXCEPTION_HANDLER
249
244
250
245
/ * Store: Jump to table entry to get the value in the source register. * /
251
246
@@ -254,7 +249,7 @@ ENTRY(fast_unaligned)
254
249
addx8 a5 , a6 , a5
255
250
jx a5 # jump into table
256
251
#endif
257
- #if XCHAL_UNALIGNED_LOAD_EXCEPTION
252
+ #ifdef LOAD_EXCEPTION_HANDLER
258
253
259
254
/ * Load: Load memory address. * /
260
255
@@ -328,7 +323,7 @@ ENTRY(fast_unaligned)
328
323
mov a14 , a3 ; _j .Lexit; .align 8
329
324
mov a15 , a3 ; _j .Lexit; .align 8
330
325
#endif
331
- #if XCHAL_UNALIGNED_STORE_EXCEPTION
326
+ #ifdef STORE_EXCEPTION_HANDLER
332
327
.Lstore_table:
333
328
l32i a3 , a2 , PT_AREG0 ; _j .Lstore_w; .align 8
334
329
mov a3 , a1 ; _j .Lstore_w; .align 8 # fishy??
@@ -348,7 +343,6 @@ ENTRY(fast_unaligned)
348
343
mov a3 , a15 ; _j .Lstore_w; .align 8
349
344
#endif
350
345
351
- #ifdef ANY_EXCEPTION_HANDLER
352
346
/ * We cannot handle this exception. * /
353
347
354
348
. extern _kernel_exception
@@ -377,8 +371,8 @@ ENTRY(fast_unaligned)
377
371
378
372
2 : movi a0 , _user_exception
379
373
jx a0
380
- #endif
381
- #if XCHAL_UNALIGNED_STORE_EXCEPTION
374
+
375
+ #ifdef STORE_EXCEPTION_HANDLER
382
376
383
377
# a7: instruction pointer , a4: instruction , a3: value
384
378
.Lstore_w:
@@ -444,7 +438,7 @@ ENTRY(fast_unaligned)
444
438
s32i a6 , a4 , 4
445
439
#endif
446
440
#endif
447
- #ifdef ANY_EXCEPTION_HANDLER
441
+
448
442
.Lexit:
449
443
#if XCHAL_HAVE_LOOPS
450
444
rsr a4 , lend # check if we reached LEND
@@ -539,7 +533,7 @@ ENTRY(fast_unaligned)
539
533
__src_b a4 , a4 , a5 # a4 has the instruction
540
534
541
535
ret
542
- #endif
536
+
543
537
ENDPROC(fast_unaligned)
544
538
545
539
ENTRY(fast_unaligned_fixup)
0 commit comments