linux/arch/arc/kernel
Vineet Gupta 359105bdb0 ARC: pt_regs update #4: r25 saved/restored unconditionally
(This is a VERY IMP change for low level interrupt/exception handling)

-----------------------------------------------------------------------
WHAT
-----------------------------------------------------------------------
* User 25 now saved in pt_regs->user_r25 (vs. tsk->thread_info.user_r25)

* This allows Low level interrupt code to unconditionally save r25
  (vs. the prev version which would only do it for U->K transition).
  Ofcourse for nested interrupts, only the pt_regs->user_r25 of
  bottom-most frame is useful.

* simplifies the interrupt prologue/epilogue

* Needed for ARCv2 ISA code and done here to keep design similar with
  ARCompact event handling

-----------------------------------------------------------------------
WHY
-------------------------------------------------------------------------
With CONFIG_ARC_CURR_IN_REG, r25 is used to cache "current" task pointer
in kernel mode. So when entering kernel mode from User Mode
- user r25 is specially safe-kept (it being a callee reg is NOT part of
  pt_regs which are saved by default on each interrupt/trap/exception)
- r25 loaded with current task pointer.

Further, if interrupt was taken in kernel mode, this is skipped since we
know that r25 already has valid "current" pointer.

With 2 level of interrupts in ARCompact ISA, detecting this is difficult
but still possible, since we could be in kernel mode but r25 not already saved
(in fact the stack itself might not have been switched).

A. User mode
B. L1 IRQ taken
C. L2 IRQ taken (while on 1st line of L1 ISR)

So in #C, although in kernel mode, r25 not saved (infact SP not
switched at all)

Given that ARcompact has manual stack switching, we could use a bit of
trickey - The low level code would make sure that SP is only set to kernel
mode value at the very end (after saving r25). So a non kernel mode SP,
even if in kernel mode, meant r25 was NOT saved.

The same paradigm won't work in ARCv2 ISA since SP is auto-switched so
it's setting can't be delayed/constrained.

Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
2013-06-22 19:23:25 +05:30
..
arc_hostlink.c
arcksyms.c
asm-offsets.c ARC: pt_regs update #4: r25 saved/restored unconditionally 2013-06-22 19:23:25 +05:30
clk.c ARC: fix typo with clock speed 2013-05-07 13:43:54 +05:30
ctx_sw_asm.S
ctx_sw.c ARC: pt_regs update #3: Remove unused gutter at start of callee_regs 2013-06-22 19:23:22 +05:30
devtree.c
disasm.c ARC port updates for Linux 3.10 (part 1) 2013-05-09 14:36:27 -07:00
entry.S ARC: pt_regs update #4: r25 saved/restored unconditionally 2013-06-22 19:23:25 +05:30
fpu.c
head.S
irq.c ARC: More code beautification with IS_ENABLED() 2013-06-22 13:46:42 +05:30
kgdb.c ARC: make allyesconfig build breakages 2013-03-11 19:01:09 +05:30
kprobes.c ARC: Remove duplicate inclusion of header files 2013-04-09 12:21:15 +05:30
Makefile
module.c ARC: Fix coding style issues 2013-04-09 12:21:14 +05:30
process.c ARC: pt_regs update #4: r25 saved/restored unconditionally 2013-06-22 19:23:25 +05:30
ptrace.c ARC: pt_regs update #3: Remove unused gutter at start of callee_regs 2013-06-22 19:23:22 +05:30
reset.c
setup.c ARC: Use kconfig helper IS_ENABLED() to get rid of defines.h 2013-06-22 13:46:42 +05:30
signal.c
smp.c arc: Use generic idle loop 2013-04-08 17:39:23 +02:00
stacktrace.c ARC: pt_regs update #3: Remove unused gutter at start of callee_regs 2013-06-22 19:23:22 +05:30
sys.c ARC: ABIv3: fork/vfork wrappers not needed in "no-legacy-syscall" ABI 2013-03-11 19:01:10 +05:30
time.c ARC: Disintegrate arcregs.h 2013-06-22 13:46:42 +05:30
traps.c ARC: unaligned access emulation error handling consolidation 2013-05-07 13:43:55 +05:30
troubleshoot.c ARC: Reduce Code for ECR printing 2013-06-22 13:46:42 +05:30
unaligned.c
unwind.c
vmlinux.lds.S