1 |
27 |
unneback |
##=============================================================================
|
2 |
|
|
##
|
3 |
|
|
## arch.inc
|
4 |
|
|
##
|
5 |
|
|
## SH architecture assembler header file
|
6 |
|
|
##
|
7 |
|
|
##=============================================================================
|
8 |
|
|
#####ECOSGPLCOPYRIGHTBEGIN####
|
9 |
|
|
## -------------------------------------------
|
10 |
|
|
## This file is part of eCos, the Embedded Configurable Operating System.
|
11 |
|
|
## Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
|
12 |
|
|
##
|
13 |
|
|
## eCos is free software; you can redistribute it and/or modify it under
|
14 |
|
|
## the terms of the GNU General Public License as published by the Free
|
15 |
|
|
## Software Foundation; either version 2 or (at your option) any later version.
|
16 |
|
|
##
|
17 |
|
|
## eCos is distributed in the hope that it will be useful, but WITHOUT ANY
|
18 |
|
|
## WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
19 |
|
|
## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
20 |
|
|
## for more details.
|
21 |
|
|
##
|
22 |
|
|
## You should have received a copy of the GNU General Public License along
|
23 |
|
|
## with eCos; if not, write to the Free Software Foundation, Inc.,
|
24 |
|
|
## 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
|
25 |
|
|
##
|
26 |
|
|
## As a special exception, if other files instantiate templates or use macros
|
27 |
|
|
## or inline functions from this file, or you compile this file and link it
|
28 |
|
|
## with other works to produce a work based on this file, this file does not
|
29 |
|
|
## by itself cause the resulting work to be covered by the GNU General Public
|
30 |
|
|
## License. However the source code for this file must still be made available
|
31 |
|
|
## in accordance with section (3) of the GNU General Public License.
|
32 |
|
|
##
|
33 |
|
|
## This exception does not invalidate any other reasons why a work based on
|
34 |
|
|
## this file might be covered by the GNU General Public License.
|
35 |
|
|
##
|
36 |
|
|
## Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
|
37 |
|
|
## at http://sources.redhat.com/ecos/ecos-license/
|
38 |
|
|
## -------------------------------------------
|
39 |
|
|
#####ECOSGPLCOPYRIGHTEND####
|
40 |
|
|
##=============================================================================
|
41 |
|
|
#######DESCRIPTIONBEGIN####
|
42 |
|
|
##
|
43 |
|
|
## Author(s): jskov
|
44 |
|
|
## Contributors:jskov
|
45 |
|
|
## Date: 2000-02-28
|
46 |
|
|
## Purpose: SH definitions.
|
47 |
|
|
## Description: This file contains various definitions and macros that are
|
48 |
|
|
## useful for writing assembly code for the SH
|
49 |
|
|
## It also includes the variant/platform assembly header file.
|
50 |
|
|
## Usage:
|
51 |
|
|
## #include
|
52 |
|
|
## ...
|
53 |
|
|
##
|
54 |
|
|
##
|
55 |
|
|
######DESCRIPTIONEND####
|
56 |
|
|
##
|
57 |
|
|
##=============================================================================
|
58 |
|
|
|
59 |
|
|
#include
|
60 |
|
|
#include
|
61 |
|
|
|
62 |
|
|
##-----------------------------------------------------------------------------
|
63 |
|
|
## SH entry definitions. This allows _ prefixing to change by modifying
|
64 |
|
|
## the CYG_LABEL_DEFN macro.
|
65 |
|
|
|
66 |
|
|
#define FUNC_START(name) \
|
67 |
|
|
.type CYG_LABEL_DEFN(name),@function; \
|
68 |
|
|
.globl CYG_LABEL_DEFN(name); \
|
69 |
|
|
CYG_LABEL_DEFN(name):
|
70 |
|
|
|
71 |
|
|
#define FUNC_END(name) \
|
72 |
|
|
.globl CYG_LABEL_DEFN(name); \
|
73 |
|
|
CYG_LABEL_DEFN(name):
|
74 |
|
|
|
75 |
|
|
#define SYM_DEF(name) \
|
76 |
|
|
.globl CYG_LABEL_DEFN(name); \
|
77 |
|
|
CYG_LABEL_DEFN(name):
|
78 |
|
|
|
79 |
|
|
#define SYM_PTR_REF(name) \
|
80 |
|
|
.globl CYG_LABEL_DEFN(name); \
|
81 |
|
|
$##name: .long CYG_LABEL_DEFN(name)
|
82 |
|
|
|
83 |
|
|
# We need this macro because the SH assembler is lacking the nice
|
84 |
|
|
# inline immediate constant feature of the ARM assembler. So we have
|
85 |
|
|
# to define constants ourselves, and sometimes we need more than one of
|
86 |
|
|
# the same type. This allows the symbols used to change.
|
87 |
|
|
#define SYM_PTR_REFn(name,n) \
|
88 |
|
|
.globl CYG_LABEL_DEFN(name); \
|
89 |
|
|
$##name##n: .long CYG_LABEL_DEFN(name)
|
90 |
|
|
|
91 |
|
|
#include
|
92 |
|
|
|
93 |
|
|
##-----------------------------------------------------------------------------
|
94 |
|
|
## SH FPU state handling
|
95 |
|
|
## Empty for now.
|
96 |
|
|
|
97 |
|
|
.macro hal_fpu_save regs
|
98 |
|
|
.endm
|
99 |
|
|
|
100 |
|
|
.macro hal_fpu_load regs
|
101 |
|
|
.endm
|
102 |
|
|
|
103 |
|
|
##-----------------------------------------------------------------------------
|
104 |
|
|
## CPU specific macros. These provide a common assembler interface to
|
105 |
|
|
## operations that may have CPU specific implementations on different
|
106 |
|
|
## variants of the architecture.
|
107 |
|
|
|
108 |
|
|
# Enable interrupts
|
109 |
|
|
.macro hal_cpu_int_enable t1,t2
|
110 |
|
|
stc sr,\t1
|
111 |
|
|
mov #CYGARC_REG_SR_IMASK>>1,\t2
|
112 |
|
|
shll \t2
|
113 |
|
|
not \t2,\t2
|
114 |
|
|
and \t2,\t1
|
115 |
|
|
ldc \t1,sr
|
116 |
|
|
.endm
|
117 |
|
|
|
118 |
|
|
# Disable interrupts
|
119 |
|
|
.macro hal_cpu_int_disable t1,t2
|
120 |
|
|
stc sr,\t1
|
121 |
|
|
mov #CYGARC_REG_SR_IMASK>>1,\t2
|
122 |
|
|
shll \t2
|
123 |
|
|
or \t2,\t1
|
124 |
|
|
ldc \t1,sr
|
125 |
|
|
.endm
|
126 |
|
|
|
127 |
|
|
# Merge the interrupt enable state of the status register in
|
128 |
|
|
# \sr with the current sr.
|
129 |
|
|
.macro hal_cpu_int_merge sr,t1,t2
|
130 |
|
|
stc sr,\t1
|
131 |
|
|
mov #CYGARC_REG_SR_IMASK>>1,\t2
|
132 |
|
|
shll \t2
|
133 |
|
|
and \t2,\sr
|
134 |
|
|
not \t2,\t2
|
135 |
|
|
and \t2,\t1
|
136 |
|
|
or \sr,\t1
|
137 |
|
|
ldc \t1,sr
|
138 |
|
|
.endm
|
139 |
|
|
|
140 |
|
|
#------------------------------------------------------------------------------
|
141 |
|
|
# end of arch.inc
|