/*
* File: arch/blackfin/mach-common/entry.S
* Based on:
* Author: Linus Torvalds
*
* Created: ?
* Description: contains the system-call and fault low-level handling routines.
* This also contains the timer-interrupt handler, as well as all
* interrupts and faults that can result in a task-switch.
*
* Modified:
* Copyright 2004-2006 Analog Devices Inc.
*
* Bugs: Enter bugs at http://blackfin.uclinux.org/
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see the file COPYING, or write
* to the Free Software Foundation, Inc.,
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/*
* 25-Dec-2004 - LG Soft India
* 1. Fix in return_from_int, to make sure any pending
* system call in ILAT for this process to get
* executed, otherwise in case context switch happens,
* system call of first process (i.e in ILAT) will be
* carried forward to the switched process.
* 2. Removed Constant references for the following
* a. IPEND
* b. EXCAUSE mask
* c. PAGE Mask
*/
/*
* NOTE: This code handles signal-recognition, which happens every time
* after a timer-interrupt and after each system call.
*/
#include <linux/linkage.h>
#include <asm/blackfin.h>
#include <asm/unistd.h>
#include <asm/errno.h>
#include <asm/thread_info.h> /* TIF_NEED_RESCHED */
#include <asm/asm-offsets.h>
#include <asm/mach-common/context.S>
#ifdef CONFIG_DEBUG_BFIN_NO_KERN_HWTRACE
/*
* TODO: this should be proper save/restore, but for now
* we'll just cheat and use 0x1/0x13
*/
# define DEBUG_START_HWTRACE \
P5.l = LO(TBUFCTL); \
P5.h = HI(TBUFCTL); \
R7 = 0x13; \
[P5] = R7;
# define DEBUG_STOP_HWTRACE \
P5.l = LO(TBUFCTL); \
P5.h = HI(TBUFCTL); \
R7 = 0x01; \
[P5] = R7;
#else
# define DEBUG_START_HWTRACE
# define DEBUG_STOP_HWTRACE
#endif
#ifdef CONFIG_EXCPT_IRQ_SYSC_L1
.section .l1.text
#else
.text
#endif
/* Slightly simplified and streamlined entry point for CPLB misses.
* This one does not lower the level to IRQ5, and thus can be used to
* patch up CPLB misses on the kernel stack.
*/
ENTRY(_ex_dcplb)
#if defined(ANOMALY_05000261)
/*
* Work around an anomaly: if we see a new DCPLB fault, return
* without doing anything. Then, if we get the same fault again,
* handle it.
*/
p5.l = _last_cplb_fault_retx;
p5.h = _last_cplb_fault_retx;
r7 = [p5];
r6 = retx;
[p5] = r6;
cc = r6 == r7;
if !cc jump _return_from_exception;
/* fall through */
#endif
ENTRY(_ex_icplb)
(R7:6,P5:4) = [sp++];
ASTAT = [sp++];
SAVE_ALL_SYS
call __cplb_hdr;
DEBUG_START_HWTRACE
RESTORE_ALL_SYS
SP = RETN;
rtx;
ENTRY(_ex_spinlock)
/* Transform this into a syscall - twiddle the syscall vector. */
p5.l = lo(EVT15);
p5.h = hi(EVT15);
r7.l = _spinlock_bh;
r7.h = _spinlock_bh;
[p5] = r7;
csync;
/* Fall through. */
ENTRY(_ex_syscall)
DEBUG_START_HWTRACE
(R7:6,P5:4) = [sp++];
ASTAT = [sp++];
raise 15; /* invoked by TRAP #0, for sys call */
sp = retn;
rtx
ENTRY(_spinlock_bh)
SAVE_ALL_SYS
/* To end up here, vector 15 was changed - so we have to change it
* back.
*/
p0.l = lo(EVT15);
p0.h = hi(EVT15);
p1.l = _evt_system_call;
p1.h = _evt_system_call;
[p0] = p1;
csync;
r0 = [sp + PT_R0];
sp += -12;
call _sys_bfin_spinlock;
sp += 12;
[SP + PT_R0] = R0;
RESTORE_ALL_SYS
rti;
ENTRY(_ex_soft_bp)
<