Commit graph

9 commits

Author SHA1 Message Date
Al Viro
2b4daaed4f nios2: add force_successful_syscall_return()
commit fd0c153daa upstream.

If we use the ancient SysV syscall ABI, we'd better have tell the
kernel how to claim that a negative return value is a success.
Use ->orig_r2 for that - it's inaccessible via ptrace, so it's
a fair game for changes and it's normally[*] non-negative on return
from syscall.  Set to -1; syscall is not going to be restart-worthy
by definition, so we won't interfere with that use either.

[*] the only exception is rt_sigreturn(), where we skip the entire
messing with r1/r2 anyway.

Fixes: 82ed08dd1b ("nios2: Exception handling")
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Dinh Nguyen <dinguyen@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-08-25 11:18:28 +02:00
Al Viro
9e9151768b nios2: traced syscall does need to check the syscall number
commit 25ba820ef3 upstream.

all checks done before letting the tracer modify the register
state are worthless...

Fixes: 82ed08dd1b ("nios2: Exception handling")
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Dinh Nguyen <dinguyen@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-08-25 11:18:27 +02:00
Al Viro
73c0883732 nios2: don't leave NULLs in sys_call_table[]
commit 45ec746c65 upstream.

fill the gaps in there with sys_ni_syscall, as everyone does...

Fixes: 82ed08dd1b ("nios2: Exception handling")
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Dinh Nguyen <dinguyen@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-08-25 11:18:27 +02:00
Al Viro
86a89da5cd nios2: page fault et.al. are *not* restartable syscalls...
commit 8535c239ac upstream.

make sure that ->orig_r2 is negative for everything except
the syscalls.

Fixes: 82ed08dd1b ("nios2: Exception handling")
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Dinh Nguyen <dinguyen@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-08-25 11:18:27 +02:00
Ley Foon Tan
baa54ab93c nios2: rework trap handler
Redefine trap handler as below:

 0  N/A        reserved for system calls
 1  SIGUSR1    user-defined signal 1
 2  SIGUSR2    user-defined signal 2
 3  SIGILL     illegal instruction
 4..29         reserved (but implemented to raise SIGILL instead of being undefined)
30  SIGTRAP    KGDB
31  SIGTRAP    trace/breakpoint trap

Signed-off-by: Ley Foon Tan <lftan@altera.com>
2015-04-20 11:11:14 +08:00
Ley Foon Tan
4a89c3088f nios2: fix cache coherency issue when debug with gdb
Remove the end address checking for flushda function. We need to flush
each address line for flushda instruction, from start to end address.
This is because flushda instruction only flush the cache if tag and line
fields are matched.

Change to use ldwio instruction (bypass cache) to load the instruction
that causing trap. Our interest is the actual instruction that executed
by the processor, this should be uncached.
Note, EA address might be an userspace cached address.


Signed-off-by: Ley Foon Tan <lftan@altera.com>
2015-04-10 11:10:08 +08:00
Ley Foon Tan
d16d2be111 nios2: add kgdb support
Signed-off-by: Ley Foon Tan <lftan@altera.com>
2015-02-16 19:26:43 +08:00
Tobias Klauser
1b0f44923e nios2: Use preempt_schedule_irq
Follow aa0d532605 ("ia64: Use preempt_schedule_irq") and use
preempt_schedule_irq instead of enabling/disabling interrupts and
messing around with PREEMPT_ACTIVE in the nios2 low-level preemption
code ourselves. Also get rid of the now needless re-check for
TIF_NEED_RESCHED, preempt_schedule_irq will already take care of
rescheduling.

This also fixes the following build error when building with
CONFIG_PREEMPT:

arch/nios2/kernel/built-in.o: In function `need_resched':
arch/nios2/kernel/entry.S:374: undefined reference to `PREEMPT_ACTIVE'

Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Acked-by: Ley Foon Tan <lftan@altera.com>
2014-12-31 11:04:58 +08:00
Ley Foon Tan
82ed08dd1b nios2: Exception handling
This patch contains the exception entry code (kernel/entry.S) and
misaligned exception.

Signed-off-by: Ley Foon Tan <lftan@altera.com>
2014-12-08 12:55:50 +08:00