comparison packages/hal/mn10300/arch/current/src/mn10300_stub.c @ 30:641b639be825 ecos-sw-1999-08-16

Merge from eCos master repository on 1999-08-16-22:01:37-BST
author jlarmour
date Mon, 16 Aug 1999 22:10:49 +0000
parents 443894e2e912
children c38311975d4f
comparison
equal deleted inserted replaced
29:093762bd6ba9 30:641b639be825
25 25
26 #ifdef CYGDBG_HAL_DEBUG_GDB_THREAD_SUPPORT 26 #ifdef CYGDBG_HAL_DEBUG_GDB_THREAD_SUPPORT
27 #include <cyg/hal/dbg-threads-api.h> // dbg_currthread_id 27 #include <cyg/hal/dbg-threads-api.h> // dbg_currthread_id
28 #endif 28 #endif
29 29
30 /*----------------------------------------------------------------------
31 * Asynchronous interrupt support
32 */
33
34 typedef unsigned char t_inst;
35
36 static struct
37 {
38 t_inst *targetAddr;
39 t_inst savedInstr;
40 } asyncBuffer;
41
42 /* Called to asynchronously interrupt a running program.
43 Must be passed address of instruction interrupted.
44 This is typically called in response to a debug port
45 receive interrupt.
46 */
47
48 void
49 install_async_breakpoint(void *pc)
50 {
51 asyncBuffer.targetAddr = pc;
52 asyncBuffer.savedInstr = *(t_inst *)pc;
53 *(t_inst *)pc = (t_inst)HAL_BREAKINST;
54 __instruction_cache(CACHE_FLUSH);
55 __data_cache(CACHE_FLUSH);
56 }
57
58 /*--------------------------------------------------------------------*/
30 /* Given a trap value TRAP, return the corresponding signal. */ 59 /* Given a trap value TRAP, return the corresponding signal. */
31 60
32 int __computeSignal (unsigned int trap_number) 61 int __computeSignal (unsigned int trap_number)
33 { 62 {
63 if (asyncBuffer.targetAddr != NULL)
64 {
65 /* BP installed by serial driver to stop running program */
66 *asyncBuffer.targetAddr = asyncBuffer.savedInstr;
67 __instruction_cache(CACHE_FLUSH);
68 __data_cache(CACHE_FLUSH);
69 asyncBuffer.targetAddr = NULL;
70 return SIGINT;
71 }
34 return SIGTRAP; 72 return SIGTRAP;
35 } 73 }
36 74
37 75 /*--------------------------------------------------------------------*/
38 /* Return the trap number corresponding to the last-taken trap. */ 76 /* Return the trap number corresponding to the last-taken trap. */
39 77
40 int __get_trap_number (void) 78 int __get_trap_number (void)
41 { 79 {
42 // The vector is not not part of the GDB register set so get it 80 // The vector is not not part of the GDB register set so get it
43 // directly from the save context. 81 // directly from the save context.
44 return _hal_registers->vector; 82 return _hal_registers->vector;
45 } 83 }
46 84
85 /*--------------------------------------------------------------------*/
47 /* Set the currently-saved pc register value to PC. This also updates NPC 86 /* Set the currently-saved pc register value to PC. This also updates NPC
48 as needed. */ 87 as needed. */
49 88
50 void set_pc (target_register_t pc) 89 void set_pc (target_register_t pc)
51 { 90 {