Commit graph

71 commits

Author SHA1 Message Date
Michal Simek be304350dd microblaze: remove enable_irq from SAVE_STATE macro
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>
2010-08-04 10:22:46 +02:00
Michal Simek 63708f635c microblaze: Move stack backup to SAVE_STATE macro
Remove code duplicity and move it to SAVE_STATE macro.
There is no impact on performance.

Signed-off-by: Michal Simek <monstr@monstr.eu>
2010-08-04 10:22:45 +02:00
Michal Simek 96014cc39b microblaze: Move BIP setup to the end of ret_from_trap/ret_from_exc
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>
2010-08-04 10:22:45 +02:00
Michal Simek 5c0d72b1b3 microblaze: Remove PER_CPU(KM) variable
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>
2010-08-04 10:22:44 +02:00
Michal Simek 3fbd93e58e microblaze: Optimize clear_vms_ums macro
We can save two instruction when MSR_VMS and MSR_UMS
are setup in one instruction.

Signed-off-by: Michal Simek <monstr@monstr.eu>
2010-08-04 10:22:43 +02:00
Michal Simek 36f6095419 microblaze: Save and restore r3/r4 in SAVE/RESTORE_REGS macros
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>
2010-08-04 10:22:42 +02:00
Michal Simek a4a94dbf20 microblaze: Fix VM_ON and VM_OFF macros
Jump behind macro. We don't want to execute nop instruction again.

Signed-off-by: Michal Simek <monstr@monstr.eu>
2010-08-04 10:22:42 +02:00
Steven J. Magnani ce3266c047 microblaze: Add stack unwinder
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>
2010-08-04 10:22:35 +02:00
Michal Simek 570e3e236e microblaze: Fix sys_clone syscall
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>
2010-08-04 10:22:32 +02:00
Michal Simek 841d6e8c4e microblaze: entry.S use delay slot for return handlers
Signed-off-by: Michal Simek <monstr@monstr.eu>
2010-03-11 14:26:13 +01:00
Michal Simek 8633bebc63 microblaze: Save current task directly
Signed-off-by: Michal Simek <monstr@monstr.eu>
2010-03-11 14:25:54 +01:00
Michal Simek b1d70c62ff microblaze: Simplify entry.S - save/restore r3/r4 - ret_from_trap
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>
2010-03-11 14:25:30 +01:00
Michal Simek 7775379057 microblaze: Add support from PREEMPT
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>
2010-03-11 14:07:32 +01:00
Michal Simek 571202f50f microblaze: Remove rt_sigsuspend wrapper
Generic rt_sigsuspend syscalls doesn't need any asm wrapper.

Signed-off-by: Michal Simek <monstr@monstr.eu>
2009-12-14 08:45:12 +01:00
Michal Simek 11d5136043 microblaze: Do not count system calls in default
There is not necessary to count system calls that's why
I added DEBUG macro

Signed-off-by: Michal Simek <monstr@monstr.eu>
2009-12-14 08:45:08 +01:00
Michal Simek f7816e284b microblaze: Remove saving and restoring before calling signal code
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>
2009-12-14 08:44:55 +01:00
Michal Simek 131e4e97bf microblaze: Clear sticky FSR register after saving it to func parametr
Previous patch d63678d607d0e37ec7abe5ceb545d7e8aab956a4 clear
it for noMMU kernel. This one do it for MMU.

Correct noMMU version

Signed-off-by: Michal Simek <monstr@monstr.eu>
2009-10-05 11:37:47 +02:00
Michal Simek 235754834b microblaze: Support ptrace syscall tracing.
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
Signed-off-by: Michal Simek <monstr@monstr.eu>
2009-09-22 10:00:45 +02:00
Arnd Bergmann e513588f75 microblaze: use generic syscalls.h
The prototypes in syscalls.h all make sense for
microblaze, but for some of them, the actual implementation
in sys_microblaze.c needs to be adapted.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Michal Simek <monstr@monstr.eu>
2009-07-06 10:26:59 +02:00
Arnd Bergmann 3183e06863 microblaze: clean up signal handling
When legacy signal handling is disabled, the
arch/microblaze/kernel/signal.c implementation can
be much simpler, as most of it is handled generically
from kernel/signal.c.

This is also a prerequisite for using the generic
asm/unistd.h, which does not provide __NR_sigreturn,
because this macro is referenced by the current signal.c
implementation.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Michal Simek <monstr@monstr.eu>
2009-07-06 10:26:57 +02:00
Michal Simek ca54502bd5 microblaze_mmu_v2: entry.S, entry.h
Signed-off-by: Michal Simek <monstr@monstr.eu>
2009-05-26 16:45:20 +02:00