📄 asm_depend.h
字号:
/* *---------------------------------------------------------------------- * T-Kernel * * Copyright (C) 2004 by Ken Sakamura. All rights reserved. * T-Kernel is distributed under the T-License. *---------------------------------------------------------------------- * * Version: 1.01.00 * Released by T-Engine Forum(http://www.t-engine.org) at 2004/6/28. * *---------------------------------------------------------------------- *//* * @(#)asm_depend.h (tk/M32104) * * Assembler Macro for M32104 */#ifndef __TK_ASM_DEPEND_H__#define __TK_ASM_DEPEND_H__/* * For reference of C symbol from assembler * (Example) seth r0, #CsymH(foo) * add3 r0, r0, #CsymL(foo) */#define CsymH(s) shigh(Csym(s))#define CsymL(s) low(Csym(s))/* Get lower 16 bits as signed value */#define slow(n) ( ((n) << 16) / 0x10000 )/* ------------------------------------------------------------------------ *//* * EIT return *//* * Exception/trap return */ .macro EXC_RETURN name ld r6, @sp+ // pop PSW ld r7, @sp+ // pop BPC mvtc r6, psw // Interrupt disable mvtc r7, bpc ld r6, @sp+ // pop R6 ld r7, @sp+ // pop R7 rte .endm/* * Interrupt/exception/trap return */ .macro INT_RETURN name ld r6, @sp+ // pop PSW | ICU1_ISTS mvtc r6, psw // Interrupt disable srl3 r7, r6, #16 // If ICU1_ISTS=0, not ext. interrupt beqz r7, notint_\name ld24 r7, #ICU1_IMASK st r6, @r7 // ICU1_IMASK = ICU1_ISTS notint_\name: ld r7, @sp+ // pop BPC mvtc r7, bpc ld r6, @sp+ // pop R6 ld r7, @sp+ // pop R7 rte .endm/* ------------------------------------------------------------------------ *//* * Task exception handler entry */ .macro TEXHDR_ENTRY texhdr st r14, @-sp // Register save st r5, @-sp st r4, @-sp st r3, @-sp st r2, @-sp st r1, @-sp st r0, @-sp mvfachi r6 mvfaclo r5 st r6, @-sp st r5, @-sp mv r0, r7 // texcd bl \texhdr // call texhdr(texcd) ld r5, @sp+ // Register restore ld r6, @sp+ mvtaclo r5 mvtachi r6 ld r0, @sp+ ld r1, @sp+ ld r2, @sp+ ld r3, @sp+ ld r4, @sp+ ld r5, @sp+ ld r14, @sp+ ld r6, @sp+ // pop PSW ld r7, @sp+ // pop BPC mvtc r6, psw // Interrupt disable mvtc r7, bpc ld r6, @sp+ // pop R6 ld r7, @sp+ // pop R7 rte .endm/* ------------------------------------------------------------------------ */#endif /* __TK_ASM_DEPEND_H__ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -