Mercurial > ecos
annotate packages/kernel/current/src/debug/dbg-thread-demux.c @ 2729:74dbf4c3f2e1 after-copyright-change-20090129
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
| author | jlarmour |
|---|---|
| date | Thu, 29 Jan 2009 17:47:46 +0000 |
| parents | 956d016d5e0e |
| children |
| rev | line source |
|---|---|
| 0 | 1 /*========================================================================== |
| 2 // | |
| 3 // dbg-thread-demux.c | |
| 4 // | |
| 5 // GDB Stub ROM system calls | |
| 6 // | |
| 7 //========================================================================== | |
|
2729
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
1556
diff
changeset
|
8 // ####ECOSGPLCOPYRIGHTBEGIN#### |
|
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
1556
diff
changeset
|
9 // ------------------------------------------- |
|
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
1556
diff
changeset
|
10 // This file is part of eCos, the Embedded Configurable Operating System. |
|
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
1556
diff
changeset
|
11 // Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. |
|
208
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
143
diff
changeset
|
12 // |
|
2729
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
1556
diff
changeset
|
13 // eCos is free software; you can redistribute it and/or modify it under |
|
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
1556
diff
changeset
|
14 // the terms of the GNU General Public License as published by the Free |
|
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
1556
diff
changeset
|
15 // Software Foundation; either version 2 or (at your option) any later |
|
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
1556
diff
changeset
|
16 // version. |
|
208
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
143
diff
changeset
|
17 // |
|
2729
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
1556
diff
changeset
|
18 // eCos is distributed in the hope that it will be useful, but WITHOUT |
|
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
1556
diff
changeset
|
19 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
1556
diff
changeset
|
20 // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
1556
diff
changeset
|
21 // for more details. |
|
208
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
143
diff
changeset
|
22 // |
|
2729
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
1556
diff
changeset
|
23 // You should have received a copy of the GNU General Public License |
|
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
1556
diff
changeset
|
24 // along with eCos; if not, write to the Free Software Foundation, Inc., |
|
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
1556
diff
changeset
|
25 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
208
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
143
diff
changeset
|
26 // |
|
2729
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
1556
diff
changeset
|
27 // As a special exception, if other files instantiate templates or use |
|
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
1556
diff
changeset
|
28 // macros or inline functions from this file, or you compile this file |
|
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
1556
diff
changeset
|
29 // and link it with other works to produce a work based on this file, |
|
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
1556
diff
changeset
|
30 // this file does not by itself cause the resulting work to be covered by |
|
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
1556
diff
changeset
|
31 // the GNU General Public License. However the source code for this file |
|
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
1556
diff
changeset
|
32 // must still be made available in accordance with section (3) of the GNU |
|
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
1556
diff
changeset
|
33 // General Public License v2. |
|
208
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
143
diff
changeset
|
34 // |
|
2729
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
1556
diff
changeset
|
35 // This exception does not invalidate any other reasons why a work based |
|
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
1556
diff
changeset
|
36 // on this file might be covered by the GNU General Public License. |
|
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
1556
diff
changeset
|
37 // ------------------------------------------- |
|
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
1556
diff
changeset
|
38 // ####ECOSGPLCOPYRIGHTEND#### |
| 0 | 39 //========================================================================== |
| 40 //#####DESCRIPTIONBEGIN#### | |
| 41 // | |
| 42 // Author(s): nickg | |
| 43 // Contributors: | |
| 44 // Date: 1998-09-03 | |
| 45 // Purpose: GDB Stub ROM system calls | |
| 46 // Description: | |
| 47 // | |
| 48 //####DESCRIPTIONEND#### | |
| 49 // | |
| 50 //========================================================================*/ | |
| 51 | |
|
101
c37d3a9e1b28
Merge from eCos master repository on 2000-06-16-07:47:03-BST
jlarmour
parents:
76
diff
changeset
|
52 #include <cyg/hal/hal_arch.h> |
| 0 | 53 |
| 54 /* This file implements system calls out from the ROM debug stub into | |
| 55 the operating environment. | |
| 56 We assume they exist in the same address space. | |
| 57 This file should be linked into your operating environment, your O.S. | |
| 58 or whatever is managing multiple saved process contexts. | |
| 59 Your O.S. needs to implement and provide | |
| 60 dbg_thread_capabilities | |
| 61 dbg_currthread | |
| 62 dbg_threadlist | |
| 63 dbg_threadinfo | |
| 64 dbg_getthreadreg | |
| 65 dbg_setthreadreg | |
| 66 | |
| 67 The debug stub will call this function by calling it indirectly | |
| 68 vis a pre-assigned location possably somthing like a virtual vector table. | |
| 69 Where this is exactly is platform specific. | |
| 70 | |
| 71 The O.S. should call patch_dbg_syscalls() and pass the address of the | |
| 72 location to be patched with the dbg_thread_syscall_rmt function. | |
| 73 Nothing really calls this by name. | |
| 74 | |
| 75 This scheme would also work if we wanted to use a real trapped system call. | |
| 76 */ | |
| 77 | |
| 78 // ------------------------------------------------------------------------- | |
| 79 | |
| 2 | 80 #include <pkgconf/system.h> // for CYGPKG... and STARTUP |
| 81 | |
| 0 | 82 #include <pkgconf/kernel.h> |
| 83 | |
| 2 | 84 #include <cyg/infra/cyg_type.h> |
| 85 | |
| 0 | 86 #include "cyg/hal/dbg-threads-api.h" |
|
6
d376b777e2ce
Merge from eCos master repository on 1999-05-14-19:27:43-BST
jlarmour
parents:
2
diff
changeset
|
87 #include "cyg/hal/dbg-thread-syscall.h" |
| 0 | 88 |
| 89 // ------------------------------------------------------------------------- | |
| 90 | |
|
1556
956d016d5e0e
* src/debug/dbg-thread-demux.c (dbg_thread_syscall_rmt): Only
asl
parents:
210
diff
changeset
|
91 #ifdef CYGDBG_KERNEL_DEBUG_GDB_THREAD_SUPPORT |
| 0 | 92 static int dbg_thread_syscall_rmt( |
| 2 | 93 enum dbg_syscall_ids id, |
| 94 union dbg_thread_syscall_parms * p | |
| 95 ) | |
| 0 | 96 { |
|
101
c37d3a9e1b28
Merge from eCos master repository on 2000-06-16-07:47:03-BST
jlarmour
parents:
76
diff
changeset
|
97 int ret; |
|
c37d3a9e1b28
Merge from eCos master repository on 2000-06-16-07:47:03-BST
jlarmour
parents:
76
diff
changeset
|
98 CYGARC_HAL_SAVE_GP(); |
|
c37d3a9e1b28
Merge from eCos master repository on 2000-06-16-07:47:03-BST
jlarmour
parents:
76
diff
changeset
|
99 switch (id) |
| 0 | 100 { |
|
101
c37d3a9e1b28
Merge from eCos master repository on 2000-06-16-07:47:03-BST
jlarmour
parents:
76
diff
changeset
|
101 case dbg_null_func : |
|
c37d3a9e1b28
Merge from eCos master repository on 2000-06-16-07:47:03-BST
jlarmour
parents:
76
diff
changeset
|
102 ret = 1 ; /* test the syscall apparatus */ |
|
c37d3a9e1b28
Merge from eCos master repository on 2000-06-16-07:47:03-BST
jlarmour
parents:
76
diff
changeset
|
103 break; |
| 0 | 104 |
| 105 #ifdef CYGDBG_KERNEL_DEBUG_GDB_THREAD_SUPPORT | |
| 106 case dbg_capabilities_func : | |
|
101
c37d3a9e1b28
Merge from eCos master repository on 2000-06-16-07:47:03-BST
jlarmour
parents:
76
diff
changeset
|
107 ret = dbg_thread_capabilities(p->cap_parms.abilities) ; |
|
c37d3a9e1b28
Merge from eCos master repository on 2000-06-16-07:47:03-BST
jlarmour
parents:
76
diff
changeset
|
108 break ; |
| 0 | 109 case dbg_currthread_func : |
|
101
c37d3a9e1b28
Merge from eCos master repository on 2000-06-16-07:47:03-BST
jlarmour
parents:
76
diff
changeset
|
110 ret = dbg_currthread(p->currthread_parms.ref) ; |
|
c37d3a9e1b28
Merge from eCos master repository on 2000-06-16-07:47:03-BST
jlarmour
parents:
76
diff
changeset
|
111 break ; |
| 0 | 112 case dbg_threadlist_func : |
|
101
c37d3a9e1b28
Merge from eCos master repository on 2000-06-16-07:47:03-BST
jlarmour
parents:
76
diff
changeset
|
113 ret = dbg_threadlist(p->threadlist_parms.startflag, |
|
c37d3a9e1b28
Merge from eCos master repository on 2000-06-16-07:47:03-BST
jlarmour
parents:
76
diff
changeset
|
114 p->threadlist_parms.lastid, |
|
c37d3a9e1b28
Merge from eCos master repository on 2000-06-16-07:47:03-BST
jlarmour
parents:
76
diff
changeset
|
115 p->threadlist_parms.nextthreadid) ; |
|
c37d3a9e1b28
Merge from eCos master repository on 2000-06-16-07:47:03-BST
jlarmour
parents:
76
diff
changeset
|
116 break ; |
| 0 | 117 case dbg_threadinfo_func : |
|
101
c37d3a9e1b28
Merge from eCos master repository on 2000-06-16-07:47:03-BST
jlarmour
parents:
76
diff
changeset
|
118 ret = dbg_threadinfo(p->info_parms.ref, |
|
c37d3a9e1b28
Merge from eCos master repository on 2000-06-16-07:47:03-BST
jlarmour
parents:
76
diff
changeset
|
119 p->info_parms.info ) ; |
|
c37d3a9e1b28
Merge from eCos master repository on 2000-06-16-07:47:03-BST
jlarmour
parents:
76
diff
changeset
|
120 break ; |
| 0 | 121 case dbg_getthreadreg_func : |
|
101
c37d3a9e1b28
Merge from eCos master repository on 2000-06-16-07:47:03-BST
jlarmour
parents:
76
diff
changeset
|
122 ret = dbg_getthreadreg(p->reg_parms.thread, |
|
c37d3a9e1b28
Merge from eCos master repository on 2000-06-16-07:47:03-BST
jlarmour
parents:
76
diff
changeset
|
123 p->reg_parms.regcount, |
|
c37d3a9e1b28
Merge from eCos master repository on 2000-06-16-07:47:03-BST
jlarmour
parents:
76
diff
changeset
|
124 p->reg_parms.registers) ; |
|
c37d3a9e1b28
Merge from eCos master repository on 2000-06-16-07:47:03-BST
jlarmour
parents:
76
diff
changeset
|
125 break ; |
| 0 | 126 case dbg_setthreadreg_func : |
|
101
c37d3a9e1b28
Merge from eCos master repository on 2000-06-16-07:47:03-BST
jlarmour
parents:
76
diff
changeset
|
127 ret = dbg_setthreadreg(p->reg_parms.thread, |
|
c37d3a9e1b28
Merge from eCos master repository on 2000-06-16-07:47:03-BST
jlarmour
parents:
76
diff
changeset
|
128 p->reg_parms.regcount, |
|
c37d3a9e1b28
Merge from eCos master repository on 2000-06-16-07:47:03-BST
jlarmour
parents:
76
diff
changeset
|
129 p->reg_parms.registers) ; |
|
c37d3a9e1b28
Merge from eCos master repository on 2000-06-16-07:47:03-BST
jlarmour
parents:
76
diff
changeset
|
130 break ; |
| 2 | 131 case dbg_scheduler_func : |
|
101
c37d3a9e1b28
Merge from eCos master repository on 2000-06-16-07:47:03-BST
jlarmour
parents:
76
diff
changeset
|
132 ret = dbg_scheduler(p->scheduler_parms.thread, |
|
c37d3a9e1b28
Merge from eCos master repository on 2000-06-16-07:47:03-BST
jlarmour
parents:
76
diff
changeset
|
133 p->scheduler_parms.lock, |
|
c37d3a9e1b28
Merge from eCos master repository on 2000-06-16-07:47:03-BST
jlarmour
parents:
76
diff
changeset
|
134 p->scheduler_parms.mode) ; |
|
c37d3a9e1b28
Merge from eCos master repository on 2000-06-16-07:47:03-BST
jlarmour
parents:
76
diff
changeset
|
135 break ; |
| 0 | 136 #endif /* CYGDBG_KERNEL_DEBUG_GDB_THREAD_SUPPORT */ |
| 137 default : | |
|
101
c37d3a9e1b28
Merge from eCos master repository on 2000-06-16-07:47:03-BST
jlarmour
parents:
76
diff
changeset
|
138 ret = 0 ; /* failure due to non-implementation */ |
| 0 | 139 } |
|
101
c37d3a9e1b28
Merge from eCos master repository on 2000-06-16-07:47:03-BST
jlarmour
parents:
76
diff
changeset
|
140 CYGARC_HAL_RESTORE_GP(); |
|
c37d3a9e1b28
Merge from eCos master repository on 2000-06-16-07:47:03-BST
jlarmour
parents:
76
diff
changeset
|
141 return ret; |
| 0 | 142 } |
|
1556
956d016d5e0e
* src/debug/dbg-thread-demux.c (dbg_thread_syscall_rmt): Only
asl
parents:
210
diff
changeset
|
143 #endif /* CYGDBG_KERNEL_DEBUG_GDB_THREAD_SUPPORT */ |
|
143
6b5f480c6929
Merge from eCos master repository on 2000-12-08-02:09:36-GMT
jlarmour
parents:
101
diff
changeset
|
144 |
|
6b5f480c6929
Merge from eCos master repository on 2000-12-08-02:09:36-GMT
jlarmour
parents:
101
diff
changeset
|
145 // Note: This constant is the same as the one defined in hal_if.h: |
|
6b5f480c6929
Merge from eCos master repository on 2000-12-08-02:09:36-GMT
jlarmour
parents:
101
diff
changeset
|
146 // #define CYGNUM_CALL_IF_DBG_SYSCALL 15 |
|
6b5f480c6929
Merge from eCos master repository on 2000-12-08-02:09:36-GMT
jlarmour
parents:
101
diff
changeset
|
147 // But we don't have the hal_if on all the platforms we support this |
|
6b5f480c6929
Merge from eCos master repository on 2000-12-08-02:09:36-GMT
jlarmour
parents:
101
diff
changeset
|
148 // intercalling on. Maintaining backwards compatibility is so much fun! |
|
6b5f480c6929
Merge from eCos master repository on 2000-12-08-02:09:36-GMT
jlarmour
parents:
101
diff
changeset
|
149 |
| 2 | 150 #define DBG_SYSCALL_THREAD_VEC_NUM 15 |
| 151 | |
| 152 #ifdef CYGDBG_KERNEL_DEBUG_GDB_THREAD_SUPPORT | |
| 153 | |
|
76
435cced73e2f
eCos v1.3.1 merged from eCos master repository on 2000-03-27-23:22:51-BST
jlarmour
parents:
66
diff
changeset
|
154 #ifdef CYGPKG_HAL_SPARCLITE_SLEB |
| 2 | 155 # include <cyg/hal/hal_cygm.h> |
| 156 # ifdef CYG_HAL_USE_ROM_MONITOR_CYGMON | |
| 157 // then we support talking to CygMon... | |
| 158 # undef DBG_SYSCALL_THREAD_VEC_NUM | |
| 159 # define DBG_SYSCALL_THREAD_VEC_NUM BSP_VEC_MT_DEBUG | |
| 160 # endif | |
| 161 // otherwise this code is wrong for SPARClite but also not used. | |
| 162 #endif | |
| 163 | |
| 164 #endif | |
| 165 | |
| 0 | 166 void patch_dbg_syscalls(void * vector) |
| 167 { | |
| 168 dbg_syscall_func * f ; | |
| 169 f = vector ; | |
| 2 | 170 |
| 171 #ifdef CYGDBG_KERNEL_DEBUG_GDB_THREAD_SUPPORT | |
| 172 | |
| 173 f[DBG_SYSCALL_THREAD_VEC_NUM] = dbg_thread_syscall_rmt ; | |
| 174 | |
| 175 #endif | |
| 176 | |
| 0 | 177 } |
| 178 | |
| 179 // ------------------------------------------------------------------------- | |
| 180 // End of dbg-thread-demux.c |
