This is the mail archive of the gdb@sourceware.cygnus.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: exceptionHandler for 68K


>>>>> "David" == David Williams <davidwilliams@ozemail.com.au> writes:
David> Has anyone got an example of the exceptionHandler() function
David> for the 68K (plain old 68000 core). The m68k-stub.c module
David> requires one (as explained in GDB manual). However it appears
David> that this function must use its own special vector table to
David> help identify the vector number (using return address
David> magic!). It would just be nice to see some source code to
David> clarify some issues for me.

Although the debug stubs distributed with GDB can be used without
modification, there is no reason why you must do so.  

Exception handling mechanisms are target dependent.  If you're happy
with the exception mechanism you are currently using (or the one you
have designed, if you're not that far), In my opinion it is better to
adapt the debug stubs exception handler installation code rather than
to force your system to match.

All that being said...  

It's been a long time since I've used the m68k, but if I remember
correctly the addresses of exception handlers are stored in a 256
entry table, the address of which is stored in a exception vector
table base register.  

In C, you might do something like this to install an address:

        void *exc_tbl[256];

        void
        exceptionHandler(int vec, void *addr)
        {
                exc_tbl[vec] = addr;
        }

In assembly, the code might be something like this:

        # 
        # Inputs:
        #   d0 - vector
        #   d1 - address of exception handler
        #   a0 - address of exc_tbl
        #
        move.l  %d1,(%a0,%d0.l*4)

Hope this helps,

        --jtc

-- 
J.T. Conklin
RedBack Networks

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]