1ca54502bSMichal Simek/* 2ca54502bSMichal Simek * Low-level system-call handling, trap handlers and context-switching 3ca54502bSMichal Simek * 4ca54502bSMichal Simek * Copyright (C) 2008-2009 Michal Simek <monstr@monstr.eu> 5ca54502bSMichal Simek * Copyright (C) 2008-2009 PetaLogix 6ca54502bSMichal Simek * Copyright (C) 2003 John Williams <jwilliams@itee.uq.edu.au> 7ca54502bSMichal Simek * Copyright (C) 2001,2002 NEC Corporation 8ca54502bSMichal Simek * Copyright (C) 2001,2002 Miles Bader <miles@gnu.org> 9ca54502bSMichal Simek * 10ca54502bSMichal Simek * This file is subject to the terms and conditions of the GNU General 11ca54502bSMichal Simek * Public License. See the file COPYING in the main directory of this 12ca54502bSMichal Simek * archive for more details. 13ca54502bSMichal Simek * 14ca54502bSMichal Simek * Written by Miles Bader <miles@gnu.org> 15ca54502bSMichal Simek * Heavily modified by John Williams for Microblaze 16ca54502bSMichal Simek */ 17ca54502bSMichal Simek 18ca54502bSMichal Simek#include <linux/sys.h> 19ca54502bSMichal Simek#include <linux/linkage.h> 20ca54502bSMichal Simek 21ca54502bSMichal Simek#include <asm/entry.h> 22ca54502bSMichal Simek#include <asm/current.h> 23ca54502bSMichal Simek#include <asm/processor.h> 24ca54502bSMichal Simek#include <asm/exceptions.h> 25ca54502bSMichal Simek#include <asm/asm-offsets.h> 26ca54502bSMichal Simek#include <asm/thread_info.h> 27ca54502bSMichal Simek 28ca54502bSMichal Simek#include <asm/page.h> 29ca54502bSMichal Simek#include <asm/unistd.h> 30ca54502bSMichal Simek 31ca54502bSMichal Simek#include <linux/errno.h> 32ca54502bSMichal Simek#include <asm/signal.h> 33ca54502bSMichal Simek 3411d51360SMichal Simek#undef DEBUG 3511d51360SMichal Simek 36ca54502bSMichal Simek/* The size of a state save frame. */ 37ca54502bSMichal Simek#define STATE_SAVE_SIZE (PT_SIZE + STATE_SAVE_ARG_SPACE) 38ca54502bSMichal Simek 39ca54502bSMichal Simek/* The offset of the struct pt_regs in a `state save frame' on the stack. */ 40ca54502bSMichal Simek#define PTO STATE_SAVE_ARG_SPACE /* 24 the space for args */ 41ca54502bSMichal Simek 42ca54502bSMichal Simek#define C_ENTRY(name) .globl name; .align 4; name 43ca54502bSMichal Simek 44ca54502bSMichal Simek/* 45ca54502bSMichal Simek * Various ways of setting and clearing BIP in flags reg. 46ca54502bSMichal Simek * This is mucky, but necessary using microblaze version that 47ca54502bSMichal Simek * allows msr ops to write to BIP 48ca54502bSMichal Simek */ 49ca54502bSMichal Simek#if CONFIG_XILINX_MICROBLAZE0_USE_MSR_INSTR 50ca54502bSMichal Simek .macro clear_bip 5166f7de86SMichal Simek msrclr r0, MSR_BIP 52ca54502bSMichal Simek nop 53ca54502bSMichal Simek .endm 54ca54502bSMichal Simek 55ca54502bSMichal Simek .macro set_bip 5666f7de86SMichal Simek msrset r0, MSR_BIP 57ca54502bSMichal Simek nop 58ca54502bSMichal Simek .endm 59ca54502bSMichal Simek 60ca54502bSMichal Simek .macro clear_eip 6166f7de86SMichal Simek msrclr r0, MSR_EIP 62ca54502bSMichal Simek nop 63ca54502bSMichal Simek .endm 64ca54502bSMichal Simek 65ca54502bSMichal Simek .macro set_ee 6666f7de86SMichal Simek msrset r0, MSR_EE 67ca54502bSMichal Simek nop 68ca54502bSMichal Simek .endm 69ca54502bSMichal Simek 70ca54502bSMichal Simek .macro disable_irq 7166f7de86SMichal Simek msrclr r0, MSR_IE 72ca54502bSMichal Simek nop 73ca54502bSMichal Simek .endm 74ca54502bSMichal Simek 75ca54502bSMichal Simek .macro enable_irq 7666f7de86SMichal Simek msrset r0, MSR_IE 77ca54502bSMichal Simek nop 78ca54502bSMichal Simek .endm 79ca54502bSMichal Simek 80ca54502bSMichal Simek .macro set_ums 8166f7de86SMichal Simek msrset r0, MSR_UMS 82ca54502bSMichal Simek nop 8366f7de86SMichal Simek msrclr r0, MSR_VMS 84ca54502bSMichal Simek nop 85ca54502bSMichal Simek .endm 86ca54502bSMichal Simek 87ca54502bSMichal Simek .macro set_vms 8866f7de86SMichal Simek msrclr r0, MSR_UMS 89ca54502bSMichal Simek nop 9066f7de86SMichal Simek msrset r0, MSR_VMS 91ca54502bSMichal Simek nop 92ca54502bSMichal Simek .endm 93ca54502bSMichal Simek 94b318067eSMichal Simek .macro clear_ums 9566f7de86SMichal Simek msrclr r0, MSR_UMS 96b318067eSMichal Simek nop 97b318067eSMichal Simek .endm 98b318067eSMichal Simek 99ca54502bSMichal Simek .macro clear_vms_ums 10066f7de86SMichal Simek msrclr r0, MSR_VMS | MSR_UMS 101ca54502bSMichal Simek nop 102ca54502bSMichal Simek .endm 103ca54502bSMichal Simek#else 104ca54502bSMichal Simek .macro clear_bip 105ca54502bSMichal Simek mfs r11, rmsr 106ca54502bSMichal Simek nop 107ca54502bSMichal Simek andi r11, r11, ~MSR_BIP 108ca54502bSMichal Simek mts rmsr, r11 109ca54502bSMichal Simek nop 110ca54502bSMichal Simek .endm 111ca54502bSMichal Simek 112ca54502bSMichal Simek .macro set_bip 113ca54502bSMichal Simek mfs r11, rmsr 114ca54502bSMichal Simek nop 115ca54502bSMichal Simek ori r11, r11, MSR_BIP 116ca54502bSMichal Simek mts rmsr, r11 117ca54502bSMichal Simek nop 118ca54502bSMichal Simek .endm 119ca54502bSMichal Simek 120ca54502bSMichal Simek .macro clear_eip 121ca54502bSMichal Simek mfs r11, rmsr 122ca54502bSMichal Simek nop 123ca54502bSMichal Simek andi r11, r11, ~MSR_EIP 124ca54502bSMichal Simek mts rmsr, r11 125ca54502bSMichal Simek nop 126ca54502bSMichal Simek .endm 127ca54502bSMichal Simek 128ca54502bSMichal Simek .macro set_ee 129ca54502bSMichal Simek mfs r11, rmsr 130ca54502bSMichal Simek nop 131ca54502bSMichal Simek ori r11, r11, MSR_EE 132ca54502bSMichal Simek mts rmsr, r11 133ca54502bSMichal Simek nop 134ca54502bSMichal Simek .endm 135ca54502bSMichal Simek 136ca54502bSMichal Simek .macro disable_irq 137ca54502bSMichal Simek mfs r11, rmsr 138ca54502bSMichal Simek nop 139ca54502bSMichal Simek andi r11, r11, ~MSR_IE 140ca54502bSMichal Simek mts rmsr, r11 141ca54502bSMichal Simek nop 142ca54502bSMichal Simek .endm 143ca54502bSMichal Simek 144ca54502bSMichal Simek .macro enable_irq 145ca54502bSMichal Simek mfs r11, rmsr 146ca54502bSMichal Simek nop 147ca54502bSMichal Simek ori r11, r11, MSR_IE 148ca54502bSMichal Simek mts rmsr, r11 149ca54502bSMichal Simek nop 150ca54502bSMichal Simek .endm 151ca54502bSMichal Simek 152ca54502bSMichal Simek .macro set_ums 153ca54502bSMichal Simek mfs r11, rmsr 154ca54502bSMichal Simek nop 155ca54502bSMichal Simek ori r11, r11, MSR_VMS 156ca54502bSMichal Simek andni r11, r11, MSR_UMS 157ca54502bSMichal Simek mts rmsr, r11 158ca54502bSMichal Simek nop 159ca54502bSMichal Simek .endm 160ca54502bSMichal Simek 161ca54502bSMichal Simek .macro set_vms 162ca54502bSMichal Simek mfs r11, rmsr 163ca54502bSMichal Simek nop 164ca54502bSMichal Simek ori r11, r11, MSR_VMS 165ca54502bSMichal Simek andni r11, r11, MSR_UMS 166ca54502bSMichal Simek mts rmsr, r11 167ca54502bSMichal Simek nop 168ca54502bSMichal Simek .endm 169ca54502bSMichal Simek 170b318067eSMichal Simek .macro clear_ums 171b318067eSMichal Simek mfs r11, rmsr 172b318067eSMichal Simek nop 173b318067eSMichal Simek andni r11, r11, MSR_UMS 174b318067eSMichal Simek mts rmsr,r11 175b318067eSMichal Simek nop 176b318067eSMichal Simek .endm 177b318067eSMichal Simek 178ca54502bSMichal Simek .macro clear_vms_ums 179ca54502bSMichal Simek mfs r11, rmsr 180ca54502bSMichal Simek nop 181ca54502bSMichal Simek andni r11, r11, (MSR_VMS|MSR_UMS) 182ca54502bSMichal Simek mts rmsr,r11 183ca54502bSMichal Simek nop 184ca54502bSMichal Simek .endm 185ca54502bSMichal Simek#endif 186ca54502bSMichal Simek 187ca54502bSMichal Simek/* Define how to call high-level functions. With MMU, virtual mode must be 188ca54502bSMichal Simek * enabled when calling the high-level function. Clobbers R11. 189ca54502bSMichal Simek * VM_ON, VM_OFF, DO_JUMP_BIPCLR, DO_CALL 190ca54502bSMichal Simek */ 191ca54502bSMichal Simek 192ca54502bSMichal Simek/* turn on virtual protected mode save */ 193ca54502bSMichal Simek#define VM_ON \ 194ca54502bSMichal Simek set_ums; \ 195ca54502bSMichal Simek rted r0, 2f; \ 196a4a94dbfSMichal Simek nop; \ 197a4a94dbfSMichal Simek2: 198ca54502bSMichal Simek 199ca54502bSMichal Simek/* turn off virtual protected mode save and user mode save*/ 200ca54502bSMichal Simek#define VM_OFF \ 201ca54502bSMichal Simek clear_vms_ums; \ 202ca54502bSMichal Simek rted r0, TOPHYS(1f); \ 203a4a94dbfSMichal Simek nop; \ 204a4a94dbfSMichal Simek1: 205ca54502bSMichal Simek 206ca54502bSMichal Simek#define SAVE_REGS \ 207ca54502bSMichal Simek swi r2, r1, PTO+PT_R2; /* Save SDA */ \ 20836f60954SMichal Simek swi r3, r1, PTO+PT_R3; \ 20936f60954SMichal Simek swi r4, r1, PTO+PT_R4; \ 210ca54502bSMichal Simek swi r5, r1, PTO+PT_R5; \ 211ca54502bSMichal Simek swi r6, r1, PTO+PT_R6; \ 212ca54502bSMichal Simek swi r7, r1, PTO+PT_R7; \ 213ca54502bSMichal Simek swi r8, r1, PTO+PT_R8; \ 214ca54502bSMichal Simek swi r9, r1, PTO+PT_R9; \ 215ca54502bSMichal Simek swi r10, r1, PTO+PT_R10; \ 216ca54502bSMichal Simek swi r11, r1, PTO+PT_R11; /* save clobbered regs after rval */\ 217ca54502bSMichal Simek swi r12, r1, PTO+PT_R12; \ 218ca54502bSMichal Simek swi r13, r1, PTO+PT_R13; /* Save SDA2 */ \ 219ca54502bSMichal Simek swi r14, r1, PTO+PT_PC; /* PC, before IRQ/trap */ \ 220ca54502bSMichal Simek swi r15, r1, PTO+PT_R15; /* Save LP */ \ 221ca54502bSMichal Simek swi r18, r1, PTO+PT_R18; /* Save asm scratch reg */ \ 222ca54502bSMichal Simek swi r19, r1, PTO+PT_R19; \ 223ca54502bSMichal Simek swi r20, r1, PTO+PT_R20; \ 224ca54502bSMichal Simek swi r21, r1, PTO+PT_R21; \ 225ca54502bSMichal Simek swi r22, r1, PTO+PT_R22; \ 226ca54502bSMichal Simek swi r23, r1, PTO+PT_R23; \ 227ca54502bSMichal Simek swi r24, r1, PTO+PT_R24; \ 228ca54502bSMichal Simek swi r25, r1, PTO+PT_R25; \ 229ca54502bSMichal Simek swi r26, r1, PTO+PT_R26; \ 230ca54502bSMichal Simek swi r27, r1, PTO+PT_R27; \ 231ca54502bSMichal Simek swi r28, r1, PTO+PT_R28; \ 232ca54502bSMichal Simek swi r29, r1, PTO+PT_R29; \ 233ca54502bSMichal Simek swi r30, r1, PTO+PT_R30; \ 234ca54502bSMichal Simek swi r31, r1, PTO+PT_R31; /* Save current task reg */ \ 235ca54502bSMichal Simek mfs r11, rmsr; /* save MSR */ \ 236ca54502bSMichal Simek nop; \ 237ca54502bSMichal Simek swi r11, r1, PTO+PT_MSR; 238ca54502bSMichal Simek 239ca54502bSMichal Simek#define RESTORE_REGS \ 240ca54502bSMichal Simek lwi r11, r1, PTO+PT_MSR; \ 241ca54502bSMichal Simek mts rmsr , r11; \ 242ca54502bSMichal Simek nop; \ 243ca54502bSMichal Simek lwi r2, r1, PTO+PT_R2; /* restore SDA */ \ 24436f60954SMichal Simek lwi r3, r1, PTO+PT_R3; \ 24536f60954SMichal Simek lwi r4, r1, PTO+PT_R4; \ 246ca54502bSMichal Simek lwi r5, r1, PTO+PT_R5; \ 247ca54502bSMichal Simek lwi r6, r1, PTO+PT_R6; \ 248ca54502bSMichal Simek lwi r7, r1, PTO+PT_R7; \ 249ca54502bSMichal Simek lwi r8, r1, PTO+PT_R8; \ 250ca54502bSMichal Simek lwi r9, r1, PTO+PT_R9; \ 251ca54502bSMichal Simek lwi r10, r1, PTO+PT_R10; \ 252ca54502bSMichal Simek lwi r11, r1, PTO+PT_R11; /* restore clobbered regs after rval */\ 253ca54502bSMichal Simek lwi r12, r1, PTO+PT_R12; \ 254ca54502bSMichal Simek lwi r13, r1, PTO+PT_R13; /* restore SDA2 */ \ 255ca54502bSMichal Simek lwi r14, r1, PTO+PT_PC; /* RESTORE_LINK PC, before IRQ/trap */\ 256ca54502bSMichal Simek lwi r15, r1, PTO+PT_R15; /* restore LP */ \ 257ca54502bSMichal Simek lwi r18, r1, PTO+PT_R18; /* restore asm scratch reg */ \ 258ca54502bSMichal Simek lwi r19, r1, PTO+PT_R19; \ 259ca54502bSMichal Simek lwi r20, r1, PTO+PT_R20; \ 260ca54502bSMichal Simek lwi r21, r1, PTO+PT_R21; \ 261ca54502bSMichal Simek lwi r22, r1, PTO+PT_R22; \ 262ca54502bSMichal Simek lwi r23, r1, PTO+PT_R23; \ 263ca54502bSMichal Simek lwi r24, r1, PTO+PT_R24; \ 264ca54502bSMichal Simek lwi r25, r1, PTO+PT_R25; \ 265ca54502bSMichal Simek lwi r26, r1, PTO+PT_R26; \ 266ca54502bSMichal Simek lwi r27, r1, PTO+PT_R27; \ 267ca54502bSMichal Simek lwi r28, r1, PTO+PT_R28; \ 268ca54502bSMichal Simek lwi r29, r1, PTO+PT_R29; \ 269ca54502bSMichal Simek lwi r30, r1, PTO+PT_R30; \ 270ca54502bSMichal Simek lwi r31, r1, PTO+PT_R31; /* Restore cur task reg */ 271ca54502bSMichal Simek 272e5d2af2bSMichal Simek#define SAVE_STATE \ 273e5d2af2bSMichal Simek swi r1, r0, TOPHYS(PER_CPU(ENTRY_SP)); /* save stack */ \ 274e5d2af2bSMichal Simek /* See if already in kernel mode.*/ \ 275e5d2af2bSMichal Simek mfs r1, rmsr; \ 276e5d2af2bSMichal Simek nop; \ 277e5d2af2bSMichal Simek andi r1, r1, MSR_UMS; \ 278e5d2af2bSMichal Simek bnei r1, 1f; \ 279e5d2af2bSMichal Simek /* Kernel-mode state save. */ \ 280e5d2af2bSMichal Simek /* Reload kernel stack-ptr. */ \ 281e5d2af2bSMichal Simek lwi r1, r0, TOPHYS(PER_CPU(ENTRY_SP)); \ 282*287503faSMichal Simek /* FIXME: I can add these two lines to one */ \ 283*287503faSMichal Simek /* tophys(r1,r1); */ \ 284*287503faSMichal Simek /* addik r1, r1, -STATE_SAVE_SIZE; */ \ 285*287503faSMichal Simek addik r1, r1, CONFIG_KERNEL_BASE_ADDR - CONFIG_KERNEL_START - STATE_SAVE_SIZE; \ 286e5d2af2bSMichal Simek SAVE_REGS \ 287e5d2af2bSMichal Simek brid 2f; \ 288da233552SMichal Simek swi r1, r1, PTO+PT_MODE; \ 289e5d2af2bSMichal Simek1: /* User-mode state save. */ \ 290e5d2af2bSMichal Simek lwi r1, r0, TOPHYS(PER_CPU(CURRENT_SAVE)); /* get saved current */\ 291e5d2af2bSMichal Simek tophys(r1,r1); \ 292e5d2af2bSMichal Simek lwi r1, r1, TS_THREAD_INFO; /* get the thread info */ \ 293*287503faSMichal Simek /* MS these three instructions can be added to one */ \ 294*287503faSMichal Simek /* addik r1, r1, THREAD_SIZE; */ \ 295*287503faSMichal Simek /* tophys(r1,r1); */ \ 296*287503faSMichal Simek /* addik r1, r1, -STATE_SAVE_SIZE; */ \ 297*287503faSMichal Simek addik r1, r1, THREAD_SIZE + CONFIG_KERNEL_BASE_ADDR - CONFIG_KERNEL_START - STATE_SAVE_SIZE; \ 298e5d2af2bSMichal Simek SAVE_REGS \ 299e5d2af2bSMichal Simek lwi r11, r0, TOPHYS(PER_CPU(ENTRY_SP)); \ 300e5d2af2bSMichal Simek swi r11, r1, PTO+PT_R1; /* Store user SP. */ \ 301e7741075SMichal Simek swi r0, r1, PTO + PT_MODE; /* Was in user-mode. */ \ 302e5d2af2bSMichal Simek /* MS: I am clearing UMS even in case when I come from kernel space */ \ 303e5d2af2bSMichal Simek clear_ums; \ 304e5d2af2bSMichal Simek2: lwi CURRENT_TASK, r0, TOPHYS(PER_CPU(CURRENT_SAVE)); 305e5d2af2bSMichal Simek 306ca54502bSMichal Simek.text 307ca54502bSMichal Simek 308ca54502bSMichal Simek/* 309ca54502bSMichal Simek * User trap. 310ca54502bSMichal Simek * 311ca54502bSMichal Simek * System calls are handled here. 312ca54502bSMichal Simek * 313ca54502bSMichal Simek * Syscall protocol: 314ca54502bSMichal Simek * Syscall number in r12, args in r5-r10 315ca54502bSMichal Simek * Return value in r3 316ca54502bSMichal Simek * 317ca54502bSMichal Simek * Trap entered via brki instruction, so BIP bit is set, and interrupts 318ca54502bSMichal Simek * are masked. This is nice, means we don't have to CLI before state save 319ca54502bSMichal Simek */ 320ca54502bSMichal SimekC_ENTRY(_user_exception): 321ca54502bSMichal Simek swi r1, r0, TOPHYS(PER_CPU(ENTRY_SP)) /* save stack */ 322ca54502bSMichal Simek addi r14, r14, 4 /* return address is 4 byte after call */ 323ca54502bSMichal Simek 324653e447eSMichal Simek mfs r1, rmsr 3255c0d72b1SMichal Simek nop 326653e447eSMichal Simek andi r1, r1, MSR_UMS 327653e447eSMichal Simek bnei r1, 1f 3285c0d72b1SMichal Simek 3295c0d72b1SMichal Simek/* Kernel-mode state save - kernel execve */ 330653e447eSMichal Simek lwi r1, r0, TOPHYS(PER_CPU(ENTRY_SP)); /* Reload kernel stack-ptr*/ 331653e447eSMichal Simek tophys(r1,r1); 332ca54502bSMichal Simek 333ca54502bSMichal Simek addik r1, r1, -STATE_SAVE_SIZE; /* Make room on the stack. */ 334ca54502bSMichal Simek SAVE_REGS 335ca54502bSMichal Simek 33677f6d226SMichal Simek swi r1, r1, PTO + PT_MODE; /* pt_regs -> kernel mode */ 337ca54502bSMichal Simek brid 2f; 338ca54502bSMichal Simek nop; /* Fill delay slot */ 339ca54502bSMichal Simek 340ca54502bSMichal Simek/* User-mode state save. */ 341ca54502bSMichal Simek1: 342ca54502bSMichal Simek lwi r1, r0, TOPHYS(PER_CPU(CURRENT_SAVE)); /* get saved current */ 343ca54502bSMichal Simek tophys(r1,r1); 344ca54502bSMichal Simek lwi r1, r1, TS_THREAD_INFO; /* get stack from task_struct */ 345ca54502bSMichal Simek/* calculate kernel stack pointer from task struct 8k */ 346ca54502bSMichal Simek addik r1, r1, THREAD_SIZE; 347ca54502bSMichal Simek tophys(r1,r1); 348ca54502bSMichal Simek 349ca54502bSMichal Simek addik r1, r1, -STATE_SAVE_SIZE; /* Make room on the stack. */ 350ca54502bSMichal Simek SAVE_REGS 351ca54502bSMichal Simek 352ca54502bSMichal Simek swi r0, r1, PTO + PT_MODE; /* Was in user-mode. */ 353ca54502bSMichal Simek lwi r11, r0, TOPHYS(PER_CPU(ENTRY_SP)); 354ca54502bSMichal Simek swi r11, r1, PTO+PT_R1; /* Store user SP. */ 355b1d70c62SMichal Simek2: lwi CURRENT_TASK, r0, TOPHYS(PER_CPU(CURRENT_SAVE)); 356ca54502bSMichal Simek /* Save away the syscall number. */ 357ca54502bSMichal Simek swi r12, r1, PTO+PT_R0; 358ca54502bSMichal Simek tovirt(r1,r1) 359ca54502bSMichal Simek 360ca54502bSMichal Simek/* where the trap should return need -8 to adjust for rtsd r15, 8*/ 361ca54502bSMichal Simek/* Jump to the appropriate function for the system call number in r12 362ca54502bSMichal Simek * (r12 is not preserved), or return an error if r12 is not valid. The LP 363ca54502bSMichal Simek * register should point to the location where 364ca54502bSMichal Simek * the called function should return. [note that MAKE_SYS_CALL uses label 1] */ 36523575483SMichal Simek 36623575483SMichal Simek # Step into virtual mode. 36723575483SMichal Simek set_vms; 36823575483SMichal Simek addik r11, r0, 3f 36923575483SMichal Simek rtid r11, 0 37023575483SMichal Simek nop 37123575483SMichal Simek3: 372b1d70c62SMichal Simek lwi r11, CURRENT_TASK, TS_THREAD_INFO /* get thread info */ 37323575483SMichal Simek lwi r11, r11, TI_FLAGS /* get flags in thread info */ 37423575483SMichal Simek andi r11, r11, _TIF_WORK_SYSCALL_MASK 37523575483SMichal Simek beqi r11, 4f 37623575483SMichal Simek 37723575483SMichal Simek addik r3, r0, -ENOSYS 37823575483SMichal Simek swi r3, r1, PTO + PT_R3 37923575483SMichal Simek brlid r15, do_syscall_trace_enter 38023575483SMichal Simek addik r5, r1, PTO + PT_R0 38123575483SMichal Simek 38223575483SMichal Simek # do_syscall_trace_enter returns the new syscall nr. 38323575483SMichal Simek addk r12, r0, r3 38423575483SMichal Simek lwi r5, r1, PTO+PT_R5; 38523575483SMichal Simek lwi r6, r1, PTO+PT_R6; 38623575483SMichal Simek lwi r7, r1, PTO+PT_R7; 38723575483SMichal Simek lwi r8, r1, PTO+PT_R8; 38823575483SMichal Simek lwi r9, r1, PTO+PT_R9; 38923575483SMichal Simek lwi r10, r1, PTO+PT_R10; 39023575483SMichal Simek4: 39123575483SMichal Simek/* Jump to the appropriate function for the system call number in r12 39223575483SMichal Simek * (r12 is not preserved), or return an error if r12 is not valid. 39323575483SMichal Simek * The LP register should point to the location where the called function 39423575483SMichal Simek * should return. [note that MAKE_SYS_CALL uses label 1] */ 39523575483SMichal Simek /* See if the system call number is valid */ 396ca54502bSMichal Simek addi r11, r12, -__NR_syscalls; 39723575483SMichal Simek bgei r11,5f; 398ca54502bSMichal Simek /* Figure out which function to use for this system call. */ 399ca54502bSMichal Simek /* Note Microblaze barrel shift is optional, so don't rely on it */ 400ca54502bSMichal Simek add r12, r12, r12; /* convert num -> ptr */ 401ca54502bSMichal Simek add r12, r12, r12; 402ca54502bSMichal Simek 40311d51360SMichal Simek#ifdef DEBUG 404ca54502bSMichal Simek /* Trac syscalls and stored them to r0_ram */ 40523575483SMichal Simek lwi r3, r12, 0x400 + r0_ram 406ca54502bSMichal Simek addi r3, r3, 1 40723575483SMichal Simek swi r3, r12, 0x400 + r0_ram 40811d51360SMichal Simek#endif 409ca54502bSMichal Simek 41023575483SMichal Simek # Find and jump into the syscall handler. 41123575483SMichal Simek lwi r12, r12, sys_call_table 41223575483SMichal Simek /* where the trap should return need -8 to adjust for rtsd r15, 8 */ 413b9ea77e2SMichal Simek addi r15, r0, ret_from_trap-8 41423575483SMichal Simek bra r12 41523575483SMichal Simek 416ca54502bSMichal Simek /* The syscall number is invalid, return an error. */ 41723575483SMichal Simek5: 418ca54502bSMichal Simek rtsd r15, 8; /* looks like a normal subroutine return */ 4199814cc11SMichal Simek addi r3, r0, -ENOSYS; 420ca54502bSMichal Simek 42123575483SMichal Simek/* Entry point used to return from a syscall/trap */ 422ca54502bSMichal Simek/* We re-enable BIP bit before state restore */ 423ca54502bSMichal SimekC_ENTRY(ret_from_trap): 424b1d70c62SMichal Simek swi r3, r1, PTO + PT_R3 425b1d70c62SMichal Simek swi r4, r1, PTO + PT_R4 426b1d70c62SMichal Simek 42736f60954SMichal Simek lwi r11, r1, PTO + PT_MODE; 42836f60954SMichal Simek/* See if returning to kernel mode, if so, skip resched &c. */ 42936f60954SMichal Simek bnei r11, 2f; 430ca54502bSMichal Simek /* We're returning to user mode, so check for various conditions that 431ca54502bSMichal Simek * trigger rescheduling. */ 432b1d70c62SMichal Simek /* FIXME: Restructure all these flag checks. */ 433b1d70c62SMichal Simek lwi r11, CURRENT_TASK, TS_THREAD_INFO; /* get thread info */ 43423575483SMichal Simek lwi r11, r11, TI_FLAGS; /* get flags in thread info */ 43523575483SMichal Simek andi r11, r11, _TIF_WORK_SYSCALL_MASK 43623575483SMichal Simek beqi r11, 1f 43723575483SMichal Simek 43823575483SMichal Simek brlid r15, do_syscall_trace_leave 43923575483SMichal Simek addik r5, r1, PTO + PT_R0 44023575483SMichal Simek1: 44123575483SMichal Simek /* We're returning to user mode, so check for various conditions that 44223575483SMichal Simek * trigger rescheduling. */ 443b1d70c62SMichal Simek /* get thread info from current task */ 444b1d70c62SMichal Simek lwi r11, CURRENT_TASK, TS_THREAD_INFO; 445ca54502bSMichal Simek lwi r11, r11, TI_FLAGS; /* get flags in thread info */ 446ca54502bSMichal Simek andi r11, r11, _TIF_NEED_RESCHED; 447ca54502bSMichal Simek beqi r11, 5f; 448ca54502bSMichal Simek 449ca54502bSMichal Simek bralid r15, schedule; /* Call scheduler */ 450ca54502bSMichal Simek nop; /* delay slot */ 451ca54502bSMichal Simek 452ca54502bSMichal Simek /* Maybe handle a signal */ 453b1d70c62SMichal Simek5: /* get thread info from current task*/ 454b1d70c62SMichal Simek lwi r11, CURRENT_TASK, TS_THREAD_INFO; 455ca54502bSMichal Simek lwi r11, r11, TI_FLAGS; /* get flags in thread info */ 456ca54502bSMichal Simek andi r11, r11, _TIF_SIGPENDING; 457ca54502bSMichal Simek beqi r11, 1f; /* Signals to handle, handle them */ 458ca54502bSMichal Simek 459b9ea77e2SMichal Simek addik r5, r1, PTO; /* Arg 1: struct pt_regs *regs */ 460ca54502bSMichal Simek addi r7, r0, 1; /* Arg 3: int in_syscall */ 461ca54502bSMichal Simek bralid r15, do_signal; /* Handle any signals */ 462841d6e8cSMichal Simek add r6, r0, r0; /* Arg 2: sigset_t *oldset */ 463b1d70c62SMichal Simek 464b1d70c62SMichal Simek/* Finally, return to user state. */ 46596014cc3SMichal Simek1: set_bip; /* Ints masked for state restore */ 4668633bebcSMichal Simek swi CURRENT_TASK, r0, PER_CPU(CURRENT_SAVE); /* save current */ 467ca54502bSMichal Simek VM_OFF; 468ca54502bSMichal Simek tophys(r1,r1); 469ca54502bSMichal Simek RESTORE_REGS; 470ca54502bSMichal Simek addik r1, r1, STATE_SAVE_SIZE /* Clean up stack space. */ 471ca54502bSMichal Simek lwi r1, r1, PT_R1 - PT_SIZE;/* Restore user stack pointer. */ 472ca54502bSMichal Simek bri 6f; 473ca54502bSMichal Simek 474ca54502bSMichal Simek/* Return to kernel state. */ 47596014cc3SMichal Simek2: set_bip; /* Ints masked for state restore */ 47696014cc3SMichal Simek VM_OFF; 477ca54502bSMichal Simek tophys(r1,r1); 478ca54502bSMichal Simek RESTORE_REGS; 479ca54502bSMichal Simek addik r1, r1, STATE_SAVE_SIZE /* Clean up stack space. */ 480ca54502bSMichal Simek tovirt(r1,r1); 481ca54502bSMichal Simek6: 482ca54502bSMichal SimekTRAP_return: /* Make global symbol for debugging */ 483ca54502bSMichal Simek rtbd r14, 0; /* Instructions to return from an IRQ */ 484ca54502bSMichal Simek nop; 485ca54502bSMichal Simek 486ca54502bSMichal Simek 487ca54502bSMichal Simek/* These syscalls need access to the struct pt_regs on the stack, so we 488ca54502bSMichal Simek implement them in assembly (they're basically all wrappers anyway). */ 489ca54502bSMichal Simek 490ca54502bSMichal SimekC_ENTRY(sys_fork_wrapper): 491ca54502bSMichal Simek addi r5, r0, SIGCHLD /* Arg 0: flags */ 492ca54502bSMichal Simek lwi r6, r1, PTO+PT_R1 /* Arg 1: child SP (use parent's) */ 493b9ea77e2SMichal Simek addik r7, r1, PTO /* Arg 2: parent context */ 494ca54502bSMichal Simek add r8. r0, r0 /* Arg 3: (unused) */ 495ca54502bSMichal Simek add r9, r0, r0; /* Arg 4: (unused) */ 496ca54502bSMichal Simek brid do_fork /* Do real work (tail-call) */ 4979814cc11SMichal Simek add r10, r0, r0; /* Arg 5: (unused) */ 498ca54502bSMichal Simek 499ca54502bSMichal Simek/* This the initial entry point for a new child thread, with an appropriate 500ca54502bSMichal Simek stack in place that makes it look the the child is in the middle of an 501ca54502bSMichal Simek syscall. This function is actually `returned to' from switch_thread 502ca54502bSMichal Simek (copy_thread makes ret_from_fork the return address in each new thread's 503ca54502bSMichal Simek saved context). */ 504ca54502bSMichal SimekC_ENTRY(ret_from_fork): 505ca54502bSMichal Simek bralid r15, schedule_tail; /* ...which is schedule_tail's arg */ 506ca54502bSMichal Simek add r3, r5, r0; /* switch_thread returns the prev task */ 507ca54502bSMichal Simek /* ( in the delay slot ) */ 508ca54502bSMichal Simek brid ret_from_trap; /* Do normal trap return */ 5099814cc11SMichal Simek add r3, r0, r0; /* Child's fork call should return 0. */ 510ca54502bSMichal Simek 511e513588fSArnd BergmannC_ENTRY(sys_vfork): 512e513588fSArnd Bergmann brid microblaze_vfork /* Do real work (tail-call) */ 513b9ea77e2SMichal Simek addik r5, r1, PTO 514ca54502bSMichal Simek 515e513588fSArnd BergmannC_ENTRY(sys_clone): 516ca54502bSMichal Simek bnei r6, 1f; /* See if child SP arg (arg 1) is 0. */ 517ca54502bSMichal Simek lwi r6, r1, PTO + PT_R1; /* If so, use paret's stack ptr */ 518b9ea77e2SMichal Simek1: addik r7, r1, PTO; /* Arg 2: parent context */ 519b9ea77e2SMichal Simek add r8, r0, r0; /* Arg 3: (unused) */ 520b9ea77e2SMichal Simek add r9, r0, r0; /* Arg 4: (unused) */ 521ca54502bSMichal Simek brid do_fork /* Do real work (tail-call) */ 5229814cc11SMichal Simek add r10, r0, r0; /* Arg 5: (unused) */ 523ca54502bSMichal Simek 524e513588fSArnd BergmannC_ENTRY(sys_execve): 525e513588fSArnd Bergmann brid microblaze_execve; /* Do real work (tail-call).*/ 5269814cc11SMichal Simek addik r8, r1, PTO; /* add user context as 4th arg */ 527ca54502bSMichal Simek 528ca54502bSMichal SimekC_ENTRY(sys_rt_sigreturn_wrapper): 529ca54502bSMichal Simek swi r3, r1, PTO+PT_R3; /* restore saved r3, r4 registers */ 530ca54502bSMichal Simek swi r4, r1, PTO+PT_R4; 531ca54502bSMichal Simek brlid r15, sys_rt_sigreturn /* Do real work */ 5329814cc11SMichal Simek addik r5, r1, PTO; /* add user context as 1st arg */ 533ca54502bSMichal Simek lwi r3, r1, PTO+PT_R3; /* restore saved r3, r4 registers */ 534ca54502bSMichal Simek lwi r4, r1, PTO+PT_R4; 535ca54502bSMichal Simek bri ret_from_trap /* fall through will not work here due to align */ 536ca54502bSMichal Simek nop; 537ca54502bSMichal Simek 538ca54502bSMichal Simek/* 539ca54502bSMichal Simek * HW EXCEPTION rutine start 540ca54502bSMichal Simek */ 541ca54502bSMichal SimekC_ENTRY(full_exception_trap): 542ca54502bSMichal Simek /* adjust exception address for privileged instruction 543ca54502bSMichal Simek * for finding where is it */ 544ca54502bSMichal Simek addik r17, r17, -4 545ca54502bSMichal Simek SAVE_STATE /* Save registers */ 54606a54604SMichal Simek /* PC, before IRQ/trap - this is one instruction above */ 54706a54604SMichal Simek swi r17, r1, PTO+PT_PC; 54806a54604SMichal Simek tovirt(r1,r1) 549ca54502bSMichal Simek /* FIXME this can be store directly in PT_ESR reg. 550ca54502bSMichal Simek * I tested it but there is a fault */ 551ca54502bSMichal Simek /* where the trap should return need -8 to adjust for rtsd r15, 8 */ 552b9ea77e2SMichal Simek addik r15, r0, ret_from_exc - 8 553ca54502bSMichal Simek mfs r6, resr 554ca54502bSMichal Simek nop 555ca54502bSMichal Simek mfs r7, rfsr; /* save FSR */ 556ca54502bSMichal Simek nop 557131e4e97SMichal Simek mts rfsr, r0; /* Clear sticky fsr */ 558131e4e97SMichal Simek nop 559c318d483SMichal Simek rted r0, full_exception 5609814cc11SMichal Simek addik r5, r1, PTO /* parameter struct pt_regs * regs */ 561ca54502bSMichal Simek 562ca54502bSMichal Simek/* 563ca54502bSMichal Simek * Unaligned data trap. 564ca54502bSMichal Simek * 565ca54502bSMichal Simek * Unaligned data trap last on 4k page is handled here. 566ca54502bSMichal Simek * 567ca54502bSMichal Simek * Trap entered via exception, so EE bit is set, and interrupts 568ca54502bSMichal Simek * are masked. This is nice, means we don't have to CLI before state save 569ca54502bSMichal Simek * 570ca54502bSMichal Simek * The assembler routine is in "arch/microblaze/kernel/hw_exception_handler.S" 571ca54502bSMichal Simek */ 572ca54502bSMichal SimekC_ENTRY(unaligned_data_trap): 5738b110d15SMichal Simek /* MS: I have to save r11 value and then restore it because 5748b110d15SMichal Simek * set_bit, clear_eip, set_ee use r11 as temp register if MSR 5758b110d15SMichal Simek * instructions are not used. We don't need to do if MSR instructions 5768b110d15SMichal Simek * are used and they use r0 instead of r11. 5778b110d15SMichal Simek * I am using ENTRY_SP which should be primary used only for stack 5788b110d15SMichal Simek * pointer saving. */ 5798b110d15SMichal Simek swi r11, r0, TOPHYS(PER_CPU(ENTRY_SP)); 5808b110d15SMichal Simek set_bip; /* equalize initial state for all possible entries */ 5818b110d15SMichal Simek clear_eip; 5828b110d15SMichal Simek set_ee; 5838b110d15SMichal Simek lwi r11, r0, TOPHYS(PER_CPU(ENTRY_SP)); 584ca54502bSMichal Simek SAVE_STATE /* Save registers.*/ 58506a54604SMichal Simek /* PC, before IRQ/trap - this is one instruction above */ 58606a54604SMichal Simek swi r17, r1, PTO+PT_PC; 58706a54604SMichal Simek tovirt(r1,r1) 588ca54502bSMichal Simek /* where the trap should return need -8 to adjust for rtsd r15, 8 */ 589b9ea77e2SMichal Simek addik r15, r0, ret_from_exc-8 590ca54502bSMichal Simek mfs r3, resr /* ESR */ 591ca54502bSMichal Simek nop 592ca54502bSMichal Simek mfs r4, rear /* EAR */ 593ca54502bSMichal Simek nop 594c318d483SMichal Simek rtbd r0, _unaligned_data_exception 595b9ea77e2SMichal Simek addik r7, r1, PTO /* parameter struct pt_regs * regs */ 596ca54502bSMichal Simek 597ca54502bSMichal Simek/* 598ca54502bSMichal Simek * Page fault traps. 599ca54502bSMichal Simek * 600ca54502bSMichal Simek * If the real exception handler (from hw_exception_handler.S) didn't find 601ca54502bSMichal Simek * the mapping for the process, then we're thrown here to handle such situation. 602ca54502bSMichal Simek * 603ca54502bSMichal Simek * Trap entered via exceptions, so EE bit is set, and interrupts 604ca54502bSMichal Simek * are masked. This is nice, means we don't have to CLI before state save 605ca54502bSMichal Simek * 606ca54502bSMichal Simek * Build a standard exception frame for TLB Access errors. All TLB exceptions 607ca54502bSMichal Simek * will bail out to this point if they can't resolve the lightweight TLB fault. 608ca54502bSMichal Simek * 609ca54502bSMichal Simek * The C function called is in "arch/microblaze/mm/fault.c", declared as: 610ca54502bSMichal Simek * void do_page_fault(struct pt_regs *regs, 611ca54502bSMichal Simek * unsigned long address, 612ca54502bSMichal Simek * unsigned long error_code) 613ca54502bSMichal Simek */ 614ca54502bSMichal Simek/* data and intruction trap - which is choose is resolved int fault.c */ 615ca54502bSMichal SimekC_ENTRY(page_fault_data_trap): 616ca54502bSMichal Simek SAVE_STATE /* Save registers.*/ 61706a54604SMichal Simek /* PC, before IRQ/trap - this is one instruction above */ 61806a54604SMichal Simek swi r17, r1, PTO+PT_PC; 61906a54604SMichal Simek tovirt(r1,r1) 620ca54502bSMichal Simek /* where the trap should return need -8 to adjust for rtsd r15, 8 */ 621b9ea77e2SMichal Simek addik r15, r0, ret_from_exc-8 622ca54502bSMichal Simek mfs r6, rear /* parameter unsigned long address */ 623ca54502bSMichal Simek nop 624ca54502bSMichal Simek mfs r7, resr /* parameter unsigned long error_code */ 625ca54502bSMichal Simek nop 626c318d483SMichal Simek rted r0, do_page_fault 6279814cc11SMichal Simek addik r5, r1, PTO /* parameter struct pt_regs * regs */ 628ca54502bSMichal Simek 629ca54502bSMichal SimekC_ENTRY(page_fault_instr_trap): 630ca54502bSMichal Simek SAVE_STATE /* Save registers.*/ 63106a54604SMichal Simek /* PC, before IRQ/trap - this is one instruction above */ 63206a54604SMichal Simek swi r17, r1, PTO+PT_PC; 63306a54604SMichal Simek tovirt(r1,r1) 634ca54502bSMichal Simek /* where the trap should return need -8 to adjust for rtsd r15, 8 */ 635b9ea77e2SMichal Simek addik r15, r0, ret_from_exc-8 636ca54502bSMichal Simek mfs r6, rear /* parameter unsigned long address */ 637ca54502bSMichal Simek nop 638ca54502bSMichal Simek ori r7, r0, 0 /* parameter unsigned long error_code */ 6399814cc11SMichal Simek rted r0, do_page_fault 6409814cc11SMichal Simek addik r5, r1, PTO /* parameter struct pt_regs * regs */ 641ca54502bSMichal Simek 642ca54502bSMichal Simek/* Entry point used to return from an exception. */ 643ca54502bSMichal SimekC_ENTRY(ret_from_exc): 644ca54502bSMichal Simek lwi r11, r1, PTO + PT_MODE; 645ca54502bSMichal Simek bnei r11, 2f; /* See if returning to kernel mode, */ 646ca54502bSMichal Simek /* ... if so, skip resched &c. */ 647ca54502bSMichal Simek 648ca54502bSMichal Simek /* We're returning to user mode, so check for various conditions that 649ca54502bSMichal Simek trigger rescheduling. */ 650b1d70c62SMichal Simek lwi r11, CURRENT_TASK, TS_THREAD_INFO; /* get thread info */ 651ca54502bSMichal Simek lwi r11, r11, TI_FLAGS; /* get flags in thread info */ 652ca54502bSMichal Simek andi r11, r11, _TIF_NEED_RESCHED; 653ca54502bSMichal Simek beqi r11, 5f; 654ca54502bSMichal Simek 655ca54502bSMichal Simek/* Call the scheduler before returning from a syscall/trap. */ 656ca54502bSMichal Simek bralid r15, schedule; /* Call scheduler */ 657ca54502bSMichal Simek nop; /* delay slot */ 658ca54502bSMichal Simek 659ca54502bSMichal Simek /* Maybe handle a signal */ 660b1d70c62SMichal Simek5: lwi r11, CURRENT_TASK, TS_THREAD_INFO; /* get thread info */ 661ca54502bSMichal Simek lwi r11, r11, TI_FLAGS; /* get flags in thread info */ 662ca54502bSMichal Simek andi r11, r11, _TIF_SIGPENDING; 663ca54502bSMichal Simek beqi r11, 1f; /* Signals to handle, handle them */ 664ca54502bSMichal Simek 665ca54502bSMichal Simek /* 666ca54502bSMichal Simek * Handle a signal return; Pending signals should be in r18. 667ca54502bSMichal Simek * 668ca54502bSMichal Simek * Not all registers are saved by the normal trap/interrupt entry 669ca54502bSMichal Simek * points (for instance, call-saved registers (because the normal 670ca54502bSMichal Simek * C-compiler calling sequence in the kernel makes sure they're 671ca54502bSMichal Simek * preserved), and call-clobbered registers in the case of 672ca54502bSMichal Simek * traps), but signal handlers may want to examine or change the 673ca54502bSMichal Simek * complete register state. Here we save anything not saved by 674ca54502bSMichal Simek * the normal entry sequence, so that it may be safely restored 67536f60954SMichal Simek * (in a possibly modified form) after do_signal returns. */ 676b9ea77e2SMichal Simek addik r5, r1, PTO; /* Arg 1: struct pt_regs *regs */ 677ca54502bSMichal Simek addi r7, r0, 0; /* Arg 3: int in_syscall */ 678ca54502bSMichal Simek bralid r15, do_signal; /* Handle any signals */ 679841d6e8cSMichal Simek add r6, r0, r0; /* Arg 2: sigset_t *oldset */ 680ca54502bSMichal Simek 681ca54502bSMichal Simek/* Finally, return to user state. */ 68296014cc3SMichal Simek1: set_bip; /* Ints masked for state restore */ 6838633bebcSMichal Simek swi CURRENT_TASK, r0, PER_CPU(CURRENT_SAVE); /* save current */ 684ca54502bSMichal Simek VM_OFF; 685ca54502bSMichal Simek tophys(r1,r1); 686ca54502bSMichal Simek 687ca54502bSMichal Simek RESTORE_REGS; 688ca54502bSMichal Simek addik r1, r1, STATE_SAVE_SIZE /* Clean up stack space. */ 689ca54502bSMichal Simek 690ca54502bSMichal Simek lwi r1, r1, PT_R1 - PT_SIZE; /* Restore user stack pointer. */ 691ca54502bSMichal Simek bri 6f; 692ca54502bSMichal Simek/* Return to kernel state. */ 69396014cc3SMichal Simek2: set_bip; /* Ints masked for state restore */ 69496014cc3SMichal Simek VM_OFF; 695ca54502bSMichal Simek tophys(r1,r1); 696ca54502bSMichal Simek RESTORE_REGS; 697ca54502bSMichal Simek addik r1, r1, STATE_SAVE_SIZE /* Clean up stack space. */ 698ca54502bSMichal Simek 699ca54502bSMichal Simek tovirt(r1,r1); 700ca54502bSMichal Simek6: 701ca54502bSMichal SimekEXC_return: /* Make global symbol for debugging */ 702ca54502bSMichal Simek rtbd r14, 0; /* Instructions to return from an IRQ */ 703ca54502bSMichal Simek nop; 704ca54502bSMichal Simek 705ca54502bSMichal Simek/* 706ca54502bSMichal Simek * HW EXCEPTION rutine end 707ca54502bSMichal Simek */ 708ca54502bSMichal Simek 709ca54502bSMichal Simek/* 710ca54502bSMichal Simek * Hardware maskable interrupts. 711ca54502bSMichal Simek * 712ca54502bSMichal Simek * The stack-pointer (r1) should have already been saved to the memory 713ca54502bSMichal Simek * location PER_CPU(ENTRY_SP). 714ca54502bSMichal Simek */ 715ca54502bSMichal SimekC_ENTRY(_interrupt): 716ca54502bSMichal Simek/* MS: we are in physical address */ 717ca54502bSMichal Simek/* Save registers, switch to proper stack, convert SP to virtual.*/ 718ca54502bSMichal Simek swi r1, r0, TOPHYS(PER_CPU(ENTRY_SP)) 719ca54502bSMichal Simek /* MS: See if already in kernel mode. */ 720653e447eSMichal Simek mfs r1, rmsr 7215c0d72b1SMichal Simek nop 722653e447eSMichal Simek andi r1, r1, MSR_UMS 723653e447eSMichal Simek bnei r1, 1f 724ca54502bSMichal Simek 725ca54502bSMichal Simek/* Kernel-mode state save. */ 726653e447eSMichal Simek lwi r1, r0, TOPHYS(PER_CPU(ENTRY_SP)) 727653e447eSMichal Simek tophys(r1,r1); /* MS: I have in r1 physical address where stack is */ 728ca54502bSMichal Simek /* save registers */ 729ca54502bSMichal Simek/* MS: Make room on the stack -> activation record */ 730ca54502bSMichal Simek addik r1, r1, -STATE_SAVE_SIZE; 731ca54502bSMichal Simek SAVE_REGS 73277f6d226SMichal Simek swi r1, r1, PTO + PT_MODE; /* 0 - user mode, 1 - kernel mode */ 733ca54502bSMichal Simek brid 2f; 734ca54502bSMichal Simek nop; /* MS: Fill delay slot */ 735ca54502bSMichal Simek 736ca54502bSMichal Simek1: 737ca54502bSMichal Simek/* User-mode state save. */ 738ca54502bSMichal Simek /* MS: get the saved current */ 739ca54502bSMichal Simek lwi r1, r0, TOPHYS(PER_CPU(CURRENT_SAVE)); 740ca54502bSMichal Simek tophys(r1,r1); 741ca54502bSMichal Simek lwi r1, r1, TS_THREAD_INFO; 742ca54502bSMichal Simek addik r1, r1, THREAD_SIZE; 743ca54502bSMichal Simek tophys(r1,r1); 744ca54502bSMichal Simek /* save registers */ 745ca54502bSMichal Simek addik r1, r1, -STATE_SAVE_SIZE; 746ca54502bSMichal Simek SAVE_REGS 747ca54502bSMichal Simek /* calculate mode */ 748ca54502bSMichal Simek swi r0, r1, PTO + PT_MODE; 749ca54502bSMichal Simek lwi r11, r0, TOPHYS(PER_CPU(ENTRY_SP)); 750ca54502bSMichal Simek swi r11, r1, PTO+PT_R1; 751ca54502bSMichal Simek2: 752b1d70c62SMichal Simek lwi CURRENT_TASK, r0, TOPHYS(PER_CPU(CURRENT_SAVE)); 753ca54502bSMichal Simek tovirt(r1,r1) 754b9ea77e2SMichal Simek addik r5, r1, PTO; 755ca54502bSMichal Simek set_vms; 756b9ea77e2SMichal Simek addik r11, r0, do_IRQ; 757b9ea77e2SMichal Simek addik r15, r0, irq_call; 758ca54502bSMichal Simekirq_call:rtbd r11, 0; 759ca54502bSMichal Simek nop; 760ca54502bSMichal Simek 761ca54502bSMichal Simek/* MS: we are in virtual mode */ 762ca54502bSMichal Simekret_from_irq: 763ca54502bSMichal Simek lwi r11, r1, PTO + PT_MODE; 764ca54502bSMichal Simek bnei r11, 2f; 765ca54502bSMichal Simek 766b1d70c62SMichal Simek lwi r11, CURRENT_TASK, TS_THREAD_INFO; 767ca54502bSMichal Simek lwi r11, r11, TI_FLAGS; /* MS: get flags from thread info */ 768ca54502bSMichal Simek andi r11, r11, _TIF_NEED_RESCHED; 769ca54502bSMichal Simek beqi r11, 5f 770ca54502bSMichal Simek bralid r15, schedule; 771ca54502bSMichal Simek nop; /* delay slot */ 772ca54502bSMichal Simek 773ca54502bSMichal Simek /* Maybe handle a signal */ 774b1d70c62SMichal Simek5: lwi r11, CURRENT_TASK, TS_THREAD_INFO; /* MS: get thread info */ 775ca54502bSMichal Simek lwi r11, r11, TI_FLAGS; /* get flags in thread info */ 776ca54502bSMichal Simek andi r11, r11, _TIF_SIGPENDING; 777ca54502bSMichal Simek beqid r11, no_intr_resched 778ca54502bSMichal Simek/* Handle a signal return; Pending signals should be in r18. */ 779ca54502bSMichal Simek addi r7, r0, 0; /* Arg 3: int in_syscall */ 780b9ea77e2SMichal Simek addik r5, r1, PTO; /* Arg 1: struct pt_regs *regs */ 781ca54502bSMichal Simek bralid r15, do_signal; /* Handle any signals */ 782ca54502bSMichal Simek add r6, r0, r0; /* Arg 2: sigset_t *oldset */ 783ca54502bSMichal Simek 784ca54502bSMichal Simek/* Finally, return to user state. */ 785ca54502bSMichal Simekno_intr_resched: 786ca54502bSMichal Simek /* Disable interrupts, we are now committed to the state restore */ 787ca54502bSMichal Simek disable_irq 7888633bebcSMichal Simek swi CURRENT_TASK, r0, PER_CPU(CURRENT_SAVE); 789ca54502bSMichal Simek VM_OFF; 790ca54502bSMichal Simek tophys(r1,r1); 791ca54502bSMichal Simek RESTORE_REGS 792ca54502bSMichal Simek addik r1, r1, STATE_SAVE_SIZE /* MS: Clean up stack space. */ 793ca54502bSMichal Simek lwi r1, r1, PT_R1 - PT_SIZE; 794ca54502bSMichal Simek bri 6f; 795ca54502bSMichal Simek/* MS: Return to kernel state. */ 79677753790SMichal Simek2: 79777753790SMichal Simek#ifdef CONFIG_PREEMPT 798b1d70c62SMichal Simek lwi r11, CURRENT_TASK, TS_THREAD_INFO; 79977753790SMichal Simek /* MS: get preempt_count from thread info */ 80077753790SMichal Simek lwi r5, r11, TI_PREEMPT_COUNT; 80177753790SMichal Simek bgti r5, restore; 80277753790SMichal Simek 80377753790SMichal Simek lwi r5, r11, TI_FLAGS; /* get flags in thread info */ 80477753790SMichal Simek andi r5, r5, _TIF_NEED_RESCHED; 80577753790SMichal Simek beqi r5, restore /* if zero jump over */ 80677753790SMichal Simek 80777753790SMichal Simekpreempt: 80877753790SMichal Simek /* interrupts are off that's why I am calling preempt_chedule_irq */ 80977753790SMichal Simek bralid r15, preempt_schedule_irq 81077753790SMichal Simek nop 811b1d70c62SMichal Simek lwi r11, CURRENT_TASK, TS_THREAD_INFO; /* get thread info */ 81277753790SMichal Simek lwi r5, r11, TI_FLAGS; /* get flags in thread info */ 81377753790SMichal Simek andi r5, r5, _TIF_NEED_RESCHED; 81477753790SMichal Simek bnei r5, preempt /* if non zero jump to resched */ 81577753790SMichal Simekrestore: 81677753790SMichal Simek#endif 81777753790SMichal Simek VM_OFF /* MS: turn off MMU */ 818ca54502bSMichal Simek tophys(r1,r1) 819ca54502bSMichal Simek RESTORE_REGS 820ca54502bSMichal Simek addik r1, r1, STATE_SAVE_SIZE /* MS: Clean up stack space. */ 821ca54502bSMichal Simek tovirt(r1,r1); 822ca54502bSMichal Simek6: 823ca54502bSMichal SimekIRQ_return: /* MS: Make global symbol for debugging */ 824ca54502bSMichal Simek rtid r14, 0 825ca54502bSMichal Simek nop 826ca54502bSMichal Simek 827ca54502bSMichal Simek/* 828ca54502bSMichal Simek * `Debug' trap 829ca54502bSMichal Simek * We enter dbtrap in "BIP" (breakpoint) mode. 830ca54502bSMichal Simek * So we exit the breakpoint mode with an 'rtbd' and proceed with the 831ca54502bSMichal Simek * original dbtrap. 832ca54502bSMichal Simek * however, wait to save state first 833ca54502bSMichal Simek */ 834ca54502bSMichal SimekC_ENTRY(_debug_exception): 835ca54502bSMichal Simek /* BIP bit is set on entry, no interrupts can occur */ 836ca54502bSMichal Simek swi r1, r0, TOPHYS(PER_CPU(ENTRY_SP)) 837ca54502bSMichal Simek 838653e447eSMichal Simek mfs r1, rmsr 8395c0d72b1SMichal Simek nop 840653e447eSMichal Simek andi r1, r1, MSR_UMS 841653e447eSMichal Simek bnei r1, 1f 842ca54502bSMichal Simek /* Kernel-mode state save. */ 843653e447eSMichal Simek lwi r1, r0, TOPHYS(PER_CPU(ENTRY_SP)); /* Reload kernel stack-ptr*/ 844653e447eSMichal Simek tophys(r1,r1); 845ca54502bSMichal Simek 846ca54502bSMichal Simek addik r1, r1, -STATE_SAVE_SIZE; /* Make room on the stack. */ 847ca54502bSMichal Simek SAVE_REGS; 848ca54502bSMichal Simek 84977f6d226SMichal Simek swi r1, r1, PTO + PT_MODE; 850ca54502bSMichal Simek brid 2f; 851ca54502bSMichal Simek nop; /* Fill delay slot */ 852ca54502bSMichal Simek1: /* User-mode state save. */ 853ca54502bSMichal Simek lwi r1, r0, TOPHYS(PER_CPU(CURRENT_SAVE)); /* get saved current */ 854ca54502bSMichal Simek tophys(r1,r1); 855ca54502bSMichal Simek lwi r1, r1, TS_THREAD_INFO; /* get the thread info */ 856ca54502bSMichal Simek addik r1, r1, THREAD_SIZE; /* calculate kernel stack pointer */ 857ca54502bSMichal Simek tophys(r1,r1); 858ca54502bSMichal Simek 859ca54502bSMichal Simek addik r1, r1, -STATE_SAVE_SIZE; /* Make room on the stack. */ 860ca54502bSMichal Simek SAVE_REGS; 861ca54502bSMichal Simek 862ca54502bSMichal Simek swi r0, r1, PTO + PT_MODE; /* Was in user-mode. */ 863ca54502bSMichal Simek lwi r11, r0, TOPHYS(PER_CPU(ENTRY_SP)); 864ca54502bSMichal Simek swi r11, r1, PTO+PT_R1; /* Store user SP. */ 865653e447eSMichal Simek2: 866ca54502bSMichal Simek tovirt(r1,r1) 867ca54502bSMichal Simek 86806b28640SMichal Simek set_vms; 869ca54502bSMichal Simek addi r5, r0, SIGTRAP /* send the trap signal */ 870ca54502bSMichal Simek add r6, r0, CURRENT_TASK; /* Get current task ptr into r11 */ 871ca54502bSMichal Simek addk r7, r0, r0 /* 3rd param zero */ 87206b28640SMichal Simekdbtrap_call: rtbd r0, send_sig; 873b9ea77e2SMichal Simek addik r15, r0, dbtrap_call; 874ca54502bSMichal Simek 875ca54502bSMichal Simek set_bip; /* Ints masked for state restore*/ 876ca54502bSMichal Simek lwi r11, r1, PTO + PT_MODE; 877ca54502bSMichal Simek bnei r11, 2f; 878ca54502bSMichal Simek 879ca54502bSMichal Simek /* Get current task ptr into r11 */ 880b1d70c62SMichal Simek lwi r11, CURRENT_TASK, TS_THREAD_INFO; /* get thread info */ 881ca54502bSMichal Simek lwi r11, r11, TI_FLAGS; /* get flags in thread info */ 882ca54502bSMichal Simek andi r11, r11, _TIF_NEED_RESCHED; 883ca54502bSMichal Simek beqi r11, 5f; 884ca54502bSMichal Simek 885ca54502bSMichal Simek/* Call the scheduler before returning from a syscall/trap. */ 886ca54502bSMichal Simek 887ca54502bSMichal Simek bralid r15, schedule; /* Call scheduler */ 888ca54502bSMichal Simek nop; /* delay slot */ 889ca54502bSMichal Simek /* XXX Is PT_DTRACE handling needed here? */ 890ca54502bSMichal Simek /* XXX m68knommu also checks TASK_STATE & TASK_COUNTER here. */ 891ca54502bSMichal Simek 892ca54502bSMichal Simek /* Maybe handle a signal */ 893b1d70c62SMichal Simek5: lwi r11, CURRENT_TASK, TS_THREAD_INFO; /* get thread info */ 894ca54502bSMichal Simek lwi r11, r11, TI_FLAGS; /* get flags in thread info */ 895ca54502bSMichal Simek andi r11, r11, _TIF_SIGPENDING; 896ca54502bSMichal Simek beqi r11, 1f; /* Signals to handle, handle them */ 897ca54502bSMichal Simek 898ca54502bSMichal Simek/* Handle a signal return; Pending signals should be in r18. */ 899ca54502bSMichal Simek /* Not all registers are saved by the normal trap/interrupt entry 900ca54502bSMichal Simek points (for instance, call-saved registers (because the normal 901ca54502bSMichal Simek C-compiler calling sequence in the kernel makes sure they're 902ca54502bSMichal Simek preserved), and call-clobbered registers in the case of 903ca54502bSMichal Simek traps), but signal handlers may want to examine or change the 904ca54502bSMichal Simek complete register state. Here we save anything not saved by 905ca54502bSMichal Simek the normal entry sequence, so that it may be safely restored 906ca54502bSMichal Simek (in a possibly modified form) after do_signal returns. */ 907ca54502bSMichal Simek 908b9ea77e2SMichal Simek addik r5, r1, PTO; /* Arg 1: struct pt_regs *regs */ 909ca54502bSMichal Simek addi r7, r0, 0; /* Arg 3: int in_syscall */ 910ca54502bSMichal Simek bralid r15, do_signal; /* Handle any signals */ 911841d6e8cSMichal Simek add r6, r0, r0; /* Arg 2: sigset_t *oldset */ 912ca54502bSMichal Simek 913ca54502bSMichal Simek 914ca54502bSMichal Simek/* Finally, return to user state. */ 9155c0d72b1SMichal Simek1: 9168633bebcSMichal Simek swi CURRENT_TASK, r0, PER_CPU(CURRENT_SAVE); /* save current */ 917ca54502bSMichal Simek VM_OFF; 918ca54502bSMichal Simek tophys(r1,r1); 919ca54502bSMichal Simek 920ca54502bSMichal Simek RESTORE_REGS 921ca54502bSMichal Simek addik r1, r1, STATE_SAVE_SIZE /* Clean up stack space. */ 922ca54502bSMichal Simek 923ca54502bSMichal Simek 924ca54502bSMichal Simek lwi r1, r1, PT_R1 - PT_SIZE; 925ca54502bSMichal Simek /* Restore user stack pointer. */ 926ca54502bSMichal Simek bri 6f; 927ca54502bSMichal Simek 928ca54502bSMichal Simek/* Return to kernel state. */ 929ca54502bSMichal Simek2: VM_OFF; 930ca54502bSMichal Simek tophys(r1,r1); 931ca54502bSMichal Simek RESTORE_REGS 932ca54502bSMichal Simek addik r1, r1, STATE_SAVE_SIZE /* Clean up stack space. */ 933ca54502bSMichal Simek 934ca54502bSMichal Simek tovirt(r1,r1); 935ca54502bSMichal Simek6: 936ca54502bSMichal SimekDBTRAP_return: /* Make global symbol for debugging */ 937ca54502bSMichal Simek rtbd r14, 0; /* Instructions to return from an IRQ */ 938ca54502bSMichal Simek nop; 939ca54502bSMichal Simek 940ca54502bSMichal Simek 941ca54502bSMichal Simek 942ca54502bSMichal SimekENTRY(_switch_to) 943ca54502bSMichal Simek /* prepare return value */ 944b1d70c62SMichal Simek addk r3, r0, CURRENT_TASK 945ca54502bSMichal Simek 946ca54502bSMichal Simek /* save registers in cpu_context */ 947ca54502bSMichal Simek /* use r11 and r12, volatile registers, as temp register */ 948ca54502bSMichal Simek /* give start of cpu_context for previous process */ 949ca54502bSMichal Simek addik r11, r5, TI_CPU_CONTEXT 950ca54502bSMichal Simek swi r1, r11, CC_R1 951ca54502bSMichal Simek swi r2, r11, CC_R2 952ca54502bSMichal Simek /* skip volatile registers. 953ca54502bSMichal Simek * they are saved on stack when we jumped to _switch_to() */ 954ca54502bSMichal Simek /* dedicated registers */ 955ca54502bSMichal Simek swi r13, r11, CC_R13 956ca54502bSMichal Simek swi r14, r11, CC_R14 957ca54502bSMichal Simek swi r15, r11, CC_R15 958ca54502bSMichal Simek swi r16, r11, CC_R16 959ca54502bSMichal Simek swi r17, r11, CC_R17 960ca54502bSMichal Simek swi r18, r11, CC_R18 961ca54502bSMichal Simek /* save non-volatile registers */ 962ca54502bSMichal Simek swi r19, r11, CC_R19 963ca54502bSMichal Simek swi r20, r11, CC_R20 964ca54502bSMichal Simek swi r21, r11, CC_R21 965ca54502bSMichal Simek swi r22, r11, CC_R22 966ca54502bSMichal Simek swi r23, r11, CC_R23 967ca54502bSMichal Simek swi r24, r11, CC_R24 968ca54502bSMichal Simek swi r25, r11, CC_R25 969ca54502bSMichal Simek swi r26, r11, CC_R26 970ca54502bSMichal Simek swi r27, r11, CC_R27 971ca54502bSMichal Simek swi r28, r11, CC_R28 972ca54502bSMichal Simek swi r29, r11, CC_R29 973ca54502bSMichal Simek swi r30, r11, CC_R30 974ca54502bSMichal Simek /* special purpose registers */ 975ca54502bSMichal Simek mfs r12, rmsr 976ca54502bSMichal Simek nop 977ca54502bSMichal Simek swi r12, r11, CC_MSR 978ca54502bSMichal Simek mfs r12, rear 979ca54502bSMichal Simek nop 980ca54502bSMichal Simek swi r12, r11, CC_EAR 981ca54502bSMichal Simek mfs r12, resr 982ca54502bSMichal Simek nop 983ca54502bSMichal Simek swi r12, r11, CC_ESR 984ca54502bSMichal Simek mfs r12, rfsr 985ca54502bSMichal Simek nop 986ca54502bSMichal Simek swi r12, r11, CC_FSR 987ca54502bSMichal Simek 988b1d70c62SMichal Simek /* update r31, the current-give me pointer to task which will be next */ 989b1d70c62SMichal Simek lwi CURRENT_TASK, r6, TI_TASK 990ca54502bSMichal Simek /* stored it to current_save too */ 991b1d70c62SMichal Simek swi CURRENT_TASK, r0, PER_CPU(CURRENT_SAVE) 992ca54502bSMichal Simek 993ca54502bSMichal Simek /* get new process' cpu context and restore */ 994ca54502bSMichal Simek /* give me start where start context of next task */ 995ca54502bSMichal Simek addik r11, r6, TI_CPU_CONTEXT 996ca54502bSMichal Simek 997ca54502bSMichal Simek /* non-volatile registers */ 998ca54502bSMichal Simek lwi r30, r11, CC_R30 999ca54502bSMichal Simek lwi r29, r11, CC_R29 1000ca54502bSMichal Simek lwi r28, r11, CC_R28 1001ca54502bSMichal Simek lwi r27, r11, CC_R27 1002ca54502bSMichal Simek lwi r26, r11, CC_R26 1003ca54502bSMichal Simek lwi r25, r11, CC_R25 1004ca54502bSMichal Simek lwi r24, r11, CC_R24 1005ca54502bSMichal Simek lwi r23, r11, CC_R23 1006ca54502bSMichal Simek lwi r22, r11, CC_R22 1007ca54502bSMichal Simek lwi r21, r11, CC_R21 1008ca54502bSMichal Simek lwi r20, r11, CC_R20 1009ca54502bSMichal Simek lwi r19, r11, CC_R19 1010ca54502bSMichal Simek /* dedicated registers */ 1011ca54502bSMichal Simek lwi r18, r11, CC_R18 1012ca54502bSMichal Simek lwi r17, r11, CC_R17 1013ca54502bSMichal Simek lwi r16, r11, CC_R16 1014ca54502bSMichal Simek lwi r15, r11, CC_R15 1015ca54502bSMichal Simek lwi r14, r11, CC_R14 1016ca54502bSMichal Simek lwi r13, r11, CC_R13 1017ca54502bSMichal Simek /* skip volatile registers */ 1018ca54502bSMichal Simek lwi r2, r11, CC_R2 1019ca54502bSMichal Simek lwi r1, r11, CC_R1 1020ca54502bSMichal Simek 1021ca54502bSMichal Simek /* special purpose registers */ 1022ca54502bSMichal Simek lwi r12, r11, CC_FSR 1023ca54502bSMichal Simek mts rfsr, r12 1024ca54502bSMichal Simek nop 1025ca54502bSMichal Simek lwi r12, r11, CC_MSR 1026ca54502bSMichal Simek mts rmsr, r12 1027ca54502bSMichal Simek nop 1028ca54502bSMichal Simek 1029ca54502bSMichal Simek rtsd r15, 8 1030ca54502bSMichal Simek nop 1031ca54502bSMichal Simek 1032ca54502bSMichal SimekENTRY(_reset) 1033ca54502bSMichal Simek brai 0x70; /* Jump back to FS-boot */ 1034ca54502bSMichal Simek 1035ca54502bSMichal SimekENTRY(_break) 1036ca54502bSMichal Simek mfs r5, rmsr 1037ca54502bSMichal Simek nop 1038ca54502bSMichal Simek swi r5, r0, 0x250 + TOPHYS(r0_ram) 1039ca54502bSMichal Simek mfs r5, resr 1040ca54502bSMichal Simek nop 1041ca54502bSMichal Simek swi r5, r0, 0x254 + TOPHYS(r0_ram) 1042ca54502bSMichal Simek bri 0 1043ca54502bSMichal Simek 1044ca54502bSMichal Simek /* These are compiled and loaded into high memory, then 1045ca54502bSMichal Simek * copied into place in mach_early_setup */ 1046ca54502bSMichal Simek .section .init.ivt, "ax" 1047ca54502bSMichal Simek .org 0x0 1048ca54502bSMichal Simek /* this is very important - here is the reset vector */ 1049ca54502bSMichal Simek /* in current MMU branch you don't care what is here - it is 1050ca54502bSMichal Simek * used from bootloader site - but this is correct for FS-BOOT */ 1051ca54502bSMichal Simek brai 0x70 1052ca54502bSMichal Simek nop 1053ca54502bSMichal Simek brai TOPHYS(_user_exception); /* syscall handler */ 1054ca54502bSMichal Simek brai TOPHYS(_interrupt); /* Interrupt handler */ 1055ca54502bSMichal Simek brai TOPHYS(_break); /* nmi trap handler */ 1056ca54502bSMichal Simek brai TOPHYS(_hw_exception_handler); /* HW exception handler */ 1057ca54502bSMichal Simek 1058ca54502bSMichal Simek .org 0x60 1059ca54502bSMichal Simek brai TOPHYS(_debug_exception); /* debug trap handler*/ 1060ca54502bSMichal Simek 1061ca54502bSMichal Simek.section .rodata,"a" 1062ca54502bSMichal Simek#include "syscall_table.S" 1063ca54502bSMichal Simek 1064ca54502bSMichal Simeksyscall_table_size=(.-sys_call_table) 1065ca54502bSMichal Simek 1066ce3266c0SSteven J. Magnanitype_SYSCALL: 1067ce3266c0SSteven J. Magnani .ascii "SYSCALL\0" 1068ce3266c0SSteven J. Magnanitype_IRQ: 1069ce3266c0SSteven J. Magnani .ascii "IRQ\0" 1070ce3266c0SSteven J. Magnanitype_IRQ_PREEMPT: 1071ce3266c0SSteven J. Magnani .ascii "IRQ (PREEMPTED)\0" 1072ce3266c0SSteven J. Magnanitype_SYSCALL_PREEMPT: 1073ce3266c0SSteven J. Magnani .ascii " SYSCALL (PREEMPTED)\0" 1074ce3266c0SSteven J. Magnani 1075ce3266c0SSteven J. Magnani /* 1076ce3266c0SSteven J. Magnani * Trap decoding for stack unwinder 1077ce3266c0SSteven J. Magnani * Tuples are (start addr, end addr, string) 1078ce3266c0SSteven J. Magnani * If return address lies on [start addr, end addr], 1079ce3266c0SSteven J. Magnani * unwinder displays 'string' 1080ce3266c0SSteven J. Magnani */ 1081ce3266c0SSteven J. Magnani 1082ce3266c0SSteven J. Magnani .align 4 1083ce3266c0SSteven J. Magnani.global microblaze_trap_handlers 1084ce3266c0SSteven J. Magnanimicroblaze_trap_handlers: 1085ce3266c0SSteven J. Magnani /* Exact matches come first */ 1086ce3266c0SSteven J. Magnani .word ret_from_trap; .word ret_from_trap ; .word type_SYSCALL 1087ce3266c0SSteven J. Magnani .word ret_from_irq ; .word ret_from_irq ; .word type_IRQ 1088ce3266c0SSteven J. Magnani /* Fuzzy matches go here */ 1089ce3266c0SSteven J. Magnani .word ret_from_irq ; .word no_intr_resched ; .word type_IRQ_PREEMPT 1090ce3266c0SSteven J. Magnani .word ret_from_trap; .word TRAP_return ; .word type_SYSCALL_PREEMPT 1091ce3266c0SSteven J. Magnani /* End of table */ 1092ce3266c0SSteven J. Magnani .word 0 ; .word 0 ; .word 0 1093