2022-04-30 23:03:22 +00:00
|
|
|
#ifndef ASM_H
|
|
|
|
#define ASM_H
|
|
|
|
|
|
|
|
#ifdef __sgi
|
|
|
|
#define _MIPS_ISA_MIPS1 1
|
|
|
|
#define _MIPS_ISA_MIPS2 2
|
|
|
|
#define _MIPS_ISA_MIPS3 3
|
|
|
|
#define _MIPS_ISA_MIPS4 4
|
2024-12-28 20:18:45 +00:00
|
|
|
|
|
|
|
#define _MIPS_SIM_ABI32 1 /* MIPS MSIG calling convention */
|
|
|
|
#define _MIPS_SIM_NABI32 2 /* MIPS new 32-bit abi */
|
|
|
|
/* NABI32 is 64bit calling convention but 32bit type sizes) */
|
|
|
|
#define _MIPS_SIM_ABI64 3 /* MIPS 64 calling convention */
|
2022-04-30 23:03:22 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef _LANGUAGE_C
|
|
|
|
|
2024-12-28 20:18:45 +00:00
|
|
|
#ifdef __GNUC__
|
|
|
|
#define TYPE(x, t) .type x, @t
|
|
|
|
#define SIZE(x) .size x, . - x
|
|
|
|
#else
|
|
|
|
#define TYPE(x, t)
|
|
|
|
#define SIZE(x)
|
|
|
|
#endif
|
|
|
|
|
2022-04-30 23:03:22 +00:00
|
|
|
#define LEAF(x) \
|
2024-12-28 20:18:45 +00:00
|
|
|
.align 2 ;\
|
2022-04-30 23:03:22 +00:00
|
|
|
.globl x ;\
|
2024-12-28 20:18:45 +00:00
|
|
|
TYPE(x, function) ;\
|
|
|
|
.ent x, 0 ;\
|
2022-04-30 23:03:22 +00:00
|
|
|
x: ;\
|
2024-12-28 20:18:45 +00:00
|
|
|
.frame sp, 0, ra
|
2022-04-30 23:03:22 +00:00
|
|
|
|
|
|
|
#define XLEAF(x) \
|
2024-12-28 20:18:45 +00:00
|
|
|
.align 2 ;\
|
2022-04-30 23:03:22 +00:00
|
|
|
.globl x ;\
|
2024-12-28 20:18:45 +00:00
|
|
|
TYPE(x, function) ;\
|
|
|
|
.aent x, 0 ;\
|
|
|
|
x:
|
2022-04-30 23:03:22 +00:00
|
|
|
|
|
|
|
#define NESTED(x, fsize, ra) \
|
|
|
|
.globl x ;\
|
2024-12-28 20:18:45 +00:00
|
|
|
.ent x, 0 ;\
|
2022-04-30 23:03:22 +00:00
|
|
|
x: ;\
|
2024-12-28 20:18:45 +00:00
|
|
|
.frame sp, fsize, ra
|
2022-04-30 23:03:22 +00:00
|
|
|
|
|
|
|
#define XNESTED(x) \
|
|
|
|
.globl x ;\
|
2024-12-28 20:18:45 +00:00
|
|
|
.aent x, 0 ;\
|
|
|
|
x:
|
2022-04-30 23:03:22 +00:00
|
|
|
|
|
|
|
#define END(x) \
|
2024-12-28 20:18:45 +00:00
|
|
|
SIZE(x) ;\
|
2022-04-30 23:03:22 +00:00
|
|
|
.end x
|
|
|
|
|
|
|
|
#define EXPORT(x) \
|
|
|
|
.globl x ;\
|
|
|
|
x:
|
|
|
|
|
2024-12-28 20:18:45 +00:00
|
|
|
#ifdef __sgi
|
|
|
|
#define IMPORT(sym, size) \
|
|
|
|
.extern sym, size
|
|
|
|
#else
|
|
|
|
#define IMPORT(sym, size)
|
|
|
|
#endif
|
|
|
|
|
2022-04-30 23:03:22 +00:00
|
|
|
#define DATA(x) \
|
2024-12-28 20:18:45 +00:00
|
|
|
.align 2 ;\
|
2022-04-30 23:03:22 +00:00
|
|
|
.globl x ;\
|
2024-12-28 20:18:45 +00:00
|
|
|
TYPE(x, object) ;\
|
2022-04-30 23:03:22 +00:00
|
|
|
x:
|
|
|
|
|
|
|
|
#define ENDDATA(x) \
|
2024-12-28 20:18:45 +00:00
|
|
|
SIZE(x)
|
|
|
|
|
|
|
|
#define MFC0(dst, src) \
|
|
|
|
.set noreorder; mfc0 dst, src; .set reorder
|
|
|
|
#define MTC0(dst, src) \
|
|
|
|
.set noreorder; mtc0 dst, src; .set reorder
|
|
|
|
|
|
|
|
#define CFC1(dst, src) \
|
|
|
|
.set noreorder; cfc1 dst, src; .set reorder
|
|
|
|
#define CTC1(src, dst) \
|
|
|
|
.set noreorder; ctc1 src, dst; .set reorder
|
|
|
|
|
|
|
|
#define NOP \
|
|
|
|
.set noreorder; nop; .set reorder
|
|
|
|
|
|
|
|
#define TLBWI \
|
|
|
|
.set noreorder; tlbwi; .set reorder
|
|
|
|
|
|
|
|
#define TLBR \
|
|
|
|
.set noreorder; tlbr; .set reorder
|
|
|
|
|
|
|
|
#define TLBP \
|
|
|
|
.set noreorder; tlbp; .set reorder
|
|
|
|
|
|
|
|
#ifdef __sgi
|
|
|
|
#define ABS(x, y) \
|
|
|
|
.globl x; \
|
|
|
|
x = y
|
|
|
|
#else
|
|
|
|
#define ABS(x, y) \
|
|
|
|
.globl x; \
|
|
|
|
.set x, y
|
|
|
|
#endif
|
2022-04-30 23:03:22 +00:00
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Stack Alignment
|
|
|
|
*/
|
|
|
|
#if (_MIPS_SIM == _ABIO32)
|
2024-12-28 20:18:45 +00:00
|
|
|
#define NARGSAVE 4 /* space for 4 args must be allocated */
|
2022-04-30 23:03:22 +00:00
|
|
|
#define ALSZ (8-1)
|
|
|
|
#define ALMASK ~(8-1)
|
|
|
|
#elif (_MIPS_SIM == _ABIN32 || _MIPS_SIM == _ABI64)
|
2024-12-28 20:18:45 +00:00
|
|
|
#define NARGSAVE 0 /* no caller responsibilities */
|
2022-04-30 23:03:22 +00:00
|
|
|
#define ALSZ (16-1)
|
|
|
|
#define ALMASK ~(16-1)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define FRAMESZ(size) (((size) + ALSZ) & ALMASK)
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Register Size
|
|
|
|
*/
|
|
|
|
#if (_MIPS_ISA == _MIPS_ISA_MIPS1 || _MIPS_ISA == _MIPS_ISA_MIPS2)
|
|
|
|
#define SZREG 4
|
|
|
|
#elif (_MIPS_ISA == _MIPS_ISA_MIPS3 || _MIPS_ISA == _MIPS_ISA_MIPS4)
|
|
|
|
#define SZREG 8
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|