![]() |
|
|||
File indexing completed on 2025-05-11 08:24:25
0001 /** 0002 * @file 0003 * 0004 * @ingroup RTEMSScoreCPUSPARCASM 0005 * 0006 * @brief This header file provides interfaces to address problems caused by 0007 * incompatible flavor of assemblers and toolsets. 0008 * 0009 * This include file attempts to address the problems 0010 * caused by incompatible flavors of assemblers and 0011 * toolsets. It primarily addresses variations in the 0012 * use of leading underscores on symbols and the requirement 0013 * that register names be preceded by a %. 0014 * 0015 * NOTE: The spacing in the use of these macros 0016 * is critical to them working as advertised. 0017 */ 0018 0019 /* 0020 * COPYRIGHT: 0021 * 0022 * This file is based on similar code found in newlib available 0023 * from ftp.cygnus.com. The file which was used had no copyright 0024 * notice. This file is freely distributable as long as the source 0025 * of the file is noted. 0026 */ 0027 0028 #ifndef _RTEMS_ASM_H 0029 #define _RTEMS_ASM_H 0030 0031 /* 0032 * Indicate we are in an assembly file and get the basic CPU definitions. 0033 */ 0034 0035 #ifndef ASM 0036 #define ASM 0037 #endif 0038 0039 #include <rtems/score/cpuopts.h> 0040 #include <rtems/score/cpu.h> 0041 0042 /** 0043 * @defgroup RTEMSScoreCPUSPARCASM SPARC Assembler Support 0044 * 0045 * @ingroup RTEMSScoreCPUSPARC 0046 * 0047 * @brief SPARC Assembler Support 0048 * 0049 * @{ 0050 */ 0051 0052 /* 0053 * Recent versions of GNU cpp define variables which indicate the 0054 * need for underscores and percents. If not using GNU cpp or 0055 * the version does not support this, then you will obviously 0056 * have to define these as appropriate. 0057 */ 0058 0059 /* XXX __USER_LABEL_PREFIX__ and __REGISTER_PREFIX__ do not work on gcc 2.7.0 */ 0060 /* XXX The following ifdef magic fixes the problem but results in a warning */ 0061 /* XXX when compiling assembly code. */ 0062 0063 #ifndef __USER_LABEL_PREFIX__ 0064 #define __USER_LABEL_PREFIX__ _ 0065 #endif 0066 0067 #ifndef __REGISTER_PREFIX__ 0068 #define __REGISTER_PREFIX__ 0069 #endif 0070 0071 /* Use the right prefix for global labels. */ 0072 0073 #define SYM(x) RTEMS_XCONCAT(__USER_LABEL_PREFIX__, x) 0074 0075 /* Use the right prefix for registers. */ 0076 0077 #define REG(x) RTEMS_XCONCAT(__REGISTER_PREFIX__, x) 0078 0079 /* 0080 * define macros for all of the registers on this CPU 0081 * 0082 * EXAMPLE: #define d0 REG (d0) 0083 */ 0084 0085 /* 0086 * Define macros to handle section beginning and ends. 0087 */ 0088 0089 0090 #define BEGIN_CODE_DCL .text 0091 #define END_CODE_DCL 0092 #define BEGIN_DATA_DCL .data 0093 #define END_DATA_DCL 0094 #define BEGIN_CODE .text 0095 #define END_CODE 0096 #define BEGIN_DATA 0097 #define END_DATA 0098 #define BEGIN_BSS 0099 #define END_BSS 0100 #define END 0101 0102 /* 0103 * Following must be tailor for a particular flavor of the C compiler. 0104 * They may need to put underscores in front of the symbols. 0105 */ 0106 0107 #define PUBLIC(sym) .globl SYM (sym) 0108 #define EXTERN(sym) .globl SYM (sym) 0109 0110 /* 0111 * Entry for traps which jump to a programmer-specified trap handler. 0112 */ 0113 0114 #define TRAP(_vector, _handler) \ 0115 mov %psr, %l0 ; \ 0116 sethi %hi(_handler), %l4 ; \ 0117 jmp %l4+%lo(_handler); \ 0118 mov _vector, %l3 0119 0120 /* 0121 * Used for the reset trap to avoid a supervisor instruction 0122 */ 0123 0124 #define RTRAP(_vector, _handler) \ 0125 mov %g0, %l0 ; \ 0126 sethi %hi(_handler), %l4 ; \ 0127 jmp %l4+%lo(_handler); \ 0128 mov _vector, %l3 0129 0130 #endif 0131 0132 /** @} */
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |