📄 regwinflush.s
字号:
/* LEON2/3 LIBIO low-level routines Written by Jiri Gaisler. Copyright (C) 2004 Gaisler Research AB 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, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA*//* * regwin.s for LEON */#include <asm-leon/leon.h>#include <asm-leon/leonstack.h>#include <asm-leon/asmmacro.h> .seg "text" #define _SV save %sp, -SF_REGS_SZ, %sp#define _RS restore /* ------- */ .weak _flush_windows .set _flush_windows,__flush_windows .weak _flush_windows_svt .set _flush_windows_svt,__flush_windows_svt /* ------- */ !.global _flush_windows,_flush_windows_svt__flush_windows_svt: __flush_windows: SAVE_ALL#ifndef _FLAT wr %l0, SPARC_PSR_ET_MASK, %psr nop; nop; nop _SV; _SV; _SV; _SV; _SV; _SV; _SV; _RS; _RS; _RS; _RS; _RS; _RS; _RS; /* Advance over the trap instruction. */ ld [%sp + SF_REGS_SZ + PT_NPC], %l1 add %l1, 0x4, %l2 st %l1, [%sp + SF_REGS_SZ + PT_PC] st %l2, [%sp + SF_REGS_SZ + PT_NPC]#endif RESTORE_ALL /* * system call (ta 0x2): * 2: irq_disable: * o1 = 2 * 3: irq_enable: * o0 = old_flags * o1 = 3 * 4: enter supervisor mode (from user mode): * o1 = 4 * 5: enter user mode: * o1 = 5 * * On entry: * * l0 = psr (from trap table) * l1 = pc * l2 = npc * i0 = system call id */ /* ------- */ .weak _irqcall .set _irqcall,__irqcall .weak _irqcall_svt .set _irqcall_svt,__irqcall_svt /* ------- */ !.global _irqcall,_irqcall_svt__irqcall_svt: __irqcall: subcc %i1, 2, %g0 ! syscall 2, disable interrupts bne 3f or %l0, 0x0f00, %l4 ! set PIL=15 mov %l4, %psr or %l0, SPARC_PSR_ET_MASK, %i0 ! return old psr with ET=1 ba,a 9f3: subcc %i1, 3, %g0 ! syscall 3, enable interrupts bne 4f and %i0, SPARC_PSR_PIL_MASK, %l4 andn %l0, SPARC_PSR_PIL_MASK, %l5 or %l5, %l4, %l4 mov %l4, %psr ba,a 9f 4: subcc %i1, 4, %g0 ! syscall 4, enter supervisor bne 5f mov %psr, %l4 or %l4,SPARC_PSR_PS_MASK,%l4 mov %l4, %psr ! set previous supervisor %psr nop; nop; nop ba,a 9f 5: subcc %i1, 5, %g0 ! syscall 5, enter user bne 1f mov %psr, %l4 andn %l4,SPARC_PSR_PS_MASK,%l4 mov %l4, %psr ! clear previous supervisor %psr, return to user mode nop; nop; nop ba,a 9f 1: ta 0 ! halt 9: ! leave jmpl %l2, %g0 rett %l2 + 4 /* call _irqcall through trap */ .global leonbare_enable_traps !void leonbare_enable_traps(unsigned long old_flags); leonbare_enable_traps: set 3,%o1 retl ta 0x2 /* call _irqcall through trap */ .global leonbare_disable_traps !unsigned long leonbare_disable_traps(); leonbare_disable_traps: set 2,%o1 retl ta 0x2
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -