📄 entry.s
字号:
/* -*- mode: asm -*- * * linux/arch/m68knommu/kernel/entry.S * * Copyright (C) 1998 D. Jeff Dionne <jeff@ryeham.ee.ryerson.ca>, * Kenneth Albanowski <kjahds@kjahds.com>, * The Silver Hammer Group, Ltd. * * (The icky duplicate functions are my fault -- kja) * * Based on: * * linux/arch/m68k/kernel/entry.S * * Copyright (C) 1991, 1992 Linus Torvalds * * This file is subject to the terms and conditions of the GNU General Public * License. See the file README.legal in the main directory of this archive * for more details. * * Linux/m68k support by Hamish Macdonald * * 68060 fixes by Jesper Skov * *//* * entry.S 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. * * NOTE: This code handles signal-recognition, which happens every time * after a timer-interrupt and after each system call. * * Stack layout in 'ret_from_exception': * * This allows access to the syscall arguments in registers d1-d5 * * 0(sp) - d1 * 4(sp) - d2 * 8(sp) - d3 * C(sp) - d4 * 10(sp) - d5 * 14(sp) - a0 * 18(sp) - a1 * 1C(sp) - d0 * 20(sp) - orig_d0 * 24(sp) - stack adjustment * 28(sp) - sr * 2A(sp) - pc * 2E(sp) - format & vector *//* * 12/03/96 Jes: Currently we only support m68k single-cpu systems, so * all pointers that used to be 'current' are now entry * number 0 in the 'current_set' list. */#include <linux/sys.h>#include <linux/config.h>#include <linux/linkage.h>#include <asm/setup.h>#include <asm/segment.h>LENOSYS = 38/* * these are offsets into the task-struct */LTASK_STATE = 0LTASK_COUNTER = 4LTASK_PRIORITY = 8LTASK_SIGNAL = 12LTASK_BLOCKED = 16LTASK_FLAGS = 20/* the following macro is used when enabling interrupts */#define ALLOWINT 0xf8ff#define MAX_NOINT_IPL 0LD0 = 0x1CLORIG_D0 = 0x20LSR = 0x28LFORMATVEC = 0x2E/* * This defines the normal kernel pt-regs layout. * * regs are a2-a6 and d6-d7 preserved by C code * the kernel doesn't mess with usp unless it needs to */#define SAVE_ALL \ clrl %sp@-; /* stk_adj */ \ movel %d0,%sp@-; /* orig d0 */ \ movel %d0,%sp@-; /* d0 */ \ moveml %d1-%d5/%a0-%a1,%sp@-/* moveml %sp@+,%a0-%a1/%d1-%d5; */#define RESTORE_ALL \ moveml %sp@+,%d1-%d5/%a0-%a1; \ movel %sp@+,%d0; \ addql #4,%sp; /* orig d0 */ \ addl %sp@+,%sp; /* stk adj */ \ rte#define SWITCH_STACK_SIZE (7*4+4) /* includes return address */#define SAVE_SWITCH_STACK \ moveml %a2-%a6/%d6-%d7,%sp@-#define RESTORE_SWITCH_STACK \ moveml %sp@+,%a2-%a6/%d6-%d7.globl SYMBOL_NAME(system_call), SYMBOL_NAME(buserr), SYMBOL_NAME(trap).globl SYMBOL_NAME(resume), SYMBOL_NAME(ret_from_exception).globl SYMBOL_NAME(ret_from_signal).globl SYMBOL_NAME(trap3).globl SYMBOL_NAME(trap4).globl SYMBOL_NAME(trap5).globl SYMBOL_NAME(inthandler1).globl SYMBOL_NAME(inthandler1).globl SYMBOL_NAME(inthandler1).globl SYMBOL_NAME(inthandler2).globl SYMBOL_NAME(inthandler3).globl SYMBOL_NAME(inthandler4).globl SYMBOL_NAME(inthandler5).globl SYMBOL_NAME(inthandler6).globl SYMBOL_NAME(inthandler7).globl SYMBOL_NAME(inthandler8).globl SYMBOL_NAME(inthandler).globl SYMBOL_NAME(inthandler_wrap).globl SYMBOL_NAME(timerhandler).globl SYMBOL_NAME(serialhandler).globl SYMBOL_NAME(sys_call_table).globl SYMBOL_NAME(sys_fork), SYMBOL_NAME(sys_clone).globl SYMBOL_NAME(ret_from_interrupt), SYMBOL_NAME(bad_interrupt).textENTRY(buserr) SAVE_ALL moveq #-1,%d0 movel %d0,%sp@(LORIG_D0) | a -1 in the ORIG_D0 field | signifies that the stack frame | is NOT for syscall movel %sp,%sp@- | stack frame pointer argument jsr SYMBOL_NAME(buserr_c) addql #4,%sp jra SYMBOL_NAME(ret_from_exception)ENTRY(trap) SAVE_ALL moveq #-1,%d0 movel %d0,%sp@(LORIG_D0) | a -1 in the ORIG_D0 field | signifies that the stack frame | is NOT for syscall movew %sp@(LFORMATVEC),%d0 lsrl #2, %d0 andl #0x3ff,%d0 movel %sp,%sp@- | stack frame pointer argument movel %d0,%sp@- moveq #-1,%d0 jsr SYMBOL_NAME(trap_c) addql #8,%sp jra SYMBOL_NAME(ret_from_exception)ENTRY(trap3) SAVE_ALL moveq #-1,%d0 movel %d0,%sp@(LORIG_D0) | a -1 in the ORIG_D0 field | signifies that the stack frame | is NOT for syscall movel %sp,%sp@- | stack frame pointer argument movel #3,%sp@- jsr SYMBOL_NAME(trap_c) addql #8,%sp jra SYMBOL_NAME(ret_from_exception)ENTRY(trap4) SAVE_ALL moveq #-1,%d0 movel %d0,%sp@(LORIG_D0) | a -1 in the ORIG_D0 field | signifies that the stack frame | is NOT for syscall movel %sp,%sp@- | stack frame pointer argument movel #4,%sp@- jsr SYMBOL_NAME(trap_c) addql #8,%sp jra SYMBOL_NAME(ret_from_exception)ENTRY(trap5) SAVE_ALL moveq #-1,%d0 movel %d0,%sp@(LORIG_D0) | a -1 in the ORIG_D0 field | signifies that the stack frame | is NOT for syscall movel %sp,%sp@- | stack frame pointer argument movel #5,%sp@- jsr SYMBOL_NAME(trap_c) addql #8,%sp jra SYMBOL_NAME(ret_from_exception)ENTRY(trap6) SAVE_ALL moveq #-1,%d0 movel %d0,%sp@(LORIG_D0) | a -1 in the ORIG_D0 field | signifies that the stack frame | is NOT for syscall movel %sp,%sp@- | stack frame pointer argument movel #6,%sp@- jsr SYMBOL_NAME(trap_c) addql #8,%sp jra SYMBOL_NAME(ret_from_exception)ENTRY(trap7) SAVE_ALL moveq #-1,%d0 movel %d0,%sp@(LORIG_D0) | a -1 in the ORIG_D0 field | signifies that the stack frame | is NOT for syscall movel %sp,%sp@- | stack frame pointer argument movel #7,%sp@- jsr SYMBOL_NAME(trap_c) addql #8,%sp jra SYMBOL_NAME(ret_from_exception)ENTRY(trap8) SAVE_ALL moveq #-1,%d0 movel %d0,%sp@(LORIG_D0) | a -1 in the ORIG_D0 field | signifies that the stack frame | is NOT for syscall movel %sp,%sp@- | stack frame pointer argument movel #8,%sp@- jsr SYMBOL_NAME(trap_c) addql #8,%sp jra SYMBOL_NAME(ret_from_exception)ENTRY(trap9) SAVE_ALL moveq #-1,%d0 movel %d0,%sp@(LORIG_D0) | a -1 in the ORIG_D0 field | signifies that the stack frame | is NOT for syscall movel %sp,%sp@- | stack frame pointer argument movel #9,%sp@- jsr SYMBOL_NAME(trap_c) addql #8,%sp jra SYMBOL_NAME(ret_from_exception)ENTRY(trap10) SAVE_ALL moveq #-1,%d0 movel %d0,%sp@(LORIG_D0) | a -1 in the ORIG_D0 field | signifies that the stack frame | is NOT for syscall movel %sp,%sp@- | stack frame pointer argument movel #10,%sp@- jsr SYMBOL_NAME(trap_c) addql #8,%sp jra SYMBOL_NAME(ret_from_exception)ENTRY(trap11) SAVE_ALL moveq #-1,%d0 movel %d0,%sp@(LORIG_D0) | a -1 in the ORIG_D0 field | signifies that the stack frame | is NOT for syscall movel %sp,%sp@- | stack frame pointer argument movel #11,%sp@- jsr SYMBOL_NAME(trap_c) addql #8,%sp jra SYMBOL_NAME(ret_from_exception)ENTRY(trap12) SAVE_ALL moveq #-1,%d0 movel %d0,%sp@(LORIG_D0) | a -1 in the ORIG_D0 field | signifies that the stack frame | is NOT for syscall movel %sp,%sp@- | stack frame pointer argument movel #12,%sp@- jsr SYMBOL_NAME(trap_c) addql #8,%sp jra SYMBOL_NAME(ret_from_exception)ENTRY(trap13) SAVE_ALL moveq #-1,%d0 movel %d0,%sp@(LORIG_D0) | a -1 in the ORIG_D0 field | signifies that the stack frame | is NOT for syscall movel %sp,%sp@- | stack frame pointer argument movel #13,%sp@- jsr SYMBOL_NAME(trap_c) addql #8,%sp jra SYMBOL_NAME(ret_from_exception)ENTRY(trap14) SAVE_ALL moveq #-1,%d0 movel %d0,%sp@(LORIG_D0) | a -1 in the ORIG_D0 field | signifies that the stack frame | is NOT for syscall movel %sp,%sp@- | stack frame pointer argument movel #14,%sp@- jsr SYMBOL_NAME(trap_c) addql #8,%sp jra SYMBOL_NAME(ret_from_exception)ENTRY(trap15) SAVE_ALL moveq #-1,%d0 movel %d0,%sp@(LORIG_D0) | a -1 in the ORIG_D0 field | signifies that the stack frame | is NOT for syscall movel %sp,%sp@- | stack frame pointer argument movel #15,%sp@- jsr SYMBOL_NAME(trap_c) addql #8,%sp jra SYMBOL_NAME(ret_from_exception)ENTRY(trap33) SAVE_ALL moveq #-1,%d0 movel %d0,%sp@(LORIG_D0) | a -1 in the ORIG_D0 field | signifies that the stack frame | is NOT for syscall movel %sp,%sp@- | stack frame pointer argument movel #33,%sp@- jsr SYMBOL_NAME(trap_c) addql #8,%sp jra SYMBOL_NAME(ret_from_exception)ENTRY(trap34) SAVE_ALL moveq #-1,%d0 movel %d0,%sp@(LORIG_D0) | a -1 in the ORIG_D0 field | signifies that the stack frame | is NOT for syscall movel %sp,%sp@- | stack frame pointer argument movel #34,%sp@- jsr SYMBOL_NAME(trap_c) addql #8,%sp jra SYMBOL_NAME(ret_from_exception)ENTRY(trap35) SAVE_ALL moveq #-1,%d0 movel %d0,%sp@(LORIG_D0) | a -1 in the ORIG_D0 field | signifies that the stack frame | is NOT for syscall movel %sp,%sp@- | stack frame pointer argument movel #35,%sp@- jsr SYMBOL_NAME(trap_c) addql #8,%sp jra SYMBOL_NAME(ret_from_exception)ENTRY(trap36) SAVE_ALL moveq #-1,%d0 movel %d0,%sp@(LORIG_D0) | a -1 in the ORIG_D0 field | signifies that the stack frame | is NOT for syscall movel %sp,%sp@- | stack frame pointer argument movel #36,%sp@- jsr SYMBOL_NAME(trap_c) addql #8,%sp jra SYMBOL_NAME(ret_from_exception)ENTRY(trap37) SAVE_ALL moveq #-1,%d0 movel %d0,%sp@(LORIG_D0) | a -1 in the ORIG_D0 field | signifies that the stack frame | is NOT for syscall movel %sp,%sp@- | stack frame pointer argument movel #37,%sp@- jsr SYMBOL_NAME(trap_c) addql #8,%sp jra SYMBOL_NAME(ret_from_exception)ENTRY(trap38) SAVE_ALL moveq #-1,%d0 movel %d0,%sp@(LORIG_D0) | a -1 in the ORIG_D0 field | signifies that the stack frame | is NOT for syscall movel %sp,%sp@- | stack frame pointer argument movel #38,%sp@- jsr SYMBOL_NAME(trap_c) addql #8,%sp jra SYMBOL_NAME(ret_from_exception)ENTRY(trap39) SAVE_ALL moveq #-1,%d0 movel %d0,%sp@(LORIG_D0) | a -1 in the ORIG_D0 field | signifies that the stack frame | is NOT for syscall movel %sp,%sp@- | stack frame pointer argument movel #39,%sp@- jsr SYMBOL_NAME(trap_c)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -