summaryrefslogtreecommitdiffstats
path: root/arch/microblaze/kernel/entry.S (follow)
Commit message (Collapse)AuthorAgeFilesLines
* 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>
* microblaze: Optimize SAVE_STATE macroMichal Simek2010-08-041-6/+14
| | | | | | | | | | | | | | | | | | | It is necessary to setup BIP and EE and clear EIP only for unaligned exception handler. The rest of hw exception handlers don't require it. HW exception occured and we are not in virtual mode. That's why we can do operations protected by EIP. Interrupt, next hw exception or syscall can't occur. EIP is cleared by rted. This change speedup page_fault hw exception handler which is critical path. There is also necessary to save R11 content before flag setup for unaligned exception. Signed-off-by: Michal Simek <monstr@monstr.eu>
* microblaze: trivial: Use la insted of addikMichal Simek2010-08-041-32/+32
| | | | | | la is translated to addik by toolchain. Signed-off-by: Michal Simek <monstr@monstr.eu>
* microblaze: remove enable_irq from SAVE_STATE macroMichal Simek2010-08-041-1/+0
| | | | | | | | SAVE_STATE macro is used in hw exceptions high level handling functions. Hw exception doesn't disable IRQ that's why we don't need to reenable it. Signed-off-by: Michal Simek <monstr@monstr.eu>
* microblaze: Move stack backup to SAVE_STATE macroMichal Simek2010-08-041-4/+1
| | | | | | | Remove code duplicity and move it to SAVE_STATE macro. There is no impact on performance. Signed-off-by: Michal Simek <monstr@monstr.eu>
* microblaze: Move BIP setup to the end of ret_from_trap/ret_from_excMichal Simek2010-08-041-6/+6
| | | | | | | | We don't need to protect by BIP whole ret_from_trap/ret_from_exc code. Only restoring from user/hw exception should be covered. If BIP is setup, IRQ can't occur. Signed-off-by: Michal Simek <monstr@monstr.eu>
* microblaze: Remove PER_CPU(KM) variableMichal Simek2010-08-041-23/+20
| | | | | | | | | There is a way howto remove Kernel Mode variable. It is easier to parse UMS bit in MSR to find out if I come from kernel or user space. Loading MSR content should be in one cycle and loading PER_CPU variable depends on memory state. Signed-off-by: Michal Simek <monstr@monstr.eu>
* microblaze: Optimize clear_vms_ums macroMichal Simek2010-08-041-3/+1
| | | | | | | We can save two instruction when MSR_VMS and MSR_UMS are setup in one instruction. Signed-off-by: Michal Simek <monstr@monstr.eu>
* microblaze: Save and restore r3/r4 in SAVE/RESTORE_REGS macrosMichal Simek2010-08-041-40/+8
| | | | | | | | | | | Save and restore R3/R4 registers in macros. This change help to cleanup entry.S. In ret_from_trap function we are saving returning value from syscall to pt_regs on stack that's why we don't need to save and restore these values before kernel functions (schedule, do_signal). Signed-off-by: Michal Simek <monstr@monstr.eu>
* microblaze: Fix VM_ON and VM_OFF macrosMichal Simek2010-08-041-4/+6
| | | | | | Jump behind macro. We don't want to execute nop instruction again. Signed-off-by: Michal Simek <monstr@monstr.eu>
* microblaze: Add stack unwinderSteven J. Magnani2010-08-041-0/+27
| | | | | | | | | | | | | | | | | | Implement intelligent backtracing by searching for stack frame creation, and emitting only return addresses. Use print_hex_dump() to display the entire binary kernel stack. Limitation: MMU kernels are not currently able to trace beyond a system trap (interrupt, syscall, etc.). It is the intent of this patch to provide infrastructure that can be extended to add this capability later. Changes from V1: * Removed checks in find_frame_creation() that prevented location of the frame creation instruction in heavily optimized code * Various formatting/commenting/file location tweaks per review comments * Dropped Kconfig option to enable STACKTRACE as something logically separate Signed-off-by: Steven J. Magnani <steve@digidescorp.com>
* microblaze: Fix sys_clone syscallMichal Simek2010-08-041-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | sys_clone syscall ignored args which this patch mapped to args which are passing from glibc. Here is the origin problem description. "I ran the static libgcc tests (very few of them are there, they are mostly dynamically linked) and some of them fail with an assertion in fork() system call (tid != pid), I looked at the microblaze/entry.S file and it looks suspicious (ignores arguments 3-5)" Arg mapping should be: glibc ARCH_FORK(...) -> do_fork(...) r5 -> r5 (clone_flags) r6 -> r6 (stack_start, use parent->stack if NULL) pt_regs -> r7 (pt_regs) r7 -> r8 (stack_size) r8 -> r9 (parent_tidptr) r9 -> r10 (child_tidptr) Signed-off-by: John Williams <john.williams@petalogix.com> Signed-off-by: Michal Simek <monstr@monstr.eu>
* microblaze: entry.S use delay slot for return handlersMichal Simek2010-03-111-6/+3
| | | | Signed-off-by: Michal Simek <monstr@monstr.eu>
* microblaze: Save current task directlyMichal Simek2010-03-111-8/+4
| | | | Signed-off-by: Michal Simek <monstr@monstr.eu>
* microblaze: Simplify entry.S - save/restore r3/r4 - ret_from_trapMichal Simek2010-03-111-48/+30
| | | | | | | There is possible to save r3/r4 at the beggining of user part before calling handlers and at the end restore it. Signed-off-by: Michal Simek <monstr@monstr.eu>
* microblaze: Add support from PREEMPTMichal Simek2010-03-111-1/+24
| | | | | | | | | This patch add core PREEMPT support for Microblaze. I tried to trace it via tracers and I was able to see any output. I also added low level debug functions to see if that code is called. Signed-off-by: Michal Simek <monstr@monstr.eu>
* microblaze: Remove rt_sigsuspend wrapperMichal Simek2009-12-141-11/+0
| | | | | | Generic rt_sigsuspend syscalls doesn't need any asm wrapper. Signed-off-by: Michal Simek <monstr@monstr.eu>
* microblaze: Do not count system calls in defaultMichal Simek2009-12-141-0/+4
| | | | | | | There is not necessary to count system calls that's why I added DEBUG macro Signed-off-by: Michal Simek <monstr@monstr.eu>
* microblaze: Remove saving and restoring before calling signal codeMichal Simek2009-12-141-4/+0
| | | | | | | | | | Saving is done in SAVE_STATE macros that's why another save discard previous saved value. This change has no effect to normal programs because they ends in any exception and they are killed. On the other side has effect on debugging. Signed-off-by: Michal Simek <monstr@monstr.eu>