2003-12-04 16:05:15 +03:00
|
|
|
/* $NetBSD: asm.h,v 1.27 2003/12/04 13:05:15 keihan Exp $ */
|
1995-02-14 02:06:39 +03:00
|
|
|
|
|
|
|
/*
|
1996-04-12 05:36:51 +04:00
|
|
|
* Copyright (c) 1991,1990,1989,1994,1995,1996 Carnegie Mellon University
|
1995-02-14 02:06:39 +03:00
|
|
|
* All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Permission to use, copy, modify and distribute this software and its
|
|
|
|
* documentation is hereby granted, provided that both the copyright
|
|
|
|
* notice and this permission notice appear in all copies of the
|
|
|
|
* software, derivative works or modified versions, and any portions
|
|
|
|
* thereof, and that both notices appear in supporting documentation.
|
|
|
|
*
|
|
|
|
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
|
|
|
|
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
|
|
|
|
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
|
|
|
|
*
|
|
|
|
* Carnegie Mellon requests users of this software to return to
|
|
|
|
*
|
|
|
|
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
|
|
|
|
* School of Computer Science
|
|
|
|
* Carnegie Mellon University
|
|
|
|
* Pittsburgh PA 15213-3890
|
|
|
|
*
|
|
|
|
* any improvements or extensions that they make and grant Carnegie Mellon
|
|
|
|
* the rights to redistribute these changes.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Assembly coding style
|
|
|
|
*
|
|
|
|
* This file contains macros and register defines to
|
|
|
|
* aid in writing more readable assembly code.
|
|
|
|
* Some rules to make assembly code understandable by
|
|
|
|
* a debugger are also noted.
|
|
|
|
*
|
|
|
|
* The document
|
|
|
|
*
|
|
|
|
* "ALPHA Calling Standard", DEC 27-Apr-90
|
|
|
|
*
|
|
|
|
* defines (a superset of) the rules and conventions
|
|
|
|
* we use. While we make no promise of adhering to
|
|
|
|
* such standard and its evolution (esp where we
|
|
|
|
* can get faster code paths) it is certainly intended
|
|
|
|
* that we be interoperable with such standard.
|
|
|
|
*
|
|
|
|
* In this sense, this file is a proper part of the
|
|
|
|
* definition of the (software) Alpha architecture.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Symbolic register names and register saving rules
|
|
|
|
*
|
|
|
|
* Legend:
|
|
|
|
* T Saved by caller (Temporaries)
|
|
|
|
* S Saved by callee (call-Safe registers)
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define v0 $0 /* (T) return value */
|
|
|
|
#define t0 $1 /* (T) temporary registers */
|
|
|
|
#define t1 $2
|
|
|
|
#define t2 $3
|
|
|
|
#define t3 $4
|
|
|
|
#define t4 $5
|
|
|
|
#define t5 $6
|
|
|
|
#define t6 $7
|
|
|
|
#define t7 $8
|
|
|
|
|
|
|
|
#define s0 $9 /* (S) call-safe registers */
|
|
|
|
#define s1 $10
|
|
|
|
#define s2 $11
|
|
|
|
#define s3 $12
|
|
|
|
#define s4 $13
|
|
|
|
#define s5 $14
|
|
|
|
#define s6 $15
|
|
|
|
#define a0 $16 /* (T) argument registers */
|
|
|
|
#define a1 $17
|
|
|
|
#define a2 $18
|
|
|
|
#define a3 $19
|
|
|
|
#define a4 $20
|
|
|
|
#define a5 $21
|
|
|
|
#define t8 $22 /* (T) temporary registers */
|
|
|
|
#define t9 $23
|
|
|
|
#define t10 $24
|
|
|
|
#define t11 $25
|
2001-09-06 00:12:53 +04:00
|
|
|
#define ra $26 /* (S) return address */
|
1995-02-14 02:06:39 +03:00
|
|
|
#define t12 $27 /* (T) another temporary */
|
|
|
|
#define at_reg $28 /* (T) assembler scratch */
|
|
|
|
#define gp $29 /* (T) (local) data pointer */
|
|
|
|
#define sp $30 /* (S) stack pointer */
|
|
|
|
#define zero $31 /* wired zero */
|
|
|
|
|
|
|
|
/* Floating point registers (XXXX VERIFY THIS) */
|
|
|
|
#define fv0 $f0 /* (T) return value (real) */
|
|
|
|
#define fv1 $f1 /* (T) return value (imaginary)*/
|
|
|
|
#define ft0 fv1
|
|
|
|
#define fs0 $f2 /* (S) call-safe registers */
|
|
|
|
#define fs1 $f3
|
|
|
|
#define fs2 $f4
|
|
|
|
#define fs3 $f5
|
|
|
|
#define fs4 $f6
|
|
|
|
#define fs5 $f7
|
|
|
|
#define fs6 $f8
|
|
|
|
#define fs7 $f9
|
|
|
|
#define ft1 $f10 /* (T) temporary registers */
|
|
|
|
#define ft2 $f11
|
|
|
|
#define ft3 $f12
|
|
|
|
#define ft4 $f13
|
|
|
|
#define ft5 $f14
|
|
|
|
#define ft6 $f15
|
|
|
|
#define fa0 $f16 /* (T) argument registers */
|
|
|
|
#define fa1 $f17
|
|
|
|
#define fa2 $f18
|
|
|
|
#define fa3 $f19
|
|
|
|
#define fa4 $f20
|
|
|
|
#define fa5 $f21
|
|
|
|
#define ft7 $f22 /* (T) more temporaries */
|
|
|
|
#define ft8 $f23
|
|
|
|
#define ft9 $f24
|
|
|
|
#define ft10 $f25
|
|
|
|
#define ft11 $f26
|
|
|
|
#define ft12 $f27
|
|
|
|
#define ft13 $f28
|
|
|
|
#define ft14 $f29
|
|
|
|
#define ft15 $f30
|
|
|
|
#define fzero $f31 /* wired zero */
|
|
|
|
|
|
|
|
|
|
|
|
/* Other DEC standard names */
|
|
|
|
#define ai $25 /* (T) argument information */
|
|
|
|
#define pv $27 /* (T) procedure value */
|
|
|
|
|
1996-10-17 06:49:04 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Useful stuff.
|
|
|
|
*/
|
|
|
|
#ifdef __STDC__
|
|
|
|
#define __CONCAT(a,b) a ## b
|
|
|
|
#else
|
|
|
|
#define __CONCAT(a,b) a/**/b
|
|
|
|
#endif
|
|
|
|
#define ___CONCAT(a,b) __CONCAT(a,b)
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Macro to make a local label name.
|
|
|
|
*/
|
|
|
|
#define LLABEL(name,num) ___CONCAT(___CONCAT(L,name),num)
|
|
|
|
|
1995-02-14 02:06:39 +03:00
|
|
|
/*
|
|
|
|
*
|
|
|
|
* Debuggers need symbol table information to be able to properly
|
|
|
|
* decode a stack trace. The minimum that should be provided is:
|
|
|
|
*
|
|
|
|
* name:
|
|
|
|
* .proc name,numargs
|
|
|
|
*
|
|
|
|
* where "name" is the function's name;
|
|
|
|
* "numargs" how many arguments it expects. For varargs
|
|
|
|
* procedures this should be a negative number,
|
|
|
|
* indicating the minimum required number of
|
|
|
|
* arguments (which is at least 1);
|
|
|
|
*
|
|
|
|
* NESTED functions (functions that call other functions) should define
|
|
|
|
* how they handle their stack frame in a .frame directive:
|
|
|
|
*
|
|
|
|
* .frame framesize, pc_reg, i_mask, f_mask
|
|
|
|
*
|
|
|
|
* where "framesize" is the size of the frame for this function, in bytes.
|
|
|
|
* That is:
|
|
|
|
* new_sp + framesize == old_sp
|
|
|
|
* Framesizes should be rounded to a cacheline size.
|
|
|
|
* Note that old_sp plays the role of a conventional
|
|
|
|
* "frame pointer";
|
|
|
|
* "pc_reg" is either a register which preserves the caller's PC
|
|
|
|
* or 'std', if std the saved PC should be stored at
|
|
|
|
* old_sp-8
|
|
|
|
* "i_mask" is a bitmask that indicates which of the integer
|
|
|
|
* registers are saved. See the M_xx defines at the
|
|
|
|
* end for the encoding of this 32bit value.
|
|
|
|
* "f_mask" is the same, for floating point registers.
|
|
|
|
*
|
1997-11-03 07:22:00 +03:00
|
|
|
* Note, 10/31/97: This is interesting but it isn't the way gcc outputs
|
|
|
|
* frame directives and it isn't the way the macros below output them
|
|
|
|
* either. Frame directives look like this:
|
|
|
|
*
|
|
|
|
* .frame $15,framesize,$26,0
|
|
|
|
*
|
|
|
|
* If no fp is set up then $30 should be used instead of $15.
|
|
|
|
* Also, gdb expects to find a <lda sp,-framesize(sp)> at the beginning
|
|
|
|
* of a procedure. Don't use things like sub sp,framesize,sp for this
|
2003-12-04 16:05:15 +03:00
|
|
|
* reason. End Note 10/31/97. ross@NetBSD.org
|
1997-11-03 07:22:00 +03:00
|
|
|
*
|
1995-02-14 02:06:39 +03:00
|
|
|
* Note that registers should be saved starting at "old_sp-8", where the
|
|
|
|
* return address should be stored. Other registers follow at -16-24-32..
|
|
|
|
* starting from register 0 (if saved) and up. Then float registers (ifany)
|
|
|
|
* are saved.
|
|
|
|
*
|
|
|
|
* If you need to alias a leaf function, or to provide multiple entry points
|
|
|
|
* use the LEAF() macro for the main entry point and XLEAF() for the other
|
|
|
|
* additional/alternate entry points.
|
|
|
|
* "XLEAF"s must be nested within a "LEAF" and a ".end".
|
|
|
|
* Similar rules for nested routines, e.g. use NESTED/XNESTED
|
|
|
|
* Symbols that should not be exported can be declared with the STATIC_xxx
|
|
|
|
* macros.
|
|
|
|
*
|
|
|
|
* All functions must be terminated by the END macro
|
|
|
|
*
|
|
|
|
* It is conceivable, although currently at the limits of compiler
|
|
|
|
* technology, that while performing inter-procedural optimizations
|
|
|
|
* the compiler/linker be able to avoid unnecessary register spills
|
|
|
|
* if told about the register usage of LEAF procedures (and by transitive
|
|
|
|
* closure of NESTED procedures as well). Assembly code can help
|
|
|
|
* this process using the .reguse directive:
|
|
|
|
*
|
|
|
|
* .reguse i_mask, f_mask
|
|
|
|
*
|
|
|
|
* where the register masks are built as above or-ing M_xx defines.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* All symbols are internal unless EXPORTed. Symbols that are IMPORTed
|
|
|
|
* must be appropriately described to the debugger.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
1995-11-23 05:33:17 +03:00
|
|
|
/*
|
|
|
|
* MCOUNT
|
|
|
|
*/
|
|
|
|
|
1996-11-30 05:48:57 +03:00
|
|
|
#ifndef GPROF
|
1995-11-23 05:33:17 +03:00
|
|
|
#define MCOUNT /* nothing */
|
|
|
|
#else
|
|
|
|
#define MCOUNT \
|
1996-09-16 02:42:29 +04:00
|
|
|
.set noat; \
|
|
|
|
jsr at_reg,_mcount; \
|
|
|
|
.set at
|
1995-11-23 05:33:17 +03:00
|
|
|
#endif
|
1997-11-03 07:22:00 +03:00
|
|
|
/*
|
|
|
|
* PALVECT, ESETUP, and ERSAVE
|
|
|
|
* Declare a palcode transfer point, and carefully construct
|
|
|
|
* gdb symbols with an unusual _negative_ register-save offset
|
|
|
|
* so that gdb can find the otherwise lost PC and then
|
|
|
|
* invert the vector for traceback. Also, fix up framesize,
|
|
|
|
* allowing for the palframe for the same reason.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define PALVECT(_name_) \
|
|
|
|
ESETUP(_name_); \
|
|
|
|
ERSAVE()
|
|
|
|
|
|
|
|
#define ESETUP(_name_) \
|
2001-12-18 07:15:45 +03:00
|
|
|
/* .loc 1 __LINE__; */ \
|
1997-11-03 07:22:00 +03:00
|
|
|
.globl _name_; \
|
|
|
|
.ent _name_ 0; \
|
|
|
|
_name_:; \
|
|
|
|
.set noat; \
|
|
|
|
lda sp,-(FRAME_SW_SIZE*8)(sp); \
|
|
|
|
.frame $30,(FRAME_SW_SIZE+6)*8,$26,0; /* give gdb the real size */\
|
|
|
|
.mask 0x4000000,-0x28; \
|
|
|
|
.set at
|
|
|
|
|
|
|
|
#define ERSAVE() \
|
|
|
|
.set noat; \
|
|
|
|
stq at_reg,(FRAME_AT*8)(sp); \
|
|
|
|
.set at; \
|
|
|
|
stq ra,(FRAME_RA*8)(sp); \
|
2001-12-18 07:15:45 +03:00
|
|
|
/* .loc 1 __LINE__; */ \
|
1997-11-03 07:22:00 +03:00
|
|
|
bsr ra,exception_save_regs /* jmp/CALL trashes pv/t12 */
|
|
|
|
|
1995-11-23 05:33:17 +03:00
|
|
|
|
1995-02-14 02:06:39 +03:00
|
|
|
/*
|
|
|
|
* LEAF
|
|
|
|
* Declare a global leaf function.
|
|
|
|
* A leaf function does not call other functions AND does not
|
|
|
|
* use any register that is callee-saved AND does not modify
|
|
|
|
* the stack pointer.
|
|
|
|
*/
|
|
|
|
#define LEAF(_name_,_n_args_) \
|
|
|
|
.globl _name_; \
|
|
|
|
.ent _name_ 0; \
|
1995-11-23 05:33:17 +03:00
|
|
|
_name_:; \
|
|
|
|
.frame sp,0,ra; \
|
|
|
|
MCOUNT
|
|
|
|
/* should have been
|
|
|
|
.proc _name_,_n_args_; \
|
|
|
|
.frame 0,ra,0,0
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define LEAF_NOPROFILE(_name_,_n_args_) \
|
|
|
|
.globl _name_; \
|
|
|
|
.ent _name_ 0; \
|
1995-02-14 02:06:39 +03:00
|
|
|
_name_:; \
|
|
|
|
.frame sp,0,ra
|
|
|
|
/* should have been
|
|
|
|
.proc _name_,_n_args_; \
|
|
|
|
.frame 0,ra,0,0
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* STATIC_LEAF
|
|
|
|
* Declare a local leaf function.
|
|
|
|
*/
|
|
|
|
#define STATIC_LEAF(_name_,_n_args_) \
|
|
|
|
.ent _name_ 0; \
|
|
|
|
_name_:; \
|
1995-11-23 05:33:17 +03:00
|
|
|
.frame sp,0,ra; \
|
|
|
|
MCOUNT
|
1995-02-14 02:06:39 +03:00
|
|
|
/* should have been
|
|
|
|
.proc _name_,_n_args_; \
|
|
|
|
.frame 0,ra,0,0
|
|
|
|
*/
|
|
|
|
/*
|
|
|
|
* XLEAF
|
|
|
|
* Global alias for a leaf function, or alternate entry point
|
|
|
|
*/
|
|
|
|
#define XLEAF(_name_,_n_args_) \
|
|
|
|
.globl _name_; \
|
|
|
|
.aent _name_ 0; \
|
|
|
|
_name_:
|
|
|
|
/* should have been
|
|
|
|
.aproc _name_,_n_args_;
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* STATIC_XLEAF
|
|
|
|
* Local alias for a leaf function, or alternate entry point
|
|
|
|
*/
|
|
|
|
#define STATIC_XLEAF(_name_,_n_args_) \
|
|
|
|
.aent _name_ 0; \
|
|
|
|
_name_:
|
|
|
|
/* should have been
|
|
|
|
.aproc _name_,_n_args_;
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* NESTED
|
|
|
|
* Declare a (global) nested function
|
|
|
|
* A nested function calls other functions and needs
|
|
|
|
* therefore stack space to save/restore registers.
|
|
|
|
*/
|
|
|
|
#define NESTED(_name_, _n_args_, _framesize_, _pc_reg_, _i_mask_, _f_mask_ ) \
|
|
|
|
.globl _name_; \
|
|
|
|
.ent _name_ 0; \
|
1995-11-23 05:33:17 +03:00
|
|
|
_name_:; \
|
|
|
|
.frame sp,_framesize_,_pc_reg_; \
|
|
|
|
.livereg _i_mask_,_f_mask_; \
|
|
|
|
MCOUNT
|
|
|
|
/* should have been
|
|
|
|
.proc _name_,_n_args_; \
|
|
|
|
.frame _framesize_, _pc_reg_, _i_mask_, _f_mask_
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define NESTED_NOPROFILE(_name_, _n_args_, _framesize_, _pc_reg_, _i_mask_, _f_mask_ ) \
|
|
|
|
.globl _name_; \
|
|
|
|
.ent _name_ 0; \
|
1995-02-14 02:06:39 +03:00
|
|
|
_name_:; \
|
|
|
|
.frame sp,_framesize_,_pc_reg_; \
|
|
|
|
.livereg _i_mask_,_f_mask_
|
|
|
|
/* should have been
|
|
|
|
.proc _name_,_n_args_; \
|
|
|
|
.frame _framesize_, _pc_reg_, _i_mask_, _f_mask_
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* STATIC_NESTED
|
|
|
|
* Declare a local nested function.
|
|
|
|
*/
|
|
|
|
#define STATIC_NESTED(_name_, _n_args_, _framesize_, _pc_reg_, _i_mask_, _f_mask_ ) \
|
|
|
|
.ent _name_ 0; \
|
|
|
|
_name_:; \
|
|
|
|
.frame sp,_framesize_,_pc_reg_; \
|
1995-11-23 05:33:17 +03:00
|
|
|
.livereg _i_mask_,_f_mask_; \
|
|
|
|
MCOUNT
|
1995-02-14 02:06:39 +03:00
|
|
|
/* should have been
|
|
|
|
.proc _name_,_n_args_; \
|
|
|
|
.frame _framesize_, _pc_reg_, _i_mask_, _f_mask_
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* XNESTED
|
|
|
|
* Same as XLEAF, for a nested function.
|
|
|
|
*/
|
|
|
|
#define XNESTED(_name_,_n_args_) \
|
|
|
|
.globl _name_; \
|
|
|
|
.aent _name_ 0; \
|
|
|
|
_name_:
|
|
|
|
/* should have been
|
|
|
|
.aproc _name_,_n_args_;
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* STATIC_XNESTED
|
|
|
|
* Same as STATIC_XLEAF, for a nested function.
|
|
|
|
*/
|
|
|
|
#define STATIC_XNESTED(_name_,_n_args_) \
|
|
|
|
.aent _name_ 0; \
|
|
|
|
_name_:
|
|
|
|
/* should have been
|
|
|
|
.aproc _name_,_n_args_;
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* END
|
|
|
|
* Function delimiter
|
|
|
|
*/
|
|
|
|
#define END(_name_) \
|
|
|
|
.end _name_
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* CALL
|
|
|
|
* Function invocation
|
|
|
|
*/
|
|
|
|
#define CALL(_name_) \
|
2001-12-18 07:15:45 +03:00
|
|
|
/* .loc 1 __LINE__; */ \
|
1995-02-14 02:06:39 +03:00
|
|
|
jsr ra,_name_; \
|
|
|
|
ldgp gp,0(ra)
|
|
|
|
/* but this would cover longer jumps
|
|
|
|
br ra,.+4; \
|
|
|
|
bsr ra,_name_
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* RET
|
|
|
|
* Return from function
|
|
|
|
*/
|
|
|
|
#define RET \
|
|
|
|
ret zero,(ra),1
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* EXPORT
|
|
|
|
* Export a symbol
|
|
|
|
*/
|
|
|
|
#define EXPORT(_name_) \
|
|
|
|
.globl _name_; \
|
|
|
|
_name_:
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* IMPORT
|
|
|
|
* Make an external name visible, typecheck the size
|
|
|
|
*/
|
|
|
|
#define IMPORT(_name_, _size_) \
|
|
|
|
.extern _name_,_size_
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* ABS
|
|
|
|
* Define an absolute symbol
|
|
|
|
*/
|
|
|
|
#define ABS(_name_, _value_) \
|
|
|
|
.globl _name_; \
|
|
|
|
_name_ = _value_
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* BSS
|
|
|
|
* Allocate un-initialized space for a global symbol
|
|
|
|
*/
|
|
|
|
#define BSS(_name_,_numbytes_) \
|
|
|
|
.comm _name_,_numbytes_
|
|
|
|
|
|
|
|
/*
|
|
|
|
* VECTOR
|
|
|
|
* Make an exception entry point look like a called function,
|
|
|
|
* to make it digestible to the debugger (KERNEL only)
|
|
|
|
*/
|
|
|
|
#define VECTOR(_name_, _i_mask_) \
|
|
|
|
.globl _name_; \
|
|
|
|
.ent _name_ 0; \
|
|
|
|
_name_:; \
|
|
|
|
.mask _i_mask_|IM_EXC,0; \
|
|
|
|
.frame sp,MSS_SIZE,ra;
|
1998-03-27 04:17:18 +03:00
|
|
|
/* .livereg _i_mask_|IM_EXC,0 */
|
1995-02-14 02:06:39 +03:00
|
|
|
/* should have been
|
|
|
|
.proc _name_,1; \
|
|
|
|
.frame MSS_SIZE,$31,_i_mask_,0; \
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* MSG
|
|
|
|
* Allocate space for a message (a read-only ascii string)
|
|
|
|
*/
|
|
|
|
#define ASCIZ .asciz
|
1996-09-16 02:42:29 +04:00
|
|
|
#define MSG(msg,reg,label) \
|
|
|
|
lda reg, label; \
|
1995-02-14 02:06:39 +03:00
|
|
|
.data; \
|
1996-09-16 02:42:29 +04:00
|
|
|
label: ASCIZ msg; \
|
1995-02-14 02:06:39 +03:00
|
|
|
.text;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* PRINTF
|
|
|
|
* Print a message
|
|
|
|
*/
|
1996-09-16 02:42:29 +04:00
|
|
|
#define PRINTF(msg,label) \
|
|
|
|
MSG(msg,a0,label); \
|
1996-10-13 06:59:38 +04:00
|
|
|
CALL(printf)
|
1995-02-14 02:06:39 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* PANIC
|
|
|
|
* Fatal error (KERNEL)
|
|
|
|
*/
|
1996-09-16 02:42:29 +04:00
|
|
|
#define PANIC(msg,label) \
|
|
|
|
MSG(msg,a0,label); \
|
1995-02-14 02:06:39 +03:00
|
|
|
CALL(panic)
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Register mask defines, used to define both save
|
|
|
|
* and use register sets.
|
|
|
|
*
|
|
|
|
* NOTE: The bit order should HAVE BEEN maintained when saving
|
|
|
|
* registers on the stack: sp goes at the highest
|
|
|
|
* address, gp lower on the stack, etc etc
|
|
|
|
* BUT NOONE CARES ABOUT DEBUGGERS AT MIPS
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define IM_EXC 0x80000000
|
|
|
|
#define IM_SP 0x40000000
|
|
|
|
#define IM_GP 0x20000000
|
|
|
|
#define IM_AT 0x10000000
|
|
|
|
#define IM_T12 0x08000000
|
|
|
|
# define IM_PV IM_T4
|
|
|
|
#define IM_RA 0x04000000
|
|
|
|
#define IM_T11 0x02000000
|
|
|
|
# define IM_AI IM_T3
|
|
|
|
#define IM_T10 0x01000000
|
|
|
|
#define IM_T9 0x00800000
|
|
|
|
#define IM_T8 0x00400000
|
|
|
|
#define IM_A5 0x00200000
|
|
|
|
#define IM_A4 0x00100000
|
|
|
|
#define IM_A3 0x00080000
|
|
|
|
#define IM_A2 0x00040000
|
|
|
|
#define IM_A1 0x00020000
|
|
|
|
#define IM_A0 0x00010000
|
|
|
|
#define IM_S6 0x00008000
|
|
|
|
#define IM_S5 0x00004000
|
|
|
|
#define IM_S4 0x00002000
|
|
|
|
#define IM_S3 0x00001000
|
|
|
|
#define IM_S2 0x00000800
|
|
|
|
#define IM_S1 0x00000400
|
|
|
|
#define IM_S0 0x00000200
|
|
|
|
#define IM_T7 0x00000100
|
|
|
|
#define IM_T6 0x00000080
|
|
|
|
#define IM_T5 0x00000040
|
|
|
|
#define IM_T4 0x00000020
|
|
|
|
#define IM_T3 0x00000010
|
|
|
|
#define IM_T2 0x00000008
|
|
|
|
#define IM_T1 0x00000004
|
|
|
|
#define IM_T0 0x00000002
|
|
|
|
#define IM_V0 0x00000001
|
|
|
|
|
|
|
|
#define FM_T15 0x40000000
|
|
|
|
#define FM_T14 0x20000000
|
|
|
|
#define FM_T13 0x10000000
|
|
|
|
#define FM_T12 0x08000000
|
|
|
|
#define FM_T11 0x04000000
|
|
|
|
#define FM_T10 0x02000000
|
|
|
|
#define FM_T9 0x01000000
|
|
|
|
#define FM_T8 0x00800000
|
|
|
|
#define FM_T7 0x00400000
|
|
|
|
#define FM_A5 0x00200000
|
|
|
|
#define FM_A4 0x00100000
|
|
|
|
#define FM_A3 0x00080000
|
|
|
|
#define FM_A2 0x00040000
|
|
|
|
#define FM_A1 0x00020000
|
|
|
|
#define FM_A0 0x00010000
|
|
|
|
#define FM_T6 0x00008000
|
|
|
|
#define FM_T5 0x00004000
|
|
|
|
#define FM_T4 0x00002000
|
|
|
|
#define FM_T3 0x00001000
|
|
|
|
#define FM_T2 0x00000800
|
|
|
|
#define FM_T1 0x00000400
|
|
|
|
#define FM_S7 0x00000200
|
|
|
|
#define FM_S6 0x00000100
|
|
|
|
#define FM_S5 0x00000080
|
|
|
|
#define FM_S4 0x00000040
|
|
|
|
#define FM_S3 0x00000020
|
|
|
|
#define FM_S2 0x00000010
|
|
|
|
#define FM_S1 0x00000008
|
|
|
|
#define FM_S0 0x00000004
|
|
|
|
#define FM_T0 0x00000002
|
|
|
|
#define FM_V1 FM_T0
|
|
|
|
#define FM_V0 0x00000001
|
|
|
|
|
1997-09-06 05:23:52 +04:00
|
|
|
/* Pull in PAL "function" codes. */
|
|
|
|
#include <machine/pal.h>
|
1996-10-17 06:49:04 +04:00
|
|
|
|
1995-02-14 02:06:39 +03:00
|
|
|
/*
|
1996-10-17 06:49:04 +04:00
|
|
|
* System call glue.
|
1995-02-14 02:06:39 +03:00
|
|
|
*/
|
1996-10-17 06:49:04 +04:00
|
|
|
#define SYSCALLNUM(name) \
|
|
|
|
___CONCAT(SYS_,name)
|
1995-02-14 02:06:39 +03:00
|
|
|
|
1996-10-17 06:49:04 +04:00
|
|
|
#define CALLSYS_NOERROR(name) \
|
|
|
|
ldiq v0, SYSCALLNUM(name); \
|
|
|
|
call_pal PAL_OSF1_callsys
|
1995-02-14 02:06:39 +03:00
|
|
|
|
1998-10-01 20:19:59 +04:00
|
|
|
#define LINUX_SYSCALLNUM(name) \
|
|
|
|
___CONCAT(LINUX_SYS_,name)
|
|
|
|
|
|
|
|
#define LINUX_CALLSYS_NOERROR(name) \
|
|
|
|
ldiq v0, LINUX_SYSCALLNUM(name); \
|
|
|
|
call_pal PAL_OSF1_callsys
|
|
|
|
|
1996-10-17 06:49:04 +04:00
|
|
|
/*
|
|
|
|
* Load the global pointer.
|
|
|
|
*/
|
|
|
|
#define LDGP(reg) \
|
|
|
|
ldgp gp, 0(reg)
|
1996-10-17 22:33:53 +04:00
|
|
|
|
|
|
|
/*
|
2001-12-18 20:12:32 +03:00
|
|
|
* WEAK_ALIAS: create a weak alias.
|
1996-10-17 22:33:53 +04:00
|
|
|
*/
|
|
|
|
#define WEAK_ALIAS(alias,sym) \
|
|
|
|
.weak alias; \
|
|
|
|
alias = sym
|
1997-04-08 04:19:01 +04:00
|
|
|
|
1998-12-02 03:58:42 +03:00
|
|
|
/*
|
2001-12-18 20:12:32 +03:00
|
|
|
* WARN_REFERENCES: create a warning if the specified symbol is referenced.
|
1998-12-02 03:58:42 +03:00
|
|
|
*/
|
|
|
|
#ifdef __STDC__
|
|
|
|
#define WARN_REFERENCES(_sym,_msg) \
|
|
|
|
.section .gnu.warning. ## _sym ; .ascii _msg ; .text
|
|
|
|
#else
|
|
|
|
#define WARN_REFERENCES(_sym,_msg) \
|
|
|
|
.section .gnu.warning./**/_sym ; .ascii _msg ; .text
|
|
|
|
#endif /* __STDC__ */
|
|
|
|
|
1997-04-08 04:19:01 +04:00
|
|
|
/*
|
|
|
|
* Kernel RCS ID tag and copyright macros
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef _KERNEL
|
|
|
|
|
|
|
|
#define __KERNEL_SECTIONSTRING(_sec, _str) \
|
|
|
|
.section _sec ; .asciz _str ; .text
|
|
|
|
|
|
|
|
#define __KERNEL_RCSID(_n, _s) __KERNEL_SECTIONSTRING(.ident, _s)
|
|
|
|
#define __KERNEL_COPYRIGHT(_n, _s) __KERNEL_SECTIONSTRING(.copyright, _s)
|
|
|
|
|
|
|
|
#ifdef NO_KERNEL_RCSIDS
|
|
|
|
#undef __KERNEL_RCSID
|
|
|
|
#define __KERNEL_RCSID(_n, _s) /* nothing */
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /* _KERNEL */
|