📄 sysdefs.h
字号:
/************************************************************************ * * sysdefs.h * * System definitions * * ###################################################################### * * mips_start_of_legal_notice * * Copyright (c) 2004 MIPS Technologies, Inc. All rights reserved. * * * Unpublished rights (if any) reserved under the copyright laws of the * United States of America and other countries. * * This code is proprietary to MIPS Technologies, Inc. ("MIPS * Technologies"). Any copying, reproducing, modifying or use of this code * (in whole or in part) that is not expressly permitted in writing by MIPS * Technologies or an authorized third party is strictly prohibited. At a * minimum, this code is protected under unfair competition and copyright * laws. Violations thereof may result in criminal penalties and fines. * * MIPS Technologies reserves the right to change this code to improve * function, design or otherwise. MIPS Technologies does not assume any * liability arising out of the application or use of this code, or of any * error or omission in such code. Any warranties, whether express, * statutory, implied or otherwise, including but not limited to the implied * warranties of merchantability or fitness for a particular purpose, are * excluded. Except as expressly provided in any written license agreement * from MIPS Technologies or an authorized third party, the furnishing of * this code does not give recipient any license to any intellectual * property rights, including any patent rights, that cover this code. * * This code shall not be exported, reexported, transferred, or released, * directly or indirectly, in violation of the law of any country or * international law, regulation, treaty, Executive Order, statute, * amendments or supplements thereto. Should a conflict arise regarding the * export, reexport, transfer, or release of this code, the laws of the * United States of America shall be the governing law. * * This code constitutes one or more of the following: commercial computer * software, commercial computer software documentation or other commercial * items. If the user of this code, or any related documentation of any * kind, including related technical data or manuals, is an agency, * department, or other entity of the United States government * ("Government"), the use, duplication, reproduction, release, * modification, disclosure, or transfer of this code, or any related * documentation of any kind, is restricted in accordance with Federal * Acquisition Regulation 12.212 for civilian agencies and Defense Federal * Acquisition Regulation Supplement 227.7202 for military agencies. The use * of this code by the Government is further restricted in accordance with * the terms of the license agreement(s) and/or applicable contract terms * and conditions covering this code from MIPS Technologies or an authorized * third party. * * * * * mips_end_of_legal_notice * * ************************************************************************/#ifndef SYSDEFS_H#define SYSDEFS_H/************************************************************************ * Include files ************************************************************************//************************************************************************ * Definitions*************************************************************************/#ifdef __ghs__#define _GHS_#endif#ifdef _ASSEMBLER_/******** ASSEMBLER SPECIFIC DEFINITIONS ********/#ifdef __ghs__#define ALIGN(x) .##align (1 << (x))#else#define ALIGN(x) .##align (x)#endif#ifdef __ghs__#define SET_MIPS3()#define SET_MIPS0()#define SET_PUSH()#define SET_POP()#else#define SET_MIPS3() .##set mips3#define SET_MIPS0() .##set mips0#define SET_PUSH() .##set push#define SET_POP() .##set pop#endif/* Different assemblers have different requirements for how to * indicate that the next section is bss : * * Some use : .bss * Others use : .section bss * * We select which to use based on _BSS_OLD_, which may be defined * in makefile. */#ifdef _BSS_OLD_#define BSS .##section bss#else#define BSS .##bss#endif#define SWAPEND32( src, tmp0, tmp1 )\ and tmp0, src, 0xff;\ srl src, 8;\ sll tmp0, 8;\ and tmp1, src, 0xff;\ or tmp0, tmp1;\ srl src, 8;\ sll tmp0, 8;\ and tmp1, src, 0xff;\ or tmp0, tmp1;\ srl src, 8;\ sll tmp0, 8;\ or src, tmp0#define LEAF(name)\ .##text;\ .##globl name;\ .##ent name;\name:#define SLEAF(name)\ .##text;\ .##ent name;\name:#ifdef __ghs__#define END(name)\ .##end name#else#define END(name)\ .##size name,.-name;\ .##end name#endif#define EXTERN(name)# else /* not assembler *//******** C specific definitions ********/#define SWAPEND32(d) ((BYTE(d,0) << 24) |\ (BYTE(d,1) << 16) |\ (BYTE(d,2) << 8) |\ (BYTE(d,3) << 0))#define SWAPEND64(d) ((BYTE(d,0) << 56) |\ (BYTE(d,1) << 48) |\ (BYTE(d,2) << 40) |\ (BYTE(d,3) << 32) |\ (BYTE(d,4) << 24) |\ (BYTE(d,5) << 16) |\ (BYTE(d,6) << 8) |\ (BYTE(d,7) << 0))typedef unsigned char UINT8;typedef signed char INT8;typedef unsigned short UINT16;typedef signed short INT16;typedef unsigned int UINT32;typedef signed int INT32;typedef unsigned long long UINT64;typedef signed long long INT64;typedef UINT8 bool;#ifndef _SIZE_T_#define _SIZE_T_#ifdef __ghs__ typedef unsigned int size_t;#else typedef unsigned long size_t;#endif#endif#endif /* #ifdef _ASSEMBLER_ *//******** DEFINITIONS FOR BOTH ASSEMBLER AND C ********/#define FALSE 0#define TRUE (!FALSE)#define NULL ((void *)0)#define MIN(x,y) ((x) < (y) ? (x) : (y))#define MAX(x,y) ((x) > (y) ? (x) : (y)) #define INCWRAP( ptr, size ) (ptr) = ((ptr)+1) % (size)#define DECWRAP( ptr, size ) (ptr) = (((ptr) == 0) ? ((size) - 1) : ((ptr) - 1))#define MAXUINT(w) (\ ((w) == sizeof(UINT8)) ? 0xFFU :\ ((w) == sizeof(UINT16)) ? 0xFFFFU :\ ((w) == sizeof(UINT32)) ? 0xFFFFFFFFU : 0\ )#define MAXINT(w) (\ ((w) == sizeof(INT8)) ? 0x7F :\ ((w) == sizeof(INT16)) ? 0x7FFF :\ ((w) == sizeof(INT32)) ? 0x7FFFFFFF : 0\ )#define MSK(n) ((1 << (n)) - 1)#define KUSEG_MSK 0x80000000#define KSEG_MSK 0xE0000000#define KUSEGBASE 0x00000000#define KSEG0BASE 0x80000000#define KSEG1BASE 0xA0000000#define KSSEGBASE 0xC0000000#define KSEG3BASE 0xE0000000/* Below macros perform the following functions : * * KSEG0 : Converts KSEG0/1 or physical addr (below 0.5GB) to KSEG0. * KSEG1 : Converts KSEG0/1 or physical addr (below 0.5GB) to KSEG1. * PHYS : Converts KSEG0/1 or physical addr (below 0.5GB) to physical address. * KSSEG : Not relevant for converting, but used for determining range. * KSEG3 : Not relevant for converting, but used for determining range. * KUSEG : Not relevant for converting, but used for determining range. * KSEG0A : Same as KSEG0 but operates on register rather than constant. * KSEG1A : Same as KSEG1 but operates on register rather than constant.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -