summaryrefslogtreecommitdiffstats
path: root/arch/microblaze/kernel/entry.S
Commit message (Collapse)AuthorAgeFilesLines
* sched/rt, microblaze: Use CONFIG_PREEMPTIONThomas Gleixner2019-12-081-1/+1
| | | | | | | | | | | | | | | | | CONFIG_PREEMPTION is selected by CONFIG_PREEMPT and by CONFIG_PREEMPT_RT. Both PREEMPT and PREEMPT_RT require the same functionality which today depends on CONFIG_PREEMPT. Switch the entry code over to use CONFIG_PREEMPTION. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Michal Simek <monstr@monstr.eu> Cc: Peter Zijlstra <peterz@infradead.org> Link: https://lore.kernel.org/r/20191015191821.11479-12-bigeasy@linutronix.de Signed-off-by: Ingo Molnar <mingo@kernel.org>
* microblaze: entry: Remove unneeded need_resched() loopValentin Schneider2019-10-081-5/+0
| | | | | | | | | | Since the enabling and disabling of IRQs within preempt_schedule_irq() is contained in a need_resched() loop, we don't need the outer arch code loop. Signed-off-by: Valentin Schneider <valentin.schneider@arm.com> Cc: Michal Simek <monstr@monstr.eu> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
* microblaze: Fix MSR flags when returning from exceptionMichal Simek2017-06-221-6/+13
| | | | | | | | | | | | | | | | The issue was that the service routine was sometimes returning with the wrong flags set in the MSR. In this case, EIP bit was set while returning to User Mode which is an illegal combination since exceptions are always handled in privileged mode. In order for MicroBlaze to take an interrupt, the MSR must have IE=1, BIP=0 and EIP=0. Signed-off-by: Stefan Asserhall <stefana@xilinx.com> Signed-off-by: Goran Bilski <goran@xilinx.com> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
* microblaze: Separate GP registers from MSR handlingMichal Simek2017-06-221-3/+6
| | | | | | Separate general purpose register restoring from MSR handling. Signed-off-by: Michal Simek <michal.simek@xilinx.com>
* microblaze: Fix syscall error recovery for invalid syscall IDsJamie Garside2015-03-041-1/+2
| | | | | | | | | | | | | | | | | | | This patch fixes two bugs in the Microblaze syscall trap handler when an invalid syscall ID is used. First, the range check on line 351 only checks for syscall IDs greater than __NR_syscalls. A negative syscall ID (either passed to `syscall()` or as returned by `do_syscall_trace_enter()` on error) will still satisfy this test and cause the Linux kernel to access an invalid memory location and cause a kernel oops. This has been fixed by also checking for r12 < 0. Secondly, the current error recovery at line 378 returns using the wrong register (r15 instead of r14) and does not restore the previous stack state. This has been fixed by invoking `ret_from_trap` on error, setting r3 to `-ENOSYS`, similar to what would happen when calling a valid syscall. Signed-off-by: Jamie Garside <jamie.garside@york.ac.uk> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
* microblaze: Coding style cleanupMichal Simek2015-03-041-2/+2
| | | | | | No function change. Signed-off-by: Michal Simek <michal.simek@xilinx.com>
* microblaze: Move restart allowed out of blockMichal Simek2013-02-031-1/+1
| | | | | | | Better not to break block which do work together. Signed-off-by: Michal Simek <monstr@monstr.eu> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* microblaze: fix handling of multiple pending signalsAl Viro2013-02-031-27/+31
| | | | | | | | | | | | We need to keep building sigframes until no pending signals remain. Wrap do_notify_resume() calls into loops; do _not_ allow syscall restart logics to trigger after the first iteration. Incidentally, comments about pending signals that should (somehow) be in r18 are pure BS. Doesn't work that way and cannot work that way, sorry... Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* microblaze: fix the horror with restarts of sigreturn()Al Viro2013-02-031-1/+3
| | | | | | | | | | | | | | | | | | | | | solution a-la arm one - pick a callee-saved register (r30), set it non-zero when entering a syscall, have sigreturn wrapper zero it out and pass the value in it to do_notify_resume() as "in_syscall" (actually, "restarts allowed") argument. Note that we don't give a damn about ret_from_fork() - return value is not restart-worthy anyway. Possible remaining bug: on !MMU we still have _debug_exception() restartable. If it hits with -ERESTART_... accidentally in r3, fun happens. MMU does _not_ have _debug_exception() restartable. If that's decided to be a bug (as I strongly suspect it to be), we'll just need to replace setting r30 to 1 with setting r30 to 0 in !MMU _debug_exception(). Up to microblaze maintainers... [folded a fix from Michal] Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* microblaze: switch to generic fork/vfork/cloneAl Viro2012-11-281-26/+0
| | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
* microblaze: switch to generic sys_execve()Al Viro2012-11-161-4/+0
| | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* microblaze: switch to generic kernel_execve()Al Viro2012-11-161-20/+2
| | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
* microblaze: switch to generic kernel_thread()Al Viro2012-11-161-0/+9
| | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
* microblaze: Fix bug with schedule_tailMichal Simek2012-11-151-1/+1
| | | | Signed-off-by: Michal Simek <monstr@monstr.eu>
* Merge branch 'next' of git://git.monstr.eu/linux-2.6-microblazeLinus Torvalds2012-05-281-3/+4
|\ | | | | | | | | | | | | | | | | | | | | Pull microblaze changes from Michal Simek. * 'next' of git://git.monstr.eu/linux-2.6-microblaze: microblaze: Setup correct pointer to TLS area microblaze: Add TLS support to sys_clone microblaze: ftrace: Pass the first calling instruction for dynamic ftrace microblaze: Port OOM changes to do_page_fault microblaze: Do not select GENERIC_GPIO by default
| * microblaze: Add TLS support to sys_cloneEdgar E. Iglesias2012-05-251-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | Formerly unused Args 4/5 now load parent tid / child tid so the brid to do_fork can pick up TLS from r10. Arg 3 still unused There is also necessary to fix old glibc which do not setup r9/r10 (arg 4/5). Simple clearing them is fine. Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com> Signed-off-by: David Holsgrove <david.holsgrove@petalogix.com> Signed-off-by: Michal Simek <monstr@monstr.eu>
* | microblaze: drop 'oldset' argument of do_notify_resume()Al Viro2012-05-211-8/+4
| | | | | | | | | | | | never used... Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* | microblaze: handle TIF_NOTIFY_RESUMEAl Viro2012-05-211-9/+9
|/ | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* microblaze: Trivial asm fixMichal Simek2012-01-051-1/+1
| | | | | | Just replace one dot with comma. New binutils can detect it. Signed-off-by: Michal Simek <monstr@monstr.eu>
* microblaze: Do not copy reset vectors/manual reset vector setupMichal Simek2011-03-151-4/+3
| | | | | | | | | | | Reset vector can be setup by bootloader and kernel doens't need to touch it. If you require to setup reset vector, please use CONFIG_MANUAL_RESET_VECTOR throught menuconfig. It is not possible to setup address 0x0 as reset address because make no sense to set it up at all. Signed-off-by: Michal Simek <monstr@monstr.eu> Signed-off-by: John Williams <john.williams@petalogix.com>
* microblaze: Fix _reset functionMichal Simek2011-03-151-1/+1
| | | | | | | | | If soft reset falls through with no hardware assisted reset, the best we can do is jump to the reset vector and see what the bootloader left for us. Signed-off-by: Michal Simek <monstr@monstr.eu> Signed-off-by: John Williams <john.williams@petalogix.com>
* microblaze: Fix microblaze init vectorsMichal Simek2011-03-151-1/+4
| | | | | | | | | | | | Microblaze vector table stores several vectors (reset, user exception, interrupt, debug exception and hardware exception). All these functions can be below address 0x10000. If they are, wrong vector table is genarated because jump is not setup from two instructions (imm upper 16bit and brai lower 16bit). Adding specific offset prevent problem if address is below 0x10000. For this case only brai instruction is used. Signed-off-by: Michal Simek <monstr@monstr.eu>
* microblaze: Do not use "la" pseudo instruction - use addik insteadMichal Simek2011-03-091-1/+1
| | | | | | | "la" pseudo instruction is only translation to "addik". Use directly "addik" which is described in the MB reference guide. Signed-off-by: Michal Simek <monstr@monstr.eu>
* microblaze: Remove r0_ram pointer and PTO alignmentMichal Simek2011-03-091-149/+143
| | | | | | | | | | | | | | r0_ram pool was used for saving/restoring register content if hw exception happen. This poll was replaced by pt_pool_space with PT_SIZE size. Based on this change SAVE_STATE_ARG_SPACE was removed which caused that PTO offset is zero that's why is also removed. r0_ram space was used as scratchpad by v850. In early Microblaze Linux developing phase was this part of code blindly copied. Signed-off-by: Michal Simek <monstr@monstr.eu>
* microblaze: Do not use r0_ram space for syscall debuggingMichal Simek2011-03-091-3/+16
| | | | | | | Remove syscall counting space from r0_ram. Use special syscall_debug_table pool for syscall statistic. Signed-off-by: Michal Simek <monstr@monstr.eu>
* Revert "microblaze: Simplify syscall rutine"Michal Simek2010-11-181-7/+39
| | | | | | | | | This reverts commit 0e41c90908881a1b8205c66a66becec7d8d4eb4a. Break jffs2 rootfs because the patch removes syscall calling from kernel space. Signed-off-by: Michal Simek <monstr@monstr.eu>
* microblaze: Fix r16 and r17 reg savingMichal Simek2010-10-211-7/+4
| | | | | | r16 and r17 should be saved across interrupt and exception handling. Signed-off-by: Michal Simek <monstr@monstr.eu>
* microblaze: Clear return value in pt_regsMichal Simek2010-10-211-0/+2
| | | | | | | | Signal code uses r3 value which saved in restore_sigcontext to rt_sigframe but it require to be zeroed. If is not zero rt_sigframe contains wrong values. Signed-off-by: Michal Simek <monstr@monstr.eu>
* microblaze: Fix sys_rt_sigreturn_wrapperMichal Simek2010-10-211-7/+1
| | | | | | | | Do not save return registers before rt_sigreturn is called. _user_exception(syscall handler) already setup return address that's why it is removed from rt_sigreturn_wrapper. Signed-off-by: Michal Simek <monstr@monstr.eu>
* microblaze: Add KGDB supportMichal Simek2010-08-041-49/+57
| | | | | | | | | | | | | | | | | | | | | | | | | Kgdb uses brki r16, 0x18 instruction to call low level _debug_exception function which save current state to pt_regs and call microblaze_kgdb_break function. _debug_exception should be called only from the kernel space. User space calling is not supported because user application debugging uses different handling. pt_regs_to_gdb_regs loads additional special registers which can't be changed * Enable KGDB in Kconfig * Remove ancient not-tested KGDB support * Remove ancient _debug_exception code from entry.S Only MMU KGDB support is supported. Signed-off-by: Michal Simek <monstr@monstr.eu> CC: Jason Wessel <jason.wessel@windriver.com> CC: John Williams <john.williams@petalogix.com> CC: Edgar E. Iglesias <edgar.iglesias@petalogix.com> CC: linux-kernel@vger.kernel.org Acked-by: Jason Wessel <jason.wessel@windriver.com>
* microblaze: Support brki rX, 0x18 for user application debuggingMichal Simek2010-08-041-18/+12
| | | | | | | | | | | | | This is the first patch which add support for user application debugging through brki rX, 0x18 vector. This patch has side effect which also remove security issue to use brki rX, 0x18 to freeze kernel. Support for old gdb support via priviledged exception (brk r0, r0) is still there. It will be remove in future. Signed-off-by: Michal Simek <monstr@monstr.eu>
* microblaze: Remove nop after MSRCLR/SET, MTS, MFS instructionsMichal Simek2010-08-041-51/+0
| | | | | | | We need to save instruction and the latest Microblaze shouldn't have any problem with it. Signed-off-by: Michal Simek <monstr@monstr.eu>
* microblaze: Simplify syscall rutineMichal Simek2010-08-041-39/+7
| | | | | | | | | | Syscall can be called only from userspace that's why we don't need to check which space kernel come from. Kernel syscall calling is not check and shouldn't come throught this part of code. Signed-off-by: Michal Simek <monstr@monstr.eu>
* microblaze: Move PT_MODE saving to delay slotMichal Simek2010-08-041-3/+1
| | | | | | We can save one more instruction if PT_MODE is saved in delay slot Signed-off-by: Michal Simek <monstr@monstr.eu>
* microblaze: Fix _interrupt functionMichal Simek2010-08-041-5/+3
| | | | | | | Save instructions by using delay slot and clear UMS only if kernel comes from user space. Signed-off-by: Michal Simek <monstr@monstr.eu>
* microblaze: Fix _user_exception functionMichal Simek2010-08-041-4/+3
| | | | | | | Saving some instructions. Clear VMS bit if kernel comes from kernel space. Signed-off-by: Michal Simek <monstr@monstr.eu>
* microblaze: Put together addik instructionsMichal Simek2010-08-041-5/+9
| | | | | | Saving instructions by adding 2/3 addik instructions to one. Signed-off-by: Michal Simek <monstr@monstr.eu>
* microblaze: Use delay slot in syscall macrosMichal Simek2010-08-041-19/+10
| | | | | | Saving instruction with delay slot usage. Signed-off-by: Michal Simek <monstr@monstr.eu>
* microblaze: Save kernel mode in delay slotMichal Simek2010-08-041-2/+1
| | | | | | | This change save one instruction if kernel comes from kernel space. Signed-off-by: Michal Simek <monstr@monstr.eu>
* microblaze: Do not mix register saving and mode settingMichal Simek2010-08-041-1/+1
| | | | | | Separate reg saving and mode setting. Signed-off-by: Michal Simek <monstr@monstr.eu>
* microblaze: Move SAVE_STATE upwardMichal Simek2010-08-041-32/+31
| | | | | | SAVE_STATE macro could be used by other rutines too. Signed-off-by: Michal Simek <monstr@monstr.eu>
* microblaze: entry.S: Macro optimizationMichal Simek2010-08-041-12/+12
| | | | | | | | We are not working with values from MSR that's why we can discard it and use r11 for different purpose without saving/restoring. Signed-off-by: Michal Simek <monstr@monstr.eu>
* microblaze: Optimize hw exception rutineMichal Simek2010-08-041-16/+6
| | | | | | | Remove set_vms because UMS is cleared and VMS is already setup. Optimize function calling which save one additional instruction. Signed-off-by: Michal Simek <monstr@monstr.eu>
* microblaze: Implement clear_ums macro and fix SAVE_STATE macroMichal Simek2010-08-041-0/+15
| | | | | | | | | VMS is always setup because VM mode was before exception/syscall/interrupt. Kernel continues in kernel mode that's why we have to clear UMS bit if kernel comes from user space. Signed-off-by: Michal Simek <monstr@monstr.eu>
* microblaze: Remove additional setup for kernel_modeMichal Simek2010-08-041-15/+10
| | | | | | | | | | | PT_MODE stores information if kernel comes from user or kernel space. If come from user space, PT_MODE contains 0. If come from kernel store, PT_MODE contains non zero value. We don't need to save value 1. I am using r1 register which contains non zero value. This change save one additional instruction. Signed-off-by: Michal Simek <monstr@monstr.eu>
* microblaze: Optimize SAVE_STATE macroMichal Simek2010-08-041-8/+13
| | | | | | | SAVE_STATE macro could be used for user_exception or interrupt functions. Signed-off-by: Michal Simek <monstr@monstr.eu>
* microblaze: Remove additional loadingMichal Simek2010-08-041-5/+0
| | | | | | | We don't need to save r0 to PT_R0. It could be additional operation. Signed-off-by: Michal Simek <monstr@monstr.eu>
* microblaze: Completely remove working with R11 registerMichal Simek2010-08-041-41/+21
| | | | | | | We don't need to save R11 register. There is easy way to use only R1 which is saved and restore later. Signed-off-by: Michal Simek <monstr@monstr.eu>
* microblaze: Do not setup BIP in _debug_exceptionMichal Simek2010-08-041-3/+0
| | | | | | BIP is already setup. Signed-off-by: Michal Simek <monstr@monstr.eu>
* microblaze: Simplify _debug_exception functionMichal Simek2010-08-041-5/+2
| | | | | | | | | | | | | | | | | | | | Keep together all arguments for send_sig function. Move returning address to delay slot which is executed. Remove additional send_sig loading. I am using IMM part of rtbd instruction with r0. old solution: addik r11, r0, send_sig rtbd r11, 0 nop new solution: rtbd r0, send_sig nop There is one instruction saving. Signed-off-by: Michal Simek <monstr@monstr.eu>
OpenPOWER on IntegriCloud