Motorola M68CPU32BUG User Manual Page 14

  • Download
  • Add to my manuals
  • Print
  • Page
    / 98
  • Table of contents
  • BOOKMARKS
  • Rated. / 5. Based on customer reviews
Page view 13
DEBUG MONITOR DESCRIPTION
M68CPU32BUG/D REV 1 2-10
2.5.2.2 Creating Vector Tables
A user program may create a separate vector table to store its exception vectors. If this is done,
the user program must change the value of the vector base register to point to the new vector
table. To use the debugger facilities, copy the vectors from the CPU32Bug vector table into the
corresponding user vector table locations (block of memory move (BM) command).
The vector for the CPU32Bug generalized exception handler (described in detail in paragraph
2.5.2.3) may be copied from offset $08 (Bus Error vector) in the target-vector table to all
locations in the user’s vector table where a separate exception handler is not used. This provides
diagnostic support in the event execution of the user program is terminated by an unexpected
exception. The generalized exception handler gives a formatted display of the target registers and
identifies the type of the exception.
The following is an example of a user routine which builds a separate vector table and then sets
the vector base register to point at it.
*
*** BUILDX
Build exception vector table ***
*
BUILDX MOVEC.L VBR,A0
Get copy of VBR.
LEA $1 0000,A1
New vectors at $10000.
MOVE.L $8(A0),D0
Get generalized exception vector.
MOVE.W $3FC,D1
Load count (all vectors).
LOOP MOVE.L D0,(A1,D1)
Store generalized exception vector.
SU BQ.W #4, D 1
BPL.B LOOP
Initialize entire vector table.
MOVE.L $1 0(A0),$1 0(A1 )
Copy breakpoints vector.
MOVE.L $24(A0),$24(A1 )
Copy trace vector.
MOVE.L $BC(A0),$BC(A1 )
Copy system call vector.
LEA.L TIMER(PC),A2
Get user exception vector.
MOVE.L A2,$2C(A1 )
Install as F-Line handler.
MOVEC.L A1 ,VBR
Change VBR to new table.
RTS
END
The user program may use one or more of the exception vectors that are required for debugger
operation if the user’s exception handler can determine when to handle the exception itself and
when to pass the exception to the debugger.
When an exception occurs which requires debugger operation (i.e., ABORT), the user’s
exception handler must read the vector offset from the exception-stack-frame format word. This
offset is added to the address of the CPU32Bug target program vector table (which the user
program saves), producing the address of the CPU32Bug exception vector. The user program
then jumps to the address stored at this vector location (i.e., which is the address of the
CPU32Bug exception handler).
The user program must ensure an exception stack frame is in the stack and that it is identical to
one the processor would create for the particular exception. It may then jump to the address of
the exception handler.
DEBUG MONITOR DESCRIPTION
M68CPU32BUG/D REV 1 2-11
EXAMPLE The user exception handler passes an exception along to the debugger.
*
*** EXCEPT - Exception handler ****
*
EXCEPT SUBQ.L #4,A7
Save space in stack for a PC value.
LINK A6,#0
Frame pointer for accessing PC space.
MOVEM.L A0-A5/D0-D7,-(A7)
Save registers.
: decide here if user code will handle exception, if so, branch...
MOVE.L BUFVBR,A0
Pass exception to debugger; Get VBR.
MOVE.W 14(A6), Do
Get the vector offset from stack frame.
AND.W #$0FFF,D0
Mask off the format information.
MOVE.L (A0,D0.W),4(A6)
Store address of debugger exception handler.
UNLK
A6
RTS
Put address of exception handler into PC and go.
2.5.2.3 CPU32Bug Generalized Exception Handler
The CPU32Bug generalized exception handler supervises all exceptions not listed in Table 2-2.
For these exceptions, the target stack pointer points to the top of the user exception stack frame.
In this way, if an unexpected exception occurs during user code segment execution, the exception
stack frame displays to assist in determining the cause of the exception.
EXAMPLE Bus error at address $F00000. It is assumed for this example that an access
of memory location $F00000 initiates bus error exception processing.
CPU32Bug>RD<CR>
PC =00003000 SR =2700=TR:OFF_S_7_.... VBR =00000000
SFC =5=SD DFC =5=SD USP =0000FC00 SSP* =00004000
D0 =00000000 D1 =00000000 D2 =00000000 D3 =00000000
D4 =00000000 D5 =00000000 D6 =00000000 D7 =00000000
A0 =00000000 A1 =00000000 A2 =00000000 A3 =00000000
A4 =00000000 A5 =00000000 A6 =00000000 A7 =00004000
00003000 203900F0 0000 MOVE.L ($F00000).L,D0
CPU32Bug>T<CR>
Exception: Bus Error
Format/Vector=C008
SSW=0065 Fault Addr.=00F00000 Data=FFFF3000 Cur. PC=00003000 Cnt. Reg.=0001
PC =00003000 SR =A700=TR:ALL_S_7_.... VBR =00000000
SFC =5=SD DFC =5=SD USP =0000FC00 SSP* =00003FE8
D0 =00000000 D1 =00000000 D2 =00000000 D3 =00000000
D4 =00000000 D5 =00000000 D6 =00000000 D7 =00000000
A0 =00000000 A1 =00000000 A2 =00000000 A3 =00000000
A4 =00000000 A5 =00000000 A6 =00000000 A7 =00003FE8
00003000 203900F0 0000 MOVE.L ($F00000).L,D0
CPU32Bug>
Fr
eescale S
emiconduct
or
, I
Freescale Semiconductor, Inc.
For More Information On This Product,
Go to: www.freescale.com
nc...
Page view 13
1 2 ... 9 10 11 12 13 14 15 16 17 18 19 ... 97 98

Comments to this Manuals

No comments