• Home
  • Raw
  • Download

Lines Matching +full:sar +full:- +full:compare +full:- +full:time

2  * Low-level exception handling
8 * Copyright (C) 2004 - 2008 by Tensilica Inc.
17 #include <asm/asm-offsets.h>
22 #include <asm/asm-uaccess.h>
29 #include <variant/tie-asm.h>
37 * - fast_coprocessor
43 * 100....0 -> 1
44 * 010....0 -> 2
45 * 000....1 -> WSBITS
51 nsau \bit, \mask # 32-WSBITS ... 31 (32 iff 0)
52 addi \bit, \bit, WSBITS - 32 + 1 # uppest bit set -> return 1
57 addi \bit, \bit, -16
62 addi \bit, \bit, -8
66 addi \bit, \bit, -4
69 addi \bit, \bit, -2
72 addi \bit, \bit, -1
99 /* ----------------- DEFAULT FIRST LEVEL EXCEPTION HANDLERS ----------------- */
102 * First-level exception handler for user exceptions.
106 * We save SAR (used to calculate WMASK), and WB and WS (we don't have to
123 * a0-a3 and depc have been saved to PT_AREG0...PT_AREG3 and PT_DEPC
144 /* Save SAR and turn off single stepping */
148 rsr a3, sar
166 slli a2, a3, 32-WSBITS
168 srli a2, a2, 32-WSBITS
202 1: addi a3, a2, -1 # eliminate '1' in bit 0: yyyyxxww0
203 neg a3, a3 # yyyyxxww0 -> YYYYXXWW1+1
212 * bits 4...: number of valid 4-register frames
218 s32i a2, a1, PT_WMASK # needed when we restore the reg-file
220 /* Save 4 registers at a time */
222 1: rotw -1
223 s32i a0, a5, PT_AREG_END - 16
224 s32i a1, a5, PT_AREG_END - 12
225 s32i a2, a5, PT_AREG_END - 8
226 s32i a3, a5, PT_AREG_END - 4
227 addi a0, a4, -1
228 addi a1, a5, -16
231 /* WINDOWBASE still in SAR! */
233 rsr a2, sar # original WINDOWBASE
250 * First-level exit handler for kernel exceptions
270 * a0-a3 and depc have been saved to PT_AREG0...PT_AREG3 and PT_DEPC
290 /* Save SAR and turn off single stepping */
293 rsr a3, sar
304 slli a2, a3, 32-WSBITS
306 srli a2, a2, 32-WSBITS
309 /* Save only the live window-frame */
334 s32e a3, a1, -16
335 s32e a0, a1, -12
354 * to the second-level exception handler.
403 * - in case of exception or level-1 interrupt it's in the PS,
405 * - in case of medium level interrupt it's in the excsave2.
411 beqz a3, .Llevel1_irq # level-1 IRQ sets ps.intlevel to 0
415 s32i a0, a1, PT_PS # save medium-level interrupt ps
425 addi a2, a2, -EXCCAUSE_LEVEL1_INTERRUPT
459 /* Go to second-level dispatcher. Set up parameters to pass to the
469 /* Call the second-level handler */
532 /* Check current_thread_info->preempt_count */
589 ssr a2 # preserve user's WB in the SAR
594 rotw -1 # we restore a4..a7
607 2: rotw -1 # a0..a3 become a4..a7
608 addi a3, a7, -4*4 # next iteration
609 addi a2, a6, -16 # decrementing Y in WMASK
616 /* Clear unrestored registers (don't leak anything to user-land */
619 rsr a3, sar
624 1: rotw -1
625 addi a3, a7, -1
635 * (if we have restored WSBITS-1 frames).
655 * We only have to do a movsp if the previous window-frame has
658 * WINDOWSTART for the previous window-frame was set before
662 * 'and' WINDOWSTART and WINDOWSTART-1:
664 * (XXXXXX1[0]* - 1) AND XXXXXX1[0]* = XXXXXX0[0]*
670 * different from the time the exception occurred.)
683 addi a0, a3, -1
689 addi a0, a1, -16
726 /* Restore PC, SAR */
731 wsr a3, sar
746 movi a3, -2
804 addi a2, a1, -16-PT_SIZE # assume kernel stack
841 * breakpoints, single-step faulting instruction and restore data
902 * - a0 contains the caller address; original value saved in excsave1.
903 * - the original a0 contains a valid return address (backtrace) or 0.
904 * - a2 contains a valid stackpointer
908 * - If the stack pointer could be invalid, the caller has to setup a
911 * - If the return address could be invalid, the caller has to set it
945 /* -------------------------- FAST EXCEPTION HANDLERS ----------------------- */
951 * Fast-handler for alloca exceptions
958 * /home/ross/rtos/porting/XtensaRTOS-PortingLayer-20090507/xtensa_vectors.S
970 * will be re-executed and this time since the next window frames is in the
992 rotw -1
1006 rotw -1
1008 rotw -1
1080 rsr a0, depc # get syscall-nr
1111 * a0: a2 (syscall-nr), original value saved on stack (PT_AREG0)
1140 .Lswp: /* Atomic compare and swap */
1158 addi a6, a6, -SYS_XTENSA_ATOMIC_SET
1172 movi a2, -EFAULT
1177 movi a2, -EINVAL
1187 movi a2, -ENOSYS
1222 /* Save a3, a4 and SAR on stack. */
1224 rsr a0, sar
1252 extui a3, a3, 1, WSBITS-1 # a3 = 0yyxxxwww
1253 movi a0, (1 << (WSBITS-1))
1260 /* Skip empty frames - get 'oldest' WINDOWSTART-bit. */
1268 sub a0, a3, a0 # WSBITS-a0:number of 0-bits from right
1269 ssr a0 # save in SAR for later.
1281 and WS differ by one 4-register frame. */
1291 .Lc8: s32e a4, a13, -16
1292 l32e a4, a5, -12
1293 s32e a8, a4, -32
1294 s32e a5, a13, -12
1295 s32e a6, a13, -8
1296 s32e a7, a13, -4
1297 s32e a9, a4, -28
1298 s32e a10, a4, -24
1299 s32e a11, a4, -20
1305 .Lc4: s32e a4, a9, -16
1306 s32e a5, a9, -12
1307 s32e a6, a9, -8
1308 s32e a7, a9, -4
1317 /* 12-register frame (call12) */
1319 l32e a0, a5, -12
1320 s32e a8, a0, -48
1323 s32e a9, a8, -44
1324 s32e a10, a8, -40
1325 s32e a11, a8, -36
1326 s32e a12, a8, -32
1327 s32e a13, a8, -28
1328 s32e a14, a8, -24
1329 s32e a15, a8, -20
1337 * s32e a0, a13, -16
1344 rotw -1
1346 s32e a4, a8, -16
1347 s32e a5, a8, -12
1348 s32e a6, a8, -8
1349 s32e a7, a8, -4
1368 /* Advance PC, restore registers and SAR, and return from exception. */
1372 wsr a3, sar
1432 * frame for the current windowbase - 1, we need to rotate a3 left by the
1444 ssl a2 # set shift (32 - WB)
1446 /* We need to make sure the current registers (a0-a3) are preserved.
1455 xsr a3, excsave1 # get spill-mask
1459 slli a2, a3, 32-WSBITS
1494 addi a2, a2, -PT_USER_SIZE
1529 /* Load WB at the time the exception occurred. */
1531 rsr a3, sar # WB is still in SAR
1548 movi a2, -ENOSYS
1568 /* First-level entry handler for user, kernel, and double 2nd-level
1572 * An old, less-efficient C version of this function used to exist.
1596 * the pointer to that page. Also, it's possible for tsk->mm
1597 * to be NULL while tsk->active_mm is nonzero if we faulted on
1601 * http://mail.nl.linux.org/linux-mm/2002-08/msg00258.html
1605 * mm = tsk->active_mm;
1606 * pgd = pgd_offset (mm, regs->excvaddr);
1607 * pmd = pmd_offset (pgd, regs->excvaddr);
1612 l32i a0, a1, TASK_MM # tsk->mm
1620 /* Read ptevaddr and convert to top of page-table page.
1630 * pteval = ((pmdval - PAGE_OFFSET + PHYS_OFFSET) & PAGE_MASK)
1634 movi a1, (PHYS_OFFSET - PAGE_OFFSET) & 0xffffffff
1635 add a0, a0, a1 # pmdval - PAGE_OFFSET
1643 * We utilize all three wired-ways (7-9) to hold pmd translations.
1647 * 0,1 -> way 7 program (0040.0000) and virtual (c000.0000)
1648 * 2 -> way 8 shared libaries (2000.0000)
1649 * 3 -> way 0 stack (3000.0000)
1654 addx2 a3, a3, a3 # -> 0,3,6,9
1656 extui a3, a3, 2, 2 # -> 0,0,1,2
1705 * by another task. Re-establish temporary mapping to the
1728 addi a1, a0, -TLBTEMP_SIZE
1806 l32i a0, a1, TASK_MM # tsk->mm
1892 /* regs->syscall = regs->areg[2] */
1913 movi a6, -ENOSYS
1919 /* Load args: arg0 - arg5 are passed via regs. */
1930 1: /* regs->areg[2] = return_value */
1962 .rept (XCHAL_NUM_AREGS - 32) / 12
2002 s32i a0, a10, THREAD_RA - TASK_THREAD # save return address
2003 s32i a1, a10, THREAD_SP - TASK_THREAD # save stack pointer