1 // OBSOLETE /****************************************************************************
3 // OBSOLETE THIS SOFTWARE IS NOT COPYRIGHTED
5 // OBSOLETE HP offers the following for use in the public domain. HP makes no
6 // OBSOLETE warranty with regard to the software or it's performance and the
7 // OBSOLETE user accepts the software "AS IS" with all faults.
9 // OBSOLETE HP DISCLAIMS ANY WARRANTIES, EXPRESS OR IMPLIED, WITH REGARD
10 // OBSOLETE TO THIS SOFTWARE INCLUDING BUT NOT LIMITED TO THE WARRANTIES
11 // OBSOLETE OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13 // OBSOLETE ****************************************************************************/
15 // OBSOLETE /****************************************************************************
16 // OBSOLETE * Header: remcom.c,v 1.34 91/03/09 12:29:49 glenne Exp $
18 // OBSOLETE * Module name: remcom.c $
19 // OBSOLETE * Revision: 1.34 $
20 // OBSOLETE * Date: 91/03/09 12:29:49 $
21 // OBSOLETE * Contributor: Lake Stevens Instrument Division$
23 // OBSOLETE * Description: low level support for gdb debugger. $
25 // OBSOLETE * Considerations: only works on target hardware $
27 // OBSOLETE * Written by: Glenn Engel $
28 // OBSOLETE * ModuleState: Experimental $
30 // OBSOLETE * NOTES: See Below $
32 // OBSOLETE * Modified for SPARC by Stu Grossman, Cygnus Support.
33 // OBSOLETE * Based on sparc-stub.c, it's modified for SPARClite Debug Unit hardware
34 // OBSOLETE * breakpoint support to create sparclite-stub.c, by Kung Hsu, Cygnus Support.
36 // OBSOLETE * This code has been extensively tested on the Fujitsu SPARClite demo board.
38 // OBSOLETE * To enable debugger support, two things need to happen. One, a
39 // OBSOLETE * call to set_debug_traps() is necessary in order to allow any breakpoints
40 // OBSOLETE * or error conditions to be properly intercepted and reported to gdb.
41 // OBSOLETE * Two, a breakpoint needs to be generated to begin communication. This
42 // OBSOLETE * is most easily accomplished by a call to breakpoint(). Breakpoint()
43 // OBSOLETE * simulates a breakpoint by executing a trap #1.
45 // OBSOLETE *************
47 // OBSOLETE * The following gdb commands are supported:
49 // OBSOLETE * command function Return value
51 // OBSOLETE * g return the value of the CPU registers hex data or ENN
52 // OBSOLETE * G set the value of the CPU registers OK or ENN
53 // OBSOLETE * P set the value of a single CPU register OK or ENN
55 // OBSOLETE * mAA..AA,LLLL Read LLLL bytes at address AA..AA hex data or ENN
56 // OBSOLETE * MAA..AA,LLLL: Write LLLL bytes at address AA.AA OK or ENN
58 // OBSOLETE * c Resume at current address SNN ( signal NN)
59 // OBSOLETE * cAA..AA Continue at address AA..AA SNN
61 // OBSOLETE * s Step one instruction SNN
62 // OBSOLETE * sAA..AA Step one instruction from AA..AA SNN
66 // OBSOLETE * ? What was the last sigval ? SNN (signal NN)
68 // OBSOLETE * All commands and responses are sent with a packet which includes a
69 // OBSOLETE * checksum. A packet consists of
71 // OBSOLETE * $<packet info>#<checksum>.
74 // OBSOLETE * <packet info> :: <characters representing the command or response>
75 // OBSOLETE * <checksum> :: <two hex digits computed as modulo 256 sum of <packetinfo>>
77 // OBSOLETE * When a packet is received, it is first acknowledged with either '+' or '-'.
78 // OBSOLETE * '+' indicates a successful transfer. '-' indicates a failed transfer.
80 // OBSOLETE * Example:
82 // OBSOLETE * Host: Reply:
83 // OBSOLETE * $m0,10#2a +$00010203040506070809101112131415#42
85 // OBSOLETE ****************************************************************************/
87 // OBSOLETE #include <string.h>
88 // OBSOLETE #include <signal.h>
90 // OBSOLETE /************************************************************************
92 // OBSOLETE * external low-level support routines
95 // OBSOLETE extern void putDebugChar(); /* write a single character */
96 // OBSOLETE extern int getDebugChar(); /* read and return a single char */
98 // OBSOLETE /************************************************************************/
99 // OBSOLETE /* BUFMAX defines the maximum number of characters in inbound/outbound buffers*/
100 // OBSOLETE /* at least NUMREGBYTES*2 are needed for register packets */
101 // OBSOLETE #define BUFMAX 2048
103 // OBSOLETE static int initialized = 0; /* !0 means we've been initialized */
104 // OBSOLETE static int remote_debug = 0; /* turn on verbose debugging */
106 // OBSOLETE extern void breakinst();
107 // OBSOLETE void _cprint();
108 // OBSOLETE static void hw_breakpoint();
109 // OBSOLETE static void set_mem_fault_trap();
110 // OBSOLETE static void get_in_break_mode();
111 // OBSOLETE static unsigned char *mem2hex();
113 // OBSOLETE static const char hexchars[]="0123456789abcdef";
115 // OBSOLETE #define NUMREGS 121
117 // OBSOLETE static unsigned long saved_stack_pointer;
119 // OBSOLETE /* Number of bytes of registers. */
120 // OBSOLETE #define NUMREGBYTES (NUMREGS * 4)
121 // OBSOLETE enum regnames { G0, G1, G2, G3, G4, G5, G6, G7,
122 // OBSOLETE O0, O1, O2, O3, O4, O5, SP, O7,
123 // OBSOLETE L0, L1, L2, L3, L4, L5, L6, L7,
124 // OBSOLETE I0, I1, I2, I3, I4, I5, FP, I7,
126 // OBSOLETE F0, F1, F2, F3, F4, F5, F6, F7,
127 // OBSOLETE F8, F9, F10, F11, F12, F13, F14, F15,
128 // OBSOLETE F16, F17, F18, F19, F20, F21, F22, F23,
129 // OBSOLETE F24, F25, F26, F27, F28, F29, F30, F31,
131 // OBSOLETE Y, PSR, WIM, TBR, PC, NPC, FPSR, CPSR,
132 // OBSOLETE CCSR, CCPR, CCCRCR, CCOR, CCOBR, CCIBR, CCIR, UNUSED1,
134 // OBSOLETE ASR1, ASR15, ASR17, ASR18, ASR19, ASR20, ASR21, ASR22,
135 // OBSOLETE /* the following not actually implemented */
136 // OBSOLETE AWR0, AWR1, AWR2, AWR3, AWR4, AWR5, AWR6, AWR7,
137 // OBSOLETE AWR8, AWR9, AWR10, AWR11, AWR12, AWR13, AWR14, AWR15,
138 // OBSOLETE AWR16, AWR17, AWR18, AWR19, AWR20, AWR21, AWR22, AWR23,
139 // OBSOLETE AWR24, AWR25, AWR26, AWR27, AWR28, AWR29, AWR30, AWR31,
143 // OBSOLETE /*************************** ASSEMBLY CODE MACROS *************************/
146 // OBSOLETE extern void trap_low();
149 // OBSOLETE .reserve trapstack, 1000 * 4, \"bss\", 8
154 // OBSOLETE in_trap_handler:
160 // OBSOLETE ! This function is called when any SPARC trap (except window overflow or
161 // OBSOLETE ! underflow) occurs. It makes sure that the invalid register window is still
162 // OBSOLETE ! available before jumping into C code. It will also restore the world if you
163 // OBSOLETE ! return from handle_exception.
165 // OBSOLETE ! On entry, trap_low expects l1 and l2 to contain pc and npc respectivly.
167 // OBSOLETE .globl _trap_low
168 // OBSOLETE _trap_low:
169 // OBSOLETE mov %psr, %l0
170 // OBSOLETE mov %wim, %l3
172 // OBSOLETE srl %l3, %l0, %l4 ! wim >> cwp
173 // OBSOLETE and %l4, 0xff, %l4 ! Mask off windows 28, 29
174 // OBSOLETE cmp %l4, 1
175 // OBSOLETE bne window_fine ! Branch if not in the invalid window
178 // OBSOLETE ! Handle window overflow
180 // OBSOLETE mov %g1, %l4 ! Save g1, we use it to hold the wim
181 // OBSOLETE srl %l3, 1, %g1 ! Rotate wim right
182 // OBSOLETE and %g1, 0xff, %g1 ! Mask off windows 28, 29
184 // OBSOLETE bg good_wim ! Branch if new wim is non-zero
187 // OBSOLETE ! At this point, we need to bring a 1 into the high order bit of the wim.
188 // OBSOLETE ! Since we don't want to make any assumptions about the number of register
189 // OBSOLETE ! windows, we figure it out dynamically so as to setup the wim correctly.
191 // OBSOLETE ! The normal way doesn't work on the sparclet as register windows
192 // OBSOLETE ! 28 and 29 are special purpose windows.
193 // OBSOLETE !not %g1 ! Fill g1 with ones
194 // OBSOLETE !mov %g1, %wim ! Fill the wim with ones
198 // OBSOLETE !mov %wim, %g1 ! Read back the wim
199 // OBSOLETE !inc %g1 ! Now g1 has 1 just to left of wim
200 // OBSOLETE !srl %g1, 1, %g1 ! Now put 1 at top of wim
202 // OBSOLETE mov 0x80, %g1 ! Hack for sparclet
204 // OBSOLETE ! This doesn't work on the sparclet.
205 // OBSOLETE !mov %g0, %wim ! Clear wim so that subsequent save
206 // OBSOLETE ! won't trap
207 // OBSOLETE andn %l3, 0xff, %l5 ! Clear wim but not windows 28, 29
208 // OBSOLETE mov %l5, %wim
213 // OBSOLETE good_wim:
214 // OBSOLETE save %g0, %g0, %g0 ! Slip into next window
215 // OBSOLETE mov %g1, %wim ! Install the new wim
217 // OBSOLETE std %l0, [%sp + 0 * 4] ! save L & I registers
218 // OBSOLETE std %l2, [%sp + 2 * 4]
219 // OBSOLETE std %l4, [%sp + 4 * 4]
220 // OBSOLETE std %l6, [%sp + 6 * 4]
222 // OBSOLETE std %i0, [%sp + 8 * 4]
223 // OBSOLETE std %i2, [%sp + 10 * 4]
224 // OBSOLETE std %i4, [%sp + 12 * 4]
225 // OBSOLETE std %i6, [%sp + 14 * 4]
227 // OBSOLETE restore ! Go back to trap window.
228 // OBSOLETE mov %l4, %g1 ! Restore %g1
230 // OBSOLETE window_fine:
231 // OBSOLETE sethi %hi(in_trap_handler), %l4
232 // OBSOLETE ld [%lo(in_trap_handler) + %l4], %l5
234 // OBSOLETE bg recursive_trap
237 // OBSOLETE set trapstack+1000*4, %sp ! Switch to trap stack
239 // OBSOLETE recursive_trap:
240 // OBSOLETE st %l5, [%lo(in_trap_handler) + %l4]
241 // OBSOLETE sub %sp,(16+1+6+1+88)*4,%sp ! Make room for input & locals
242 // OBSOLETE ! + hidden arg + arg spill
243 // OBSOLETE ! + doubleword alignment
244 // OBSOLETE ! + registers[121]
246 // OBSOLETE std %g0, [%sp + (24 + 0) * 4] ! registers[Gx]
247 // OBSOLETE std %g2, [%sp + (24 + 2) * 4]
248 // OBSOLETE std %g4, [%sp + (24 + 4) * 4]
249 // OBSOLETE std %g6, [%sp + (24 + 6) * 4]
251 // OBSOLETE std %i0, [%sp + (24 + 8) * 4] ! registers[Ox]
252 // OBSOLETE std %i2, [%sp + (24 + 10) * 4]
253 // OBSOLETE std %i4, [%sp + (24 + 12) * 4]
254 // OBSOLETE std %i6, [%sp + (24 + 14) * 4]
256 // OBSOLETE ! FP regs (sparclet doesn't have fpu)
258 // OBSOLETE mov %y, %l4
259 // OBSOLETE mov %tbr, %l5
260 // OBSOLETE st %l4, [%sp + (24 + 64) * 4] ! Y
261 // OBSOLETE st %l0, [%sp + (24 + 65) * 4] ! PSR
262 // OBSOLETE st %l3, [%sp + (24 + 66) * 4] ! WIM
263 // OBSOLETE st %l5, [%sp + (24 + 67) * 4] ! TBR
264 // OBSOLETE st %l1, [%sp + (24 + 68) * 4] ! PC
265 // OBSOLETE st %l2, [%sp + (24 + 69) * 4] ! NPC
266 // OBSOLETE ! CPSR and FPSR not impl
267 // OBSOLETE or %l0, 0xf20, %l4
268 // OBSOLETE mov %l4, %psr ! Turn on traps, disable interrupts
273 // OBSOLETE ! Save coprocessor state.
274 // OBSOLETE ! See SK/demo/hdlc_demo/ldc_swap_context.S.
276 // OBSOLETE mov %psr, %l0
277 // OBSOLETE sethi %hi(0x2000), %l5 ! EC bit in PSR
278 // OBSOLETE or %l5, %l0, %l5
279 // OBSOLETE mov %l5, %psr ! enable coprocessor
280 // OBSOLETE nop ! 3 nops after write to %psr (needed?)
283 // OBSOLETE crdcxt %ccsr, %l1 ! capture CCSR
284 // OBSOLETE mov 0x6, %l2
285 // OBSOLETE cwrcxt %l2, %ccsr ! set CCP state machine for CCFR
286 // OBSOLETE crdcxt %ccfr, %l2 ! capture CCOR
287 // OBSOLETE cwrcxt %l2, %ccfr ! tickle CCFR
288 // OBSOLETE crdcxt %ccfr, %l3 ! capture CCOBR
289 // OBSOLETE cwrcxt %l3, %ccfr ! tickle CCFR
290 // OBSOLETE crdcxt %ccfr, %l4 ! capture CCIBR
291 // OBSOLETE cwrcxt %l4, %ccfr ! tickle CCFR
292 // OBSOLETE crdcxt %ccfr, %l5 ! capture CCIR
293 // OBSOLETE cwrcxt %l5, %ccfr ! tickle CCFR
294 // OBSOLETE crdcxt %ccpr, %l6 ! capture CCPR
295 // OBSOLETE crdcxt %cccrcr, %l7 ! capture CCCRCR
296 // OBSOLETE st %l1, [%sp + (24 + 72) * 4] ! save CCSR
297 // OBSOLETE st %l2, [%sp + (24 + 75) * 4] ! save CCOR
298 // OBSOLETE st %l3, [%sp + (24 + 76) * 4] ! save CCOBR
299 // OBSOLETE st %l4, [%sp + (24 + 77) * 4] ! save CCIBR
300 // OBSOLETE st %l5, [%sp + (24 + 78) * 4] ! save CCIR
301 // OBSOLETE st %l6, [%sp + (24 + 73) * 4] ! save CCPR
302 // OBSOLETE st %l7, [%sp + (24 + 74) * 4] ! save CCCRCR
303 // OBSOLETE mov %l0, %psr ! restore original PSR
304 // OBSOLETE nop ! 3 nops after write to %psr (needed?)
308 // OBSOLETE ! End of saving coprocessor state.
309 // OBSOLETE ! Save asr regs
311 // OBSOLETE ! Part of this is silly -- we should not display ASR15 or ASR19 at all.
313 // OBSOLETE sethi %hi(0x01000000), %l6
314 // OBSOLETE st %l6, [%sp + (24 + 81) * 4] ! ASR15 == NOP
315 // OBSOLETE sethi %hi(0xdeadc0de), %l6
316 // OBSOLETE or %l6, %lo(0xdeadc0de), %l6
317 // OBSOLETE st %l6, [%sp + (24 + 84) * 4] ! ASR19 == DEADC0DE
319 // OBSOLETE rd %asr1, %l4
320 // OBSOLETE st %l4, [%sp + (24 + 80) * 4]
321 // OBSOLETE ! rd %asr15, %l4 ! must not read ASR15
322 // OBSOLETE ! st %l4, [%sp + (24 + 81) * 4] ! (illegal instr trap)
323 // OBSOLETE rd %asr17, %l4
324 // OBSOLETE st %l4, [%sp + (24 + 82) * 4]
325 // OBSOLETE rd %asr18, %l4
326 // OBSOLETE st %l4, [%sp + (24 + 83) * 4]
327 // OBSOLETE ! rd %asr19, %l4 ! must not read asr19
328 // OBSOLETE ! st %l4, [%sp + (24 + 84) * 4] ! (halts the CPU)
329 // OBSOLETE rd %asr20, %l4
330 // OBSOLETE st %l4, [%sp + (24 + 85) * 4]
331 // OBSOLETE rd %asr21, %l4
332 // OBSOLETE st %l4, [%sp + (24 + 86) * 4]
333 // OBSOLETE rd %asr22, %l4
334 // OBSOLETE st %l4, [%sp + (24 + 87) * 4]
336 // OBSOLETE ! End of saving asr regs
338 // OBSOLETE call _handle_exception
339 // OBSOLETE add %sp, 24 * 4, %o0 ! Pass address of registers
341 // OBSOLETE ! Reload all of the registers that aren't on the stack
343 // OBSOLETE ld [%sp + (24 + 1) * 4], %g1 ! registers[Gx]
344 // OBSOLETE ldd [%sp + (24 + 2) * 4], %g2
345 // OBSOLETE ldd [%sp + (24 + 4) * 4], %g4
346 // OBSOLETE ldd [%sp + (24 + 6) * 4], %g6
348 // OBSOLETE ldd [%sp + (24 + 8) * 4], %i0 ! registers[Ox]
349 // OBSOLETE ldd [%sp + (24 + 10) * 4], %i2
350 // OBSOLETE ldd [%sp + (24 + 12) * 4], %i4
351 // OBSOLETE ldd [%sp + (24 + 14) * 4], %i6
353 // OBSOLETE ! FP regs (sparclet doesn't have fpu)
355 // OBSOLETE ! Update the coprocessor registers.
356 // OBSOLETE ! See SK/demo/hdlc_demo/ldc_swap_context.S.
358 // OBSOLETE mov %psr, %l0
359 // OBSOLETE sethi %hi(0x2000), %l5 ! EC bit in PSR
360 // OBSOLETE or %l5, %l0, %l5
361 // OBSOLETE mov %l5, %psr ! enable coprocessor
362 // OBSOLETE nop ! 3 nops after write to %psr (needed?)
366 // OBSOLETE mov 0x6, %l2
367 // OBSOLETE cwrcxt %l2, %ccsr ! set CCP state machine for CCFR
369 // OBSOLETE ld [%sp + (24 + 72) * 4], %l1 ! saved CCSR
370 // OBSOLETE ld [%sp + (24 + 75) * 4], %l2 ! saved CCOR
371 // OBSOLETE ld [%sp + (24 + 76) * 4], %l3 ! saved CCOBR
372 // OBSOLETE ld [%sp + (24 + 77) * 4], %l4 ! saved CCIBR
373 // OBSOLETE ld [%sp + (24 + 78) * 4], %l5 ! saved CCIR
374 // OBSOLETE ld [%sp + (24 + 73) * 4], %l6 ! saved CCPR
375 // OBSOLETE ld [%sp + (24 + 74) * 4], %l7 ! saved CCCRCR
377 // OBSOLETE cwrcxt %l2, %ccfr ! restore CCOR
378 // OBSOLETE cwrcxt %l3, %ccfr ! restore CCOBR
379 // OBSOLETE cwrcxt %l4, %ccfr ! restore CCIBR
380 // OBSOLETE cwrcxt %l5, %ccfr ! restore CCIR
381 // OBSOLETE cwrcxt %l6, %ccpr ! restore CCPR
382 // OBSOLETE cwrcxt %l7, %cccrcr ! restore CCCRCR
383 // OBSOLETE cwrcxt %l1, %ccsr ! restore CCSR
385 // OBSOLETE mov %l0, %psr ! restore PSR
386 // OBSOLETE nop ! 3 nops after write to %psr (needed?)
390 // OBSOLETE ! End of coprocessor handling stuff.
391 // OBSOLETE ! Update asr regs
393 // OBSOLETE ld [%sp + (24 + 80) * 4], %l4
394 // OBSOLETE wr %l4, %asr1
395 // OBSOLETE ! ld [%sp + (24 + 81) * 4], %l4 ! can't write asr15
396 // OBSOLETE ! wr %l4, %asr15
397 // OBSOLETE ld [%sp + (24 + 82) * 4], %l4
398 // OBSOLETE wr %l4, %asr17
399 // OBSOLETE ld [%sp + (24 + 83) * 4], %l4
400 // OBSOLETE wr %l4, %asr18
401 // OBSOLETE ! ld [%sp + (24 + 84) * 4], %l4 ! can't write asr19
402 // OBSOLETE ! wr %l4, %asr19
403 // OBSOLETE ! ld [%sp + (24 + 85) * 4], %l4 ! can't write asr20
404 // OBSOLETE ! wr %l4, %asr20
405 // OBSOLETE ! ld [%sp + (24 + 86) * 4], %l4 ! can't write asr21
406 // OBSOLETE ! wr %l4, %asr21
407 // OBSOLETE ld [%sp + (24 + 87) * 4], %l4
408 // OBSOLETE wr %l4, %asr22
410 // OBSOLETE ! End of restoring asr regs
413 // OBSOLETE ldd [%sp + (24 + 64) * 4], %l0 ! Y & PSR
414 // OBSOLETE ldd [%sp + (24 + 68) * 4], %l2 ! PC & NPC
416 // OBSOLETE restore ! Ensure that previous window is valid
417 // OBSOLETE save %g0, %g0, %g0 ! by causing a window_underflow trap
419 // OBSOLETE mov %l0, %y
420 // OBSOLETE mov %l1, %psr ! Make sure that traps are disabled
421 // OBSOLETE ! for rett
422 // OBSOLETE nop ! 3 nops after write to %psr (needed?)
426 // OBSOLETE sethi %hi(in_trap_handler), %l4
427 // OBSOLETE ld [%lo(in_trap_handler) + %l4], %l5
429 // OBSOLETE st %l5, [%lo(in_trap_handler) + %l4]
431 // OBSOLETE jmpl %l2, %g0 ! Restore old PC
432 // OBSOLETE rett %l3 ! Restore old nPC
435 // OBSOLETE /* Convert ch from a hex digit to an int */
437 // OBSOLETE static int
438 // OBSOLETE hex (unsigned char ch)
440 // OBSOLETE if (ch >= 'a' && ch <= 'f')
441 // OBSOLETE return ch-'a'+10;
442 // OBSOLETE if (ch >= '0' && ch <= '9')
443 // OBSOLETE return ch-'0';
444 // OBSOLETE if (ch >= 'A' && ch <= 'F')
445 // OBSOLETE return ch-'A'+10;
446 // OBSOLETE return -1;
449 // OBSOLETE static char remcomInBuffer[BUFMAX];
450 // OBSOLETE static char remcomOutBuffer[BUFMAX];
452 // OBSOLETE /* scan for the sequence $<data>#<checksum> */
454 // OBSOLETE unsigned char *
455 // OBSOLETE getpacket (void)
457 // OBSOLETE unsigned char *buffer = &remcomInBuffer[0];
458 // OBSOLETE unsigned char checksum;
459 // OBSOLETE unsigned char xmitcsum;
460 // OBSOLETE int count;
463 // OBSOLETE while (1)
465 // OBSOLETE /* wait around for the start character, ignore all other characters */
466 // OBSOLETE while ((ch = getDebugChar ()) != '$')
470 // OBSOLETE checksum = 0;
471 // OBSOLETE xmitcsum = -1;
472 // OBSOLETE count = 0;
474 // OBSOLETE /* now, read until a # or end of buffer is found */
475 // OBSOLETE while (count < BUFMAX)
477 // OBSOLETE ch = getDebugChar ();
478 // OBSOLETE if (ch == '$')
479 // OBSOLETE goto retry;
480 // OBSOLETE if (ch == '#')
482 // OBSOLETE checksum = checksum + ch;
483 // OBSOLETE buffer[count] = ch;
484 // OBSOLETE count = count + 1;
486 // OBSOLETE buffer[count] = 0;
488 // OBSOLETE if (ch == '#')
490 // OBSOLETE ch = getDebugChar ();
491 // OBSOLETE xmitcsum = hex (ch) << 4;
492 // OBSOLETE ch = getDebugChar ();
493 // OBSOLETE xmitcsum += hex (ch);
495 // OBSOLETE if (checksum != xmitcsum)
497 // OBSOLETE putDebugChar ('-'); /* failed checksum */
501 // OBSOLETE putDebugChar ('+'); /* successful transfer */
503 // OBSOLETE /* if a sequence char is present, reply the sequence ID */
504 // OBSOLETE if (buffer[2] == ':')
506 // OBSOLETE putDebugChar (buffer[0]);
507 // OBSOLETE putDebugChar (buffer[1]);
509 // OBSOLETE return &buffer[3];
512 // OBSOLETE return &buffer[0];
518 // OBSOLETE /* send the packet in buffer. */
520 // OBSOLETE static void
521 // OBSOLETE putpacket (unsigned char *buffer)
523 // OBSOLETE unsigned char checksum;
524 // OBSOLETE int count;
525 // OBSOLETE unsigned char ch;
527 // OBSOLETE /* $<packet info>#<checksum>. */
530 // OBSOLETE putDebugChar('$');
531 // OBSOLETE checksum = 0;
532 // OBSOLETE count = 0;
534 // OBSOLETE while (ch = buffer[count])
536 // OBSOLETE putDebugChar(ch);
537 // OBSOLETE checksum += ch;
538 // OBSOLETE count += 1;
541 // OBSOLETE putDebugChar('#');
542 // OBSOLETE putDebugChar(hexchars[checksum >> 4]);
543 // OBSOLETE putDebugChar(hexchars[checksum & 0xf]);
546 // OBSOLETE while (getDebugChar() != '+');
549 // OBSOLETE /* Indicate to caller of mem2hex or hex2mem that there has been an
550 // OBSOLETE error. */
551 // OBSOLETE static volatile int mem_err = 0;
553 // OBSOLETE /* Convert the memory pointed to by mem into hex, placing result in buf.
554 // OBSOLETE * Return a pointer to the last char put in buf (null), in case of mem fault,
555 // OBSOLETE * return 0.
556 // OBSOLETE * If MAY_FAULT is non-zero, then we will handle memory faults by returning
557 // OBSOLETE * a 0, else treat a fault like any other fault in the stub.
560 // OBSOLETE static unsigned char *
561 // OBSOLETE mem2hex (unsigned char *mem, unsigned char *buf, int count, int may_fault)
563 // OBSOLETE unsigned char ch;
565 // OBSOLETE set_mem_fault_trap(may_fault);
567 // OBSOLETE while (count-- > 0)
569 // OBSOLETE ch = *mem++;
570 // OBSOLETE if (mem_err)
571 // OBSOLETE return 0;
572 // OBSOLETE *buf++ = hexchars[ch >> 4];
573 // OBSOLETE *buf++ = hexchars[ch & 0xf];
576 // OBSOLETE *buf = 0;
578 // OBSOLETE set_mem_fault_trap(0);
580 // OBSOLETE return buf;
583 // OBSOLETE /* convert the hex array pointed to by buf into binary to be placed in mem
584 // OBSOLETE * return a pointer to the character AFTER the last byte written */
586 // OBSOLETE static char *
587 // OBSOLETE hex2mem (unsigned char *buf, unsigned char *mem, int count, int may_fault)
590 // OBSOLETE unsigned char ch;
592 // OBSOLETE set_mem_fault_trap(may_fault);
594 // OBSOLETE for (i=0; i<count; i++)
596 // OBSOLETE ch = hex(*buf++) << 4;
597 // OBSOLETE ch |= hex(*buf++);
598 // OBSOLETE *mem++ = ch;
599 // OBSOLETE if (mem_err)
600 // OBSOLETE return 0;
603 // OBSOLETE set_mem_fault_trap(0);
605 // OBSOLETE return mem;
608 // OBSOLETE /* This table contains the mapping between SPARC hardware trap types, and
609 // OBSOLETE signals, which are primarily what GDB understands. It also indicates
610 // OBSOLETE which hardware traps we need to commandeer when initializing the stub. */
612 // OBSOLETE static struct hard_trap_info
614 // OBSOLETE unsigned char tt; /* Trap type code for SPARClite */
615 // OBSOLETE unsigned char signo; /* Signal that we map this trap into */
616 // OBSOLETE } hard_trap_info[] = {
617 // OBSOLETE {1, SIGSEGV}, /* instruction access exception */
618 // OBSOLETE {0x3b, SIGSEGV}, /* instruction access error */
619 // OBSOLETE {2, SIGILL}, /* illegal instruction */
620 // OBSOLETE {3, SIGILL}, /* privileged instruction */
621 // OBSOLETE {4, SIGEMT}, /* fp disabled */
622 // OBSOLETE {0x24, SIGEMT}, /* cp disabled */
623 // OBSOLETE {7, SIGBUS}, /* mem address not aligned */
624 // OBSOLETE {0x29, SIGSEGV}, /* data access exception */
625 // OBSOLETE {10, SIGEMT}, /* tag overflow */
626 // OBSOLETE {128+1, SIGTRAP}, /* ta 1 - normal breakpoint instruction */
627 // OBSOLETE {0, 0} /* Must be last */
630 // OBSOLETE /* Set up exception handlers for tracing and breakpoints */
633 // OBSOLETE set_debug_traps (void)
635 // OBSOLETE struct hard_trap_info *ht;
637 // OBSOLETE for (ht = hard_trap_info; ht->tt && ht->signo; ht++)
638 // OBSOLETE exceptionHandler(ht->tt, trap_low);
640 // OBSOLETE initialized = 1;
644 // OBSOLETE ! Trap handler for memory errors. This just sets mem_err to be non-zero. It
645 // OBSOLETE ! assumes that %l1 is non-zero. This should be safe, as it is doubtful that
646 // OBSOLETE ! 0 would ever contain code that could mem fault. This routine will skip
647 // OBSOLETE ! past the faulting instruction after setting mem_err.
652 // OBSOLETE _fltr_set_mem_err:
653 // OBSOLETE sethi %hi(_mem_err), %l0
654 // OBSOLETE st %l1, [%l0 + %lo(_mem_err)]
655 // OBSOLETE jmpl %l2, %g0
656 // OBSOLETE rett %l2+4
659 // OBSOLETE static void
660 // OBSOLETE set_mem_fault_trap (int enable)
662 // OBSOLETE extern void fltr_set_mem_err();
663 // OBSOLETE mem_err = 0;
665 // OBSOLETE if (enable)
666 // OBSOLETE exceptionHandler(0x29, fltr_set_mem_err);
668 // OBSOLETE exceptionHandler(0x29, trap_low);
675 // OBSOLETE _dummy_hw_breakpoint:
676 // OBSOLETE jmpl %l2, %g0
677 // OBSOLETE rett %l2+4
682 // OBSOLETE static void
683 // OBSOLETE set_hw_breakpoint_trap (int enable)
685 // OBSOLETE extern void dummy_hw_breakpoint();
687 // OBSOLETE if (enable)
688 // OBSOLETE exceptionHandler(255, dummy_hw_breakpoint);
690 // OBSOLETE exceptionHandler(255, trap_low);
693 // OBSOLETE static void
694 // OBSOLETE get_in_break_mode (void)
698 // OBSOLETE mesg("get_in_break_mode, sp = ");
699 // OBSOLETE phex(&x);
701 // OBSOLETE set_hw_breakpoint_trap(1);
704 // OBSOLETE sethi %hi(0xff10), %l4
705 // OBSOLETE or %l4, %lo(0xff10), %l4
706 // OBSOLETE sta %g0, [%l4]0x1
712 // OBSOLETE set_hw_breakpoint_trap(0);
715 // OBSOLETE /* Convert the SPARC hardware trap type code to a unix signal number. */
717 // OBSOLETE static int
718 // OBSOLETE computeSignal (int tt)
720 // OBSOLETE struct hard_trap_info *ht;
722 // OBSOLETE for (ht = hard_trap_info; ht->tt && ht->signo; ht++)
723 // OBSOLETE if (ht->tt == tt)
724 // OBSOLETE return ht->signo;
726 // OBSOLETE return SIGHUP; /* default for things we don't know about */
730 // OBSOLETE * While we find nice hex chars, build an int.
731 // OBSOLETE * Return number of chars processed.
734 // OBSOLETE static int
735 // OBSOLETE hexToInt(char **ptr, int *intValue)
737 // OBSOLETE int numChars = 0;
738 // OBSOLETE int hexValue;
740 // OBSOLETE *intValue = 0;
742 // OBSOLETE while (**ptr)
744 // OBSOLETE hexValue = hex(**ptr);
745 // OBSOLETE if (hexValue < 0)
748 // OBSOLETE *intValue = (*intValue << 4) | hexValue;
749 // OBSOLETE numChars ++;
751 // OBSOLETE (*ptr)++;
754 // OBSOLETE return (numChars);
758 // OBSOLETE * This function does all command procesing for interfacing to gdb. It
759 // OBSOLETE * returns 1 if you should skip the instruction at the trap address, 0
760 // OBSOLETE * otherwise.
763 // OBSOLETE static void
764 // OBSOLETE handle_exception (unsigned long *registers)
766 // OBSOLETE int tt; /* Trap type */
767 // OBSOLETE int sigval;
768 // OBSOLETE int addr;
769 // OBSOLETE int length;
770 // OBSOLETE char *ptr;
771 // OBSOLETE unsigned long *sp;
772 // OBSOLETE unsigned long dsr;
774 // OBSOLETE /* First, we must force all of the windows to be spilled out */
777 // OBSOLETE ! Ugh. sparclet has broken save
778 // OBSOLETE !save %sp, -64, %sp
780 // OBSOLETE add %fp,-64,%sp
781 // OBSOLETE !save %sp, -64, %sp
783 // OBSOLETE add %fp,-64,%sp
784 // OBSOLETE !save %sp, -64, %sp
786 // OBSOLETE add %fp,-64,%sp
787 // OBSOLETE !save %sp, -64, %sp
789 // OBSOLETE add %fp,-64,%sp
790 // OBSOLETE !save %sp, -64, %sp
792 // OBSOLETE add %fp,-64,%sp
793 // OBSOLETE !save %sp, -64, %sp
795 // OBSOLETE add %fp,-64,%sp
796 // OBSOLETE !save %sp, -64, %sp
798 // OBSOLETE add %fp,-64,%sp
799 // OBSOLETE !save %sp, -64, %sp
801 // OBSOLETE add %fp,-64,%sp
812 // OBSOLETE if (registers[PC] == (unsigned long)breakinst)
814 // OBSOLETE registers[PC] = registers[NPC];
815 // OBSOLETE registers[NPC] += 4;
817 // OBSOLETE sp = (unsigned long *)registers[SP];
819 // OBSOLETE tt = (registers[TBR] >> 4) & 0xff;
821 // OBSOLETE /* reply to host that an exception has occurred */
822 // OBSOLETE sigval = computeSignal(tt);
823 // OBSOLETE ptr = remcomOutBuffer;
825 // OBSOLETE *ptr++ = 'T';
826 // OBSOLETE *ptr++ = hexchars[sigval >> 4];
827 // OBSOLETE *ptr++ = hexchars[sigval & 0xf];
829 // OBSOLETE *ptr++ = hexchars[PC >> 4];
830 // OBSOLETE *ptr++ = hexchars[PC & 0xf];
831 // OBSOLETE *ptr++ = ':';
832 // OBSOLETE ptr = mem2hex((char *)®isters[PC], ptr, 4, 0);
833 // OBSOLETE *ptr++ = ';';
835 // OBSOLETE *ptr++ = hexchars[FP >> 4];
836 // OBSOLETE *ptr++ = hexchars[FP & 0xf];
837 // OBSOLETE *ptr++ = ':';
838 // OBSOLETE ptr = mem2hex(sp + 8 + 6, ptr, 4, 0); /* FP */
839 // OBSOLETE *ptr++ = ';';
841 // OBSOLETE *ptr++ = hexchars[SP >> 4];
842 // OBSOLETE *ptr++ = hexchars[SP & 0xf];
843 // OBSOLETE *ptr++ = ':';
844 // OBSOLETE ptr = mem2hex((char *)&sp, ptr, 4, 0);
845 // OBSOLETE *ptr++ = ';';
847 // OBSOLETE *ptr++ = hexchars[NPC >> 4];
848 // OBSOLETE *ptr++ = hexchars[NPC & 0xf];
849 // OBSOLETE *ptr++ = ':';
850 // OBSOLETE ptr = mem2hex((char *)®isters[NPC], ptr, 4, 0);
851 // OBSOLETE *ptr++ = ';';
853 // OBSOLETE *ptr++ = hexchars[O7 >> 4];
854 // OBSOLETE *ptr++ = hexchars[O7 & 0xf];
855 // OBSOLETE *ptr++ = ':';
856 // OBSOLETE ptr = mem2hex((char *)®isters[O7], ptr, 4, 0);
857 // OBSOLETE *ptr++ = ';';
859 // OBSOLETE *ptr++ = 0;
861 // OBSOLETE putpacket(remcomOutBuffer);
863 // OBSOLETE while (1)
865 // OBSOLETE remcomOutBuffer[0] = 0;
867 // OBSOLETE ptr = getpacket();
868 // OBSOLETE switch (*ptr++)
870 // OBSOLETE case '?':
871 // OBSOLETE remcomOutBuffer[0] = 'S';
872 // OBSOLETE remcomOutBuffer[1] = hexchars[sigval >> 4];
873 // OBSOLETE remcomOutBuffer[2] = hexchars[sigval & 0xf];
874 // OBSOLETE remcomOutBuffer[3] = 0;
877 // OBSOLETE case 'd':
878 // OBSOLETE remote_debug = !(remote_debug); /* toggle debug flag */
881 // OBSOLETE case 'g': /* return the value of the CPU registers */
883 // OBSOLETE ptr = remcomOutBuffer;
884 // OBSOLETE ptr = mem2hex((char *)registers, ptr, 16 * 4, 0); /* G & O regs */
885 // OBSOLETE ptr = mem2hex(sp + 0, ptr, 16 * 4, 0); /* L & I regs */
886 // OBSOLETE memset(ptr, '0', 32 * 8); /* Floating point */
887 // OBSOLETE ptr = mem2hex((char *)®isters[Y],
888 // OBSOLETE ptr + 32 * 4 * 2,
890 // OBSOLETE 0); /* Y, PSR, WIM, TBR, PC, NPC, FPSR, CPSR */
891 // OBSOLETE ptr = mem2hex((char *)®isters[CCSR],
894 // OBSOLETE 0); /* CCSR, CCPR, CCCRCR, CCOR, CCOBR, CCIBR, CCIR */
895 // OBSOLETE ptr = mem2hex((char *)®isters[ASR1],
898 // OBSOLETE 0); /* ASR1,ASR15,ASR17,ASR18,ASR19,ASR20,ASR21,ASR22 */
899 // OBSOLETE #if 0 /* not implemented */
900 // OBSOLETE ptr = mem2hex((char *) ®isters[AWR0],
903 // OBSOLETE 0); /* Alternate Window Registers */
908 // OBSOLETE case 'G': /* set value of all the CPU registers - return OK */
909 // OBSOLETE case 'P': /* set value of one CPU register - return OK */
911 // OBSOLETE unsigned long *newsp, psr;
913 // OBSOLETE psr = registers[PSR];
915 // OBSOLETE if (ptr[-1] == 'P') /* do a single register */
917 // OBSOLETE int regno;
919 // OBSOLETE if (hexToInt (&ptr, ®no)
920 // OBSOLETE && *ptr++ == '=')
921 // OBSOLETE if (regno >= L0 && regno <= I7)
922 // OBSOLETE hex2mem (ptr, sp + regno - L0, 4, 0);
924 // OBSOLETE hex2mem (ptr, (char *)®isters[regno], 4, 0);
927 // OBSOLETE strcpy (remcomOutBuffer, "E01");
933 // OBSOLETE hex2mem(ptr, (char *)registers, 16 * 4, 0); /* G & O regs */
934 // OBSOLETE hex2mem(ptr + 16 * 4 * 2, sp + 0, 16 * 4, 0); /* L & I regs */
935 // OBSOLETE hex2mem(ptr + 64 * 4 * 2, (char *)®isters[Y],
936 // OBSOLETE 8 * 4, 0); /* Y,PSR,WIM,TBR,PC,NPC,FPSR,CPSR */
937 // OBSOLETE hex2mem(ptr + 72 * 4 * 2, (char *)®isters[CCSR],
938 // OBSOLETE 8 * 4, 0); /* CCSR,CCPR,CCCRCR,CCOR,CCOBR,CCIBR,CCIR */
939 // OBSOLETE hex2mem(ptr + 80 * 4 * 2, (char *)®isters[ASR1],
940 // OBSOLETE 8 * 4, 0); /* ASR1 ... ASR22 */
941 // OBSOLETE #if 0 /* not implemented */
942 // OBSOLETE hex2mem(ptr + 88 * 4 * 2, (char *)®isters[AWR0],
943 // OBSOLETE 8 * 4, 0); /* Alternate Window Registers */
946 // OBSOLETE /* See if the stack pointer has moved. If so, then copy the saved
947 // OBSOLETE locals and ins to the new location. This keeps the window
948 // OBSOLETE overflow and underflow routines happy. */
950 // OBSOLETE newsp = (unsigned long *)registers[SP];
951 // OBSOLETE if (sp != newsp)
952 // OBSOLETE sp = memcpy(newsp, sp, 16 * 4);
954 // OBSOLETE /* Don't allow CWP to be modified. */
956 // OBSOLETE if (psr != registers[PSR])
957 // OBSOLETE registers[PSR] = (psr & 0x1f) | (registers[PSR] & ~0x1f);
959 // OBSOLETE strcpy(remcomOutBuffer,"OK");
963 // OBSOLETE case 'm': /* mAA..AA,LLLL Read LLLL bytes at address AA..AA */
964 // OBSOLETE /* Try to read %x,%x. */
966 // OBSOLETE if (hexToInt(&ptr, &addr)
967 // OBSOLETE && *ptr++ == ','
968 // OBSOLETE && hexToInt(&ptr, &length))
970 // OBSOLETE if (mem2hex((char *)addr, remcomOutBuffer, length, 1))
973 // OBSOLETE strcpy (remcomOutBuffer, "E03");
976 // OBSOLETE strcpy(remcomOutBuffer,"E01");
979 // OBSOLETE case 'M': /* MAA..AA,LLLL: Write LLLL bytes at address AA.AA return OK */
980 // OBSOLETE /* Try to read '%x,%x:'. */
982 // OBSOLETE if (hexToInt(&ptr, &addr)
983 // OBSOLETE && *ptr++ == ','
984 // OBSOLETE && hexToInt(&ptr, &length)
985 // OBSOLETE && *ptr++ == ':')
987 // OBSOLETE if (hex2mem(ptr, (char *)addr, length, 1))
988 // OBSOLETE strcpy(remcomOutBuffer, "OK");
990 // OBSOLETE strcpy(remcomOutBuffer, "E03");
993 // OBSOLETE strcpy(remcomOutBuffer, "E02");
996 // OBSOLETE case 'c': /* cAA..AA Continue at address AA..AA(optional) */
997 // OBSOLETE /* try to read optional parameter, pc unchanged if no parm */
999 // OBSOLETE if (hexToInt(&ptr, &addr))
1001 // OBSOLETE registers[PC] = addr;
1002 // OBSOLETE registers[NPC] = addr + 4;
1005 // OBSOLETE /* Need to flush the instruction cache here, as we may have deposited a
1006 // OBSOLETE breakpoint, and the icache probably has no way of knowing that a data ref to
1007 // OBSOLETE some location may have changed something that is in the instruction cache.
1010 // OBSOLETE flush_i_cache();
1013 // OBSOLETE /* kill the program */
1014 // OBSOLETE case 'k' : /* do nothing */
1017 // OBSOLETE case 't': /* Test feature */
1018 // OBSOLETE asm (" std %f30,[%sp]");
1021 // OBSOLETE case 'r': /* Reset */
1022 // OBSOLETE asm ("call 0
1025 // OBSOLETE } /* switch */
1027 // OBSOLETE /* reply to the request */
1028 // OBSOLETE putpacket(remcomOutBuffer);
1032 // OBSOLETE /* This function will generate a breakpoint exception. It is used at the
1033 // OBSOLETE beginning of a program to sync up with a debugger and can be used
1034 // OBSOLETE otherwise as a quick means to stop program execution and "break" into
1035 // OBSOLETE the debugger. */
1038 // OBSOLETE breakpoint (void)
1040 // OBSOLETE if (!initialized)
1043 // OBSOLETE asm(" .globl _breakinst
1045 // OBSOLETE _breakinst: ta 1
1049 // OBSOLETE static void
1050 // OBSOLETE hw_breakpoint (void)
1057 // OBSOLETE #if 0 /* experimental and never finished, left here for reference */
1058 // OBSOLETE static void
1059 // OBSOLETE splet_temp(void)
1061 // OBSOLETE asm(" sub %sp,(16+1+6+1+121)*4,%sp ! Make room for input & locals
1062 // OBSOLETE ! + hidden arg + arg spill
1063 // OBSOLETE ! + doubleword alignment
1064 // OBSOLETE ! + registers[121]
1066 // OBSOLETE ! Leave a trail of breadcrumbs! (save register save area for debugging)
1067 // OBSOLETE mov %sp, %l0
1068 // OBSOLETE add %l0, 24*4, %l0
1069 // OBSOLETE sethi %hi(_debug_registers), %l1
1070 // OBSOLETE st %l0, [%lo(_debug_registers) + %l1]
1072 // OBSOLETE ! Save the Alternate Register Set: (not implemented yet)
1073 // OBSOLETE ! To save the Alternate Register set, we must:
1074 // OBSOLETE ! 1) Save the current SP in some global location.
1075 // OBSOLETE ! 2) Swap the register sets.
1076 // OBSOLETE ! 3) Save the Alternate SP in the Y register
1077 // OBSOLETE ! 4) Fetch the SP that we saved in step 1.
1078 // OBSOLETE ! 5) Use that to save the rest of the regs (not forgetting ASP in Y)
1079 // OBSOLETE ! 6) Restore the Alternate SP from Y
1080 // OBSOLETE ! 7) Swap the registers back.
1082 // OBSOLETE ! 1) Copy the current stack pointer to global _SAVED_STACK_POINTER:
1083 // OBSOLETE sethi %hi(_saved_stack_pointer), %l0
1084 // OBSOLETE st %sp, [%lo(_saved_stack_pointer) + %l0]
1086 // OBSOLETE ! 2) Swap the register sets:
1087 // OBSOLETE mov %psr, %l1
1088 // OBSOLETE sethi %hi(0x10000), %l2
1089 // OBSOLETE xor %l1, %l2, %l1
1090 // OBSOLETE mov %l1, %psr
1091 // OBSOLETE nop ! 3 nops after write to %psr (needed?)
1095 // OBSOLETE ! 3) Save Alternate L0 in Y
1096 // OBSOLETE wr %l0, 0, %y
1098 // OBSOLETE ! 4) Load former SP into alternate SP, using L0
1099 // OBSOLETE sethi %hi(_saved_stack_pointer), %l0
1100 // OBSOLETE or %lo(_saved_stack_pointer), %l0, %l0
1101 // OBSOLETE swap [%l0], %sp
1103 // OBSOLETE ! 4.5) Restore alternate L0
1104 // OBSOLETE rd %y, %l0
1106 // OBSOLETE ! 5) Save the Alternate Window Registers
1107 // OBSOLETE st %r0, [%sp + (24 + 88) * 4] ! AWR0
1108 // OBSOLETE st %r1, [%sp + (24 + 89) * 4] ! AWR1
1109 // OBSOLETE st %r2, [%sp + (24 + 90) * 4] ! AWR2
1110 // OBSOLETE st %r3, [%sp + (24 + 91) * 4] ! AWR3
1111 // OBSOLETE st %r4, [%sp + (24 + 92) * 4] ! AWR4
1112 // OBSOLETE st %r5, [%sp + (24 + 93) * 4] ! AWR5
1113 // OBSOLETE st %r6, [%sp + (24 + 94) * 4] ! AWR6
1114 // OBSOLETE st %r7, [%sp + (24 + 95) * 4] ! AWR7
1115 // OBSOLETE st %r8, [%sp + (24 + 96) * 4] ! AWR8
1116 // OBSOLETE st %r9, [%sp + (24 + 97) * 4] ! AWR9
1117 // OBSOLETE st %r10, [%sp + (24 + 98) * 4] ! AWR10
1118 // OBSOLETE st %r11, [%sp + (24 + 99) * 4] ! AWR11
1119 // OBSOLETE st %r12, [%sp + (24 + 100) * 4] ! AWR12
1120 // OBSOLETE st %r13, [%sp + (24 + 101) * 4] ! AWR13
1121 // OBSOLETE ! st %r14, [%sp + (24 + 102) * 4] ! AWR14 (SP)
1122 // OBSOLETE st %r15, [%sp + (24 + 103) * 4] ! AWR15
1123 // OBSOLETE st %r16, [%sp + (24 + 104) * 4] ! AWR16
1124 // OBSOLETE st %r17, [%sp + (24 + 105) * 4] ! AWR17
1125 // OBSOLETE st %r18, [%sp + (24 + 106) * 4] ! AWR18
1126 // OBSOLETE st %r19, [%sp + (24 + 107) * 4] ! AWR19
1127 // OBSOLETE st %r20, [%sp + (24 + 108) * 4] ! AWR20
1128 // OBSOLETE st %r21, [%sp + (24 + 109) * 4] ! AWR21
1129 // OBSOLETE st %r22, [%sp + (24 + 110) * 4] ! AWR22
1130 // OBSOLETE st %r23, [%sp + (24 + 111) * 4] ! AWR23
1131 // OBSOLETE st %r24, [%sp + (24 + 112) * 4] ! AWR24
1132 // OBSOLETE st %r25, [%sp + (24 + 113) * 4] ! AWR25
1133 // OBSOLETE st %r26, [%sp + (24 + 114) * 4] ! AWR26
1134 // OBSOLETE st %r27, [%sp + (24 + 115) * 4] ! AWR27
1135 // OBSOLETE st %r28, [%sp + (24 + 116) * 4] ! AWR28
1136 // OBSOLETE st %r29, [%sp + (24 + 117) * 4] ! AWR29
1137 // OBSOLETE st %r30, [%sp + (24 + 118) * 4] ! AWR30
1138 // OBSOLETE st %r31, [%sp + (24 + 119) * 4] ! AWR21
1140 // OBSOLETE ! Get the Alternate PSR (I hope...)
1142 // OBSOLETE rd %psr, %l2
1143 // OBSOLETE st %l2, [%sp + (24 + 120) * 4] ! APSR
1145 // OBSOLETE ! Don't forget the alternate stack pointer
1147 // OBSOLETE rd %y, %l3
1148 // OBSOLETE st %l3, [%sp + (24 + 102) * 4] ! AWR14 (SP)
1150 // OBSOLETE ! 6) Restore the Alternate SP (saved in Y)
1152 // OBSOLETE rd %y, %o6
1155 // OBSOLETE ! 7) Swap the registers back:
1157 // OBSOLETE mov %psr, %l1
1158 // OBSOLETE sethi %hi(0x10000), %l2
1159 // OBSOLETE xor %l1, %l2, %l1
1160 // OBSOLETE mov %l1, %psr
1161 // OBSOLETE nop ! 3 nops after write to %psr (needed?)
This page took 0.056167 seconds and 4 git commands to generate.