1 # R0 and P0 are used as tmps, consider them call clobbered by these macros.
3 # To build for hardware, use:
4 # bfin-linux-uclibc-gcc -nostdlib -g -Wa,--defsym,BFIN_HOST=1 foo.s
7 # All assembler tests should start with a call to "start"
10 # Pad with EMUEXCPT to make sure "jump to 0" always fails
43 LSETUP (1f, 3f) LC0 = P1;
65 .ascii "fail at PC=0x"
81 .global ___uClibc_main;
89 # Make a libgloss/Linux system call
90 .macro system_call nr:req
96 # Quit the current test
109 # Write 'pass' to stdout via syscalls and quit;
110 # meant for non-OS operating environments
116 # Write 'fail' to stdout via syscalls and quit;
117 # meant for non-OS operating environments
123 # Just like the write() C function; uses system calls
124 .macro write fd:req, buf:req, count:req
141 # Output a string using the debug OUTC insn
142 .macro outc_str ch:req, more:vararg
150 # Write 'pass' to stdout and quit (all via debug insns);
151 # meant for OS operating environments
156 R0.L = 0x6170; /* 'p'=0x70 'a'=0x70 */
157 R0.H = 0x7373; /* 's'=0x73 */
160 R0.L = 0x0A; /* newline */
167 outc_str 'p', 'a', 's', 's', '\n'
173 # Write 'fail' to stdout and quit (all via debug insns);
174 # meant for OS operating environments
179 R0.L = 0x6166; /* 'f'=0x66 'a'=0x61 */
180 R0.H = 0x6c69; /* 'i'=0x69 'l'=0x6c */
183 R0.L = 0x0A; /* newline */
190 outc_str 'f', 'a', 'i', 'l', '\n'
196 # Load a 32bit immediate directly into a register
197 .macro imm32 reg:req, val:req
199 \reg\().L = ((\val) & 0xffff);
200 \reg\().H = (((\val) >> 16) & 0xffff);
207 # Load a 32bit immediate indirectly into a register
208 .macro dmm32 reg:req, val:req
216 # Load a symbol directly into a register
218 .macro loadsym reg:req, sym:req, offset=0
219 \reg\().L = (\sym\() + \offset\());
220 \reg\().H = (\sym\() + \offset\());
223 .macro loadsym reg:req, sym:req, offset=0
225 R0 = [P3 + \sym\()@GOT17M4];
238 # Use debug insns to verify the value of a register matches
239 .macro CHECKREG reg:req, val:req
240 DBGAL (\reg, ((\val) & 0xffff));
241 DBGAH (\reg, (((\val) >> 16) & 0xffff));
244 # internal helper macros; ignore them
245 .macro __init_regs reg:req, max:req, x:req, val:req
247 imm32 \reg\()\x, \val
250 .macro _init_regs reg:req, max:req, val:req
251 __init_regs \reg, \max, 0, \val
252 __init_regs \reg, \max, 1, \val
253 __init_regs \reg, \max, 2, \val
254 __init_regs \reg, \max, 3, \val
255 __init_regs \reg, \max, 4, \val
256 __init_regs \reg, \max, 5, \val
257 __init_regs \reg, \max, 6, \val
258 __init_regs \reg, \max, 7, \val
267 # Set the specified group of regs to the specified value
268 .macro init_r_regs val:req
269 _init_regs R, 7, \val
271 .macro init_p_regs val:req
272 _init_regs P, 5, \val
274 .macro init_b_regs val:req
275 _init_regs B, 3, \val
277 .macro init_i_regs val:req
278 _init_regs I, 3, \val
280 .macro init_l_regs val:req
281 _init_regs L, 3, \val
283 .macro init_m_regs val:req
284 _init_regs M, 3, \val
287 // the test framework needs things to be quiet, so don't
288 // print things out by default.
293 .macro _DBGCMPLX reg:req