diff options
Diffstat (limited to 'gdb/stubs/m68k-stub.c')
-rw-r--r-- | gdb/stubs/m68k-stub.c | 170 |
1 files changed, 85 insertions, 85 deletions
diff --git a/gdb/stubs/m68k-stub.c b/gdb/stubs/m68k-stub.c index 7f78a96..826f922 100644 --- a/gdb/stubs/m68k-stub.c +++ b/gdb/stubs/m68k-stub.c @@ -144,11 +144,11 @@ static const char hexchars[]="0123456789abcdef"; /* many of the fpa registers are 12 byte (96 bit) registers */ #define NUMREGBYTES 180 enum regnames {D0,D1,D2,D3,D4,D5,D6,D7, - A0,A1,A2,A3,A4,A5,A6,A7, - PS,PC, - FP0,FP1,FP2,FP3,FP4,FP5,FP6,FP7, - FPCONTROL,FPSTATUS,FPIADDR - }; + A0,A1,A2,A3,A4,A5,A6,A7, + PS,PC, + FP0,FP1,FP2,FP3,FP4,FP5,FP6,FP7, + FPCONTROL,FPSTATUS,FPIADDR + }; /* We keep a whole frame cache here. "Why?", I hear you cry, "doesn't @@ -239,32 +239,32 @@ asm(" .text .globl _return_to_super _return_to_super: - movel _registers+60,sp /* get new stack pointer */ - movel _lastFrame,a0 /* get last frame info */ - bra return_to_any + movel _registers+60,sp /* get new stack pointer */ + movel _lastFrame,a0 /* get last frame info */ + bra return_to_any .globl _return_to_user _return_to_user: - movel _registers+60,a0 /* get usp */ - movel a0,usp /* set usp */ - movel _superStack,sp /* get original stack pointer */ + movel _registers+60,a0 /* get usp */ + movel a0,usp /* set usp */ + movel _superStack,sp /* get original stack pointer */ return_to_any: - movel _lastFrame,a0 /* get last frame info */ - movel a0@+,_lastFrame /* link in previous frame */ - addql #8,a0 /* skip over pc, vector#*/ - movew a0@+,d0 /* get # of words in cpu frame */ - addw d0,a0 /* point to end of data */ - addw d0,a0 /* point to end of data */ - movel a0,a1 + movel _lastFrame,a0 /* get last frame info */ + movel a0@+,_lastFrame /* link in previous frame */ + addql #8,a0 /* skip over pc, vector#*/ + movew a0@+,d0 /* get # of words in cpu frame */ + addw d0,a0 /* point to end of data */ + addw d0,a0 /* point to end of data */ + movel a0,a1 # # copy the stack frame - subql #1,d0 + subql #1,d0 copyUserLoop: - movew a1@-,sp@- - dbf d0,copyUserLoop + movew a1@-,sp@- + dbf d0,copyUserLoop "); - RESTORE_FP_REGS() + RESTORE_FP_REGS() asm(" moveml _registers,d0-d7/a0-a6"); asm(" rte"); /* pop and go! */ @@ -288,8 +288,8 @@ asm(" movew sp@(6),d0"); asm(" andiw #0x700,d0 cmpiw #0x700,d0 beq _already7 - movew sp@+,d0 - bra __catchException + movew sp@+,d0 + bra __catchException _already7: movew sp@+,d0"); #if !defined (mc68020) && !defined (mc68332) @@ -321,29 +321,29 @@ asm(" __catchException:"); DISABLE_INTERRUPTS(); asm(" - moveml d0-d7/a0-a6,_registers /* save registers */ + moveml d0-d7/a0-a6,_registers /* save registers */ movel _lastFrame,a0 /* last frame pointer */ "); SAVE_FP_REGS(); asm(" lea _registers,a5 /* get address of registers */ - movew sp@,d1 /* get status register */ - movew d1,a5@(66) /* save sr */ + movew sp@,d1 /* get status register */ + movew d1,a5@(66) /* save sr */ movel sp@(2),a4 /* save pc in a4 for later use */ - movel a4,a5@(68) /* save pc in _regisers[] */ + movel a4,a5@(68) /* save pc in _regisers[] */ # # figure out how many bytes in the stack frame movew sp@(6),d0 /* get '020 exception format */ - movew d0,d2 /* make a copy of format word */ - andiw #0xf000,d0 /* mask off format type */ - rolw #5,d0 /* rotate into the low byte *2 */ - lea _exceptionSize,a1 - addw d0,a1 /* index into the table */ + movew d0,d2 /* make a copy of format word */ + andiw #0xf000,d0 /* mask off format type */ + rolw #5,d0 /* rotate into the low byte *2 */ + lea _exceptionSize,a1 + addw d0,a1 /* index into the table */ movew a1@,d0 /* get number of words in frame */ - movew d0,d3 /* save it */ - subw d0,a0 /* adjust save pointer */ - subw d0,a0 /* adjust save pointer(bytes) */ + movew d0,d3 /* save it */ + subw d0,a0 /* adjust save pointer */ + subw d0,a0 /* adjust save pointer(bytes) */ movel a0,a1 /* copy save pointer */ subql #1,d0 /* predecrement loop counter */ # @@ -354,39 +354,39 @@ saveFrameLoop: # # now that the stack has been clenaed, # save the a7 in use at time of exception - movel sp,_superStack /* save supervisor sp */ - andiw #0x2000,d1 /* were we in supervisor mode ? */ - beq userMode - movel a7,a5@(60) /* save a7 */ - bra a7saveDone + movel sp,_superStack /* save supervisor sp */ + andiw #0x2000,d1 /* were we in supervisor mode ? */ + beq userMode + movel a7,a5@(60) /* save a7 */ + bra a7saveDone userMode: movel usp,a1 - movel a1,a5@(60) /* save user stack pointer */ + movel a1,a5@(60) /* save user stack pointer */ a7saveDone: # # save size of frame - movew d3,a0@- + movew d3,a0@- # # compute exception number andl #0xfff,d2 /* mask off vector offset */ lsrw #2,d2 /* divide by 4 to get vect num */ - movel d2,a0@- /* save it */ + movel d2,a0@- /* save it */ # # save pc causing exception - movel a4,a0@- + movel a4,a0@- # # save old frame link and set the new value movel _lastFrame,a1 /* last frame pointer */ movel a1,a0@- /* save pointer to prev frame */ - movel a0,_lastFrame + movel a0,_lastFrame - movel d2,sp@- /* push exception num */ + movel d2,sp@- /* push exception num */ movel _exceptionHook,a0 /* get address of handler */ - jbsr a0@ /* and call it */ - clrl sp@ /* replace exception num parm with frame ptr */ - jbsr __returnFromException /* jbsr, but never returns */ + jbsr a0@ /* and call it */ + clrl sp@ /* replace exception num parm with frame ptr */ + jbsr __returnFromException /* jbsr, but never returns */ "); #else /* mc68000 */ /* This function is called when an exception occurs. It translates the @@ -407,59 +407,59 @@ asm(" __catchException:"); DISABLE_INTERRUPTS(); asm(" - moveml d0-d7/a0-a6,_registers /* save registers */ + moveml d0-d7/a0-a6,_registers /* save registers */ movel _lastFrame,a0 /* last frame pointer */ "); SAVE_FP_REGS(); asm(" - lea _registers,a5 /* get address of registers */ - movel sp@+,d2 /* pop return address */ + lea _registers,a5 /* get address of registers */ + movel sp@+,d2 /* pop return address */ addl #1530,d2 /* convert return addr to */ divs #6,d2 /* exception number */ extl d2 - moveql #3,d3 /* assume a three word frame */ + moveql #3,d3 /* assume a three word frame */ - cmpiw #3,d2 /* bus error or address error ? */ - bgt normal /* if >3 then normal error */ - movel sp@+,a0@- /* copy error info to frame buff*/ - movel sp@+,a0@- /* these are never used */ - moveql #7,d3 /* this is a 7 word frame */ + cmpiw #3,d2 /* bus error or address error ? */ + bgt normal /* if >3 then normal error */ + movel sp@+,a0@- /* copy error info to frame buff*/ + movel sp@+,a0@- /* these are never used */ + moveql #7,d3 /* this is a 7 word frame */ normal: movew sp@+,d1 /* pop status register */ - movel sp@+,a4 /* pop program counter */ - movew d1,a5@(66) /* save sr */ - movel a4,a5@(68) /* save pc in _regisers[] */ - movel a4,a0@- /* copy pc to frame buffer */ + movel sp@+,a4 /* pop program counter */ + movew d1,a5@(66) /* save sr */ + movel a4,a5@(68) /* save pc in _regisers[] */ + movel a4,a0@- /* copy pc to frame buffer */ movew d1,a0@- /* copy sr to frame buffer */ - movel sp,_superStack /* save supervisor sp */ + movel sp,_superStack /* save supervisor sp */ - andiw #0x2000,d1 /* were we in supervisor mode ? */ - beq userMode - movel a7,a5@(60) /* save a7 */ - bra saveDone + andiw #0x2000,d1 /* were we in supervisor mode ? */ + beq userMode + movel a7,a5@(60) /* save a7 */ + bra saveDone userMode: - movel usp,a1 /* save user stack pointer */ - movel a1,a5@(60) /* save user stack pointer */ + movel usp,a1 /* save user stack pointer */ + movel a1,a5@(60) /* save user stack pointer */ saveDone: - movew d3,a0@- /* push frame size in words */ - movel d2,a0@- /* push vector number */ - movel a4,a0@- /* push exception pc */ + movew d3,a0@- /* push frame size in words */ + movel d2,a0@- /* push vector number */ + movel a4,a0@- /* push exception pc */ # # save old frame link and set the new value movel _lastFrame,a1 /* last frame pointer */ movel a1,a0@- /* save pointer to prev frame */ - movel a0,_lastFrame + movel a0,_lastFrame - movel d2,sp@- /* push exception num */ + movel d2,sp@- /* push exception num */ movel _exceptionHook,a0 /* get address of handler */ - jbsr a0@ /* and call it */ - clrl sp@ /* replace exception num parm with frame ptr */ - jbsr __returnFromException /* jbsr, but never returns */ + jbsr a0@ /* and call it */ + clrl sp@ /* replace exception num parm with frame ptr */ + jbsr __returnFromException /* jbsr, but never returns */ "); #endif @@ -733,7 +733,7 @@ computeSignal (exceptionVector) break; /* line 1111 emulator */ /* Coprocessor protocol violation. Using a standard MMU or FPU - this cannot be triggered by software. Call it a SIGBUS. */ + this cannot be triggered by software. Call it a SIGBUS. */ case 13: sigval = 10; break; @@ -746,9 +746,9 @@ computeSignal (exceptionVector) break; /* breakpoint */ /* This is a trap #8 instruction. Apparently it is someone's software - convention for some sort of SIGFPE condition. Whose? How many - people are being screwed by having this code the way it is? - Is there a clean solution? */ + convention for some sort of SIGFPE condition. Whose? How many + people are being screwed by having this code the way it is? + Is there a clean solution? */ case 40: sigval = 8; break; /* floating point err */ @@ -1008,9 +1008,9 @@ handle_exception (int exceptionVector) frame = lastFrame - 1; /* by using a bunch of print commands with breakpoints, - it's possible for the frame stack to creep down. If it creeps - too far, give up and reset it to the top. Normal use should - not see this happen. + it's possible for the frame stack to creep down. If it creeps + too far, give up and reset it to the top. Normal use should + not see this happen. */ if ((unsigned int) (frame - 2) < (unsigned int) &gdbFrameStack) { |