Path: blob/master/arch/m68k/platform/68360/entry.S
10818 views
/*1* linux/arch/m68knommu/platform/68360/entry.S2*3* Copyright (C) 1991, 1992 Linus Torvalds4* Copyright (C) 2001 SED Systems, a Division of Calian Ltd.5*6* This file is subject to the terms and conditions of the GNU General Public7* License. See the file README.legal in the main directory of this archive8* for more details.9*10* Linux/m68k support by Hamish Macdonald11* M68360 Port by SED Systems, and Lineo.12*/1314#include <linux/linkage.h>15#include <asm/thread_info.h>16#include <asm/unistd.h>17#include <asm/errno.h>18#include <asm/setup.h>19#include <asm/segment.h>20#include <asm/traps.h>21#include <asm/asm-offsets.h>22#include <asm/entry.h>2324.text2526.globl system_call27.globl resume28.globl ret_from_exception29.globl ret_from_signal30.globl sys_call_table31.globl ret_from_interrupt32.globl bad_interrupt33.globl inthandler3435badsys:36movel #-ENOSYS,%sp@(PT_OFF_D0)37jra ret_from_exception3839do_trace:40movel #-ENOSYS,%sp@(PT_OFF_D0) /* needed for strace*/41subql #4,%sp42SAVE_SWITCH_STACK43jbsr syscall_trace_enter44RESTORE_SWITCH_STACK45addql #4,%sp46movel %sp@(PT_OFF_ORIG_D0),%d147movel #-ENOSYS,%d048cmpl #NR_syscalls,%d149jcc 1f50lsl #2,%d151lea sys_call_table, %a052jbsr %a0@(%d1)53541: movel %d0,%sp@(PT_OFF_D0) /* save the return value */55subql #4,%sp /* dummy return address */56SAVE_SWITCH_STACK57jbsr syscall_trace_leave5859ret_from_signal:60RESTORE_SWITCH_STACK61addql #4,%sp62jra ret_from_exception6364ENTRY(system_call)65SAVE_ALL6667/* save top of frame*/68pea %sp@69jbsr set_esp070addql #4,%sp7172movel %sp@(PT_OFF_ORIG_D0),%d07374movel %sp,%d1 /* get thread_info pointer */75andl #-THREAD_SIZE,%d176movel %d1,%a277btst #(TIF_SYSCALL_TRACE%8),%a2@(TINFO_FLAGS+(31-TIF_SYSCALL_TRACE)/8)78jne do_trace79cmpl #NR_syscalls,%d080jcc badsys81lsl #2,%d082lea sys_call_table,%a083movel %a0@(%d0), %a084jbsr %a0@85movel %d0,%sp@(PT_OFF_D0) /* save the return value*/8687ret_from_exception:88btst #5,%sp@(PT_OFF_SR) /* check if returning to kernel*/89jeq Luser_return /* if so, skip resched, signals*/9091Lkernel_return:92RESTORE_ALL9394Luser_return:95/* only allow interrupts when we are really the last one on the*/96/* kernel stack, otherwise stack overflow can occur during*/97/* heavy interrupt load*/98andw #ALLOWINT,%sr99100movel %sp,%d1 /* get thread_info pointer */101andl #-THREAD_SIZE,%d1102movel %d1,%a21031:104move %a2@(TINFO_FLAGS),%d1 /* thread_info->flags */105jne Lwork_to_do106RESTORE_ALL107108Lwork_to_do:109movel %a2@(TINFO_FLAGS),%d1 /* thread_info->flags */110btst #TIF_NEED_RESCHED,%d1111jne reschedule112113Lsignal_return:114subql #4,%sp /* dummy return address*/115SAVE_SWITCH_STACK116pea %sp@(SWITCH_STACK_SIZE)117bsrw do_signal118addql #4,%sp119RESTORE_SWITCH_STACK120addql #4,%sp121jra 1b122123/*124* This is the main interrupt handler, responsible for calling do_IRQ()125*/126inthandler:127SAVE_ALL128movew %sp@(PT_OFF_FORMATVEC), %d0129and.l #0x3ff, %d0130lsr.l #0x02, %d0131132movel %sp,%sp@-133movel %d0,%sp@- /* put vector # on stack*/134jbsr do_IRQ /* process the IRQ*/1353: addql #8,%sp /* pop parameters off stack*/136bra ret_from_interrupt137138ret_from_interrupt:139jeq 1f1402:141RESTORE_ALL1421:143moveb %sp@(PT_OFF_SR), %d0144and #7, %d0145jhi 2b146/* check if we need to do software interrupts */147148movel irq_stat+CPUSTAT_SOFTIRQ_PENDING,%d0149jeq ret_from_exception150151pea ret_from_exception152jra do_softirq153154155/*156* Handler for uninitialized and spurious interrupts.157*/158bad_interrupt:159addql #1,num_spurious160rte161162/*163* Beware - when entering resume, prev (the current task) is164* in a0, next (the new task) is in a1,so don't change these165* registers until their contents are no longer needed.166*/167ENTRY(resume)168movel %a0,%d1 /* save prev thread in d1 */169movew %sr,%a0@(TASK_THREAD+THREAD_SR) /* save sr */170movel %usp,%a2 /* save usp */171movel %a2,%a0@(TASK_THREAD+THREAD_USP)172173SAVE_SWITCH_STACK174movel %sp,%a0@(TASK_THREAD+THREAD_KSP) /* save kernel stack */175movel %a1@(TASK_THREAD+THREAD_KSP),%sp /* restore new thread stack */176RESTORE_SWITCH_STACK177178movel %a1@(TASK_THREAD+THREAD_USP),%a0 /* restore user stack */179movel %a0,%usp180movew %a1@(TASK_THREAD+THREAD_SR),%sr /* restore thread status reg */181rts182183184185