Rev 1695 | Rev 1712 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1695 | Rev 1702 | ||
---|---|---|---|
1 | /* |
1 | /* |
2 | * Copyright (C) 2005 Jakub Jermar |
2 | * Copyright (C) 2005 Jakub Jermar |
3 | * All rights reserved. |
3 | * All rights reserved. |
4 | * |
4 | * |
5 | * Redistribution and use in source and binary forms, with or without |
5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions |
6 | * modification, are permitted provided that the following conditions |
7 | * are met: |
7 | * are met: |
8 | * |
8 | * |
9 | * - Redistributions of source code must retain the above copyright |
9 | * - Redistributions of source code must retain the above copyright |
10 | * notice, this list of conditions and the following disclaimer. |
10 | * notice, this list of conditions and the following disclaimer. |
11 | * - Redistributions in binary form must reproduce the above copyright |
11 | * - Redistributions in binary form must reproduce the above copyright |
12 | * notice, this list of conditions and the following disclaimer in the |
12 | * notice, this list of conditions and the following disclaimer in the |
13 | * documentation and/or other materials provided with the distribution. |
13 | * documentation and/or other materials provided with the distribution. |
14 | * - The name of the author may not be used to endorse or promote products |
14 | * - The name of the author may not be used to endorse or promote products |
15 | * derived from this software without specific prior written permission. |
15 | * derived from this software without specific prior written permission. |
16 | * |
16 | * |
17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 | */ |
27 | */ |
28 | 28 | ||
- | 29 | /** @addtogroup genericconsole |
|
- | 30 | * @{ |
|
- | 31 | */ |
|
- | 32 | ||
29 | /** |
33 | /** |
30 | * @file cmd.c |
34 | * @file cmd.c |
31 | * @brief Kernel console command wrappers. |
35 | * @brief Kernel console command wrappers. |
32 | * |
36 | * |
33 | * This file is meant to contain all wrapper functions for |
37 | * This file is meant to contain all wrapper functions for |
34 | * all kconsole commands. The point is in separating |
38 | * all kconsole commands. The point is in separating |
35 | * kconsole specific wrappers from kconsole-unaware functions |
39 | * kconsole specific wrappers from kconsole-unaware functions |
36 | * from other subsystems. |
40 | * from other subsystems. |
37 | */ |
41 | */ |
38 | 42 | ||
39 | #include <console/cmd.h> |
43 | #include <console/cmd.h> |
40 | #include <console/console.h> |
44 | #include <console/console.h> |
41 | #include <console/kconsole.h> |
45 | #include <console/kconsole.h> |
42 | #include <print.h> |
46 | #include <print.h> |
43 | #include <panic.h> |
47 | #include <panic.h> |
44 | #include <typedefs.h> |
48 | #include <typedefs.h> |
45 | #include <arch/types.h> |
49 | #include <arch/types.h> |
46 | #include <adt/list.h> |
50 | #include <adt/list.h> |
47 | #include <arch.h> |
51 | #include <arch.h> |
48 | #include <func.h> |
52 | #include <func.h> |
49 | #include <macros.h> |
53 | #include <macros.h> |
50 | #include <debug.h> |
54 | #include <debug.h> |
51 | #include <symtab.h> |
55 | #include <symtab.h> |
52 | #include <cpu.h> |
56 | #include <cpu.h> |
53 | #include <mm/tlb.h> |
57 | #include <mm/tlb.h> |
54 | #include <arch/mm/tlb.h> |
58 | #include <arch/mm/tlb.h> |
55 | #include <mm/frame.h> |
59 | #include <mm/frame.h> |
56 | #include <main/version.h> |
60 | #include <main/version.h> |
57 | #include <mm/slab.h> |
61 | #include <mm/slab.h> |
58 | #include <proc/scheduler.h> |
62 | #include <proc/scheduler.h> |
59 | #include <proc/thread.h> |
63 | #include <proc/thread.h> |
60 | #include <proc/task.h> |
64 | #include <proc/task.h> |
61 | #include <ipc/ipc.h> |
65 | #include <ipc/ipc.h> |
62 | 66 | ||
63 | /** Data and methods for 'help' command. */ |
67 | /* Data and methods for 'help' command. */ |
64 | static int cmd_help(cmd_arg_t *argv); |
68 | static int cmd_help(cmd_arg_t *argv); |
65 | static cmd_info_t help_info = { |
69 | static cmd_info_t help_info = { |
66 | .name = "help", |
70 | .name = "help", |
67 | .description = "List of supported commands.", |
71 | .description = "List of supported commands.", |
68 | .func = cmd_help, |
72 | .func = cmd_help, |
69 | .argc = 0 |
73 | .argc = 0 |
70 | }; |
74 | }; |
71 | 75 | ||
72 | static cmd_info_t exit_info = { |
76 | static cmd_info_t exit_info = { |
73 | .name = "exit", |
77 | .name = "exit", |
74 | .description ="Exit kconsole", |
78 | .description ="Exit kconsole", |
75 | .argc = 0 |
79 | .argc = 0 |
76 | }; |
80 | }; |
77 | 81 | ||
78 | static int cmd_continue(cmd_arg_t *argv); |
82 | static int cmd_continue(cmd_arg_t *argv); |
79 | static cmd_info_t continue_info = { |
83 | static cmd_info_t continue_info = { |
80 | .name = "continue", |
84 | .name = "continue", |
81 | .description ="Return console back to userspace.", |
85 | .description ="Return console back to userspace.", |
82 | .func = cmd_continue, |
86 | .func = cmd_continue, |
83 | .argc = 0 |
87 | .argc = 0 |
84 | }; |
88 | }; |
85 | 89 | ||
86 | /** Data and methods for 'description' command. */ |
90 | /* Data and methods for 'description' command. */ |
87 | static int cmd_desc(cmd_arg_t *argv); |
91 | static int cmd_desc(cmd_arg_t *argv); |
88 | static void desc_help(void); |
92 | static void desc_help(void); |
89 | static char desc_buf[MAX_CMDLINE+1]; |
93 | static char desc_buf[MAX_CMDLINE+1]; |
90 | static cmd_arg_t desc_argv = { |
94 | static cmd_arg_t desc_argv = { |
91 | .type = ARG_TYPE_STRING, |
95 | .type = ARG_TYPE_STRING, |
92 | .buffer = desc_buf, |
96 | .buffer = desc_buf, |
93 | .len = sizeof(desc_buf) |
97 | .len = sizeof(desc_buf) |
94 | }; |
98 | }; |
95 | static cmd_info_t desc_info = { |
99 | static cmd_info_t desc_info = { |
96 | .name = "describe", |
100 | .name = "describe", |
97 | .description = "Describe specified command.", |
101 | .description = "Describe specified command.", |
98 | .help = desc_help, |
102 | .help = desc_help, |
99 | .func = cmd_desc, |
103 | .func = cmd_desc, |
100 | .argc = 1, |
104 | .argc = 1, |
101 | .argv = &desc_argv |
105 | .argv = &desc_argv |
102 | }; |
106 | }; |
103 | 107 | ||
104 | /** Data and methods for 'symaddr' command. */ |
108 | /* Data and methods for 'symaddr' command. */ |
105 | static int cmd_symaddr(cmd_arg_t *argv); |
109 | static int cmd_symaddr(cmd_arg_t *argv); |
106 | static char symaddr_buf[MAX_CMDLINE+1]; |
110 | static char symaddr_buf[MAX_CMDLINE+1]; |
107 | static cmd_arg_t symaddr_argv = { |
111 | static cmd_arg_t symaddr_argv = { |
108 | .type = ARG_TYPE_STRING, |
112 | .type = ARG_TYPE_STRING, |
109 | .buffer = symaddr_buf, |
113 | .buffer = symaddr_buf, |
110 | .len = sizeof(symaddr_buf) |
114 | .len = sizeof(symaddr_buf) |
111 | }; |
115 | }; |
112 | static cmd_info_t symaddr_info = { |
116 | static cmd_info_t symaddr_info = { |
113 | .name = "symaddr", |
117 | .name = "symaddr", |
114 | .description = "Return symbol address.", |
118 | .description = "Return symbol address.", |
115 | .func = cmd_symaddr, |
119 | .func = cmd_symaddr, |
116 | .argc = 1, |
120 | .argc = 1, |
117 | .argv = &symaddr_argv |
121 | .argv = &symaddr_argv |
118 | }; |
122 | }; |
119 | 123 | ||
120 | static char set_buf[MAX_CMDLINE+1]; |
124 | static char set_buf[MAX_CMDLINE+1]; |
121 | static int cmd_set4(cmd_arg_t *argv); |
125 | static int cmd_set4(cmd_arg_t *argv); |
122 | static cmd_arg_t set4_argv[] = { |
126 | static cmd_arg_t set4_argv[] = { |
123 | { |
127 | { |
124 | .type = ARG_TYPE_STRING, |
128 | .type = ARG_TYPE_STRING, |
125 | .buffer = set_buf, |
129 | .buffer = set_buf, |
126 | .len = sizeof(set_buf) |
130 | .len = sizeof(set_buf) |
127 | }, |
131 | }, |
128 | { |
132 | { |
129 | .type = ARG_TYPE_INT |
133 | .type = ARG_TYPE_INT |
130 | } |
134 | } |
131 | }; |
135 | }; |
132 | static cmd_info_t set4_info = { |
136 | static cmd_info_t set4_info = { |
133 | .name = "set4", |
137 | .name = "set4", |
134 | .description = "set <dest_addr> <value> - 4byte version", |
138 | .description = "set <dest_addr> <value> - 4byte version", |
135 | .func = cmd_set4, |
139 | .func = cmd_set4, |
136 | .argc = 2, |
140 | .argc = 2, |
137 | .argv = set4_argv |
141 | .argv = set4_argv |
138 | }; |
142 | }; |
139 | 143 | ||
140 | /** Data and methods for 'call0' command. */ |
144 | /* Data and methods for 'call0' command. */ |
141 | static char call0_buf[MAX_CMDLINE+1]; |
145 | static char call0_buf[MAX_CMDLINE+1]; |
142 | static char carg1_buf[MAX_CMDLINE+1]; |
146 | static char carg1_buf[MAX_CMDLINE+1]; |
143 | static char carg2_buf[MAX_CMDLINE+1]; |
147 | static char carg2_buf[MAX_CMDLINE+1]; |
144 | static char carg3_buf[MAX_CMDLINE+1]; |
148 | static char carg3_buf[MAX_CMDLINE+1]; |
145 | 149 | ||
146 | static int cmd_call0(cmd_arg_t *argv); |
150 | static int cmd_call0(cmd_arg_t *argv); |
147 | static cmd_arg_t call0_argv = { |
151 | static cmd_arg_t call0_argv = { |
148 | .type = ARG_TYPE_STRING, |
152 | .type = ARG_TYPE_STRING, |
149 | .buffer = call0_buf, |
153 | .buffer = call0_buf, |
150 | .len = sizeof(call0_buf) |
154 | .len = sizeof(call0_buf) |
151 | }; |
155 | }; |
152 | static cmd_info_t call0_info = { |
156 | static cmd_info_t call0_info = { |
153 | .name = "call0", |
157 | .name = "call0", |
154 | .description = "call0 <function> -> call function().", |
158 | .description = "call0 <function> -> call function().", |
155 | .func = cmd_call0, |
159 | .func = cmd_call0, |
156 | .argc = 1, |
160 | .argc = 1, |
157 | .argv = &call0_argv |
161 | .argv = &call0_argv |
158 | }; |
162 | }; |
159 | 163 | ||
160 | /** Data and methods for 'call1' command. */ |
164 | /* Data and methods for 'call1' command. */ |
161 | static int cmd_call1(cmd_arg_t *argv); |
165 | static int cmd_call1(cmd_arg_t *argv); |
162 | static cmd_arg_t call1_argv[] = { |
166 | static cmd_arg_t call1_argv[] = { |
163 | { |
167 | { |
164 | .type = ARG_TYPE_STRING, |
168 | .type = ARG_TYPE_STRING, |
165 | .buffer = call0_buf, |
169 | .buffer = call0_buf, |
166 | .len = sizeof(call0_buf) |
170 | .len = sizeof(call0_buf) |
167 | }, |
171 | }, |
168 | { |
172 | { |
169 | .type = ARG_TYPE_VAR, |
173 | .type = ARG_TYPE_VAR, |
170 | .buffer = carg1_buf, |
174 | .buffer = carg1_buf, |
171 | .len = sizeof(carg1_buf) |
175 | .len = sizeof(carg1_buf) |
172 | } |
176 | } |
173 | }; |
177 | }; |
174 | static cmd_info_t call1_info = { |
178 | static cmd_info_t call1_info = { |
175 | .name = "call1", |
179 | .name = "call1", |
176 | .description = "call1 <function> <arg1> -> call function(arg1).", |
180 | .description = "call1 <function> <arg1> -> call function(arg1).", |
177 | .func = cmd_call1, |
181 | .func = cmd_call1, |
178 | .argc = 2, |
182 | .argc = 2, |
179 | .argv = call1_argv |
183 | .argv = call1_argv |
180 | }; |
184 | }; |
181 | 185 | ||
182 | /** Data and methods for 'call2' command. */ |
186 | /* Data and methods for 'call2' command. */ |
183 | static int cmd_call2(cmd_arg_t *argv); |
187 | static int cmd_call2(cmd_arg_t *argv); |
184 | static cmd_arg_t call2_argv[] = { |
188 | static cmd_arg_t call2_argv[] = { |
185 | { |
189 | { |
186 | .type = ARG_TYPE_STRING, |
190 | .type = ARG_TYPE_STRING, |
187 | .buffer = call0_buf, |
191 | .buffer = call0_buf, |
188 | .len = sizeof(call0_buf) |
192 | .len = sizeof(call0_buf) |
189 | }, |
193 | }, |
190 | { |
194 | { |
191 | .type = ARG_TYPE_VAR, |
195 | .type = ARG_TYPE_VAR, |
192 | .buffer = carg1_buf, |
196 | .buffer = carg1_buf, |
193 | .len = sizeof(carg1_buf) |
197 | .len = sizeof(carg1_buf) |
194 | }, |
198 | }, |
195 | { |
199 | { |
196 | .type = ARG_TYPE_VAR, |
200 | .type = ARG_TYPE_VAR, |
197 | .buffer = carg2_buf, |
201 | .buffer = carg2_buf, |
198 | .len = sizeof(carg2_buf) |
202 | .len = sizeof(carg2_buf) |
199 | } |
203 | } |
200 | }; |
204 | }; |
201 | static cmd_info_t call2_info = { |
205 | static cmd_info_t call2_info = { |
202 | .name = "call2", |
206 | .name = "call2", |
203 | .description = "call2 <function> <arg1> <arg2> -> call function(arg1,arg2).", |
207 | .description = "call2 <function> <arg1> <arg2> -> call function(arg1,arg2).", |
204 | .func = cmd_call2, |
208 | .func = cmd_call2, |
205 | .argc = 3, |
209 | .argc = 3, |
206 | .argv = call2_argv |
210 | .argv = call2_argv |
207 | }; |
211 | }; |
208 | 212 | ||
209 | /** Data and methods for 'call3' command. */ |
213 | /* Data and methods for 'call3' command. */ |
210 | static int cmd_call3(cmd_arg_t *argv); |
214 | static int cmd_call3(cmd_arg_t *argv); |
211 | static cmd_arg_t call3_argv[] = { |
215 | static cmd_arg_t call3_argv[] = { |
212 | { |
216 | { |
213 | .type = ARG_TYPE_STRING, |
217 | .type = ARG_TYPE_STRING, |
214 | .buffer = call0_buf, |
218 | .buffer = call0_buf, |
215 | .len = sizeof(call0_buf) |
219 | .len = sizeof(call0_buf) |
216 | }, |
220 | }, |
217 | { |
221 | { |
218 | .type = ARG_TYPE_VAR, |
222 | .type = ARG_TYPE_VAR, |
219 | .buffer = carg1_buf, |
223 | .buffer = carg1_buf, |
220 | .len = sizeof(carg1_buf) |
224 | .len = sizeof(carg1_buf) |
221 | }, |
225 | }, |
222 | { |
226 | { |
223 | .type = ARG_TYPE_VAR, |
227 | .type = ARG_TYPE_VAR, |
224 | .buffer = carg2_buf, |
228 | .buffer = carg2_buf, |
225 | .len = sizeof(carg2_buf) |
229 | .len = sizeof(carg2_buf) |
226 | }, |
230 | }, |
227 | { |
231 | { |
228 | .type = ARG_TYPE_VAR, |
232 | .type = ARG_TYPE_VAR, |
229 | .buffer = carg3_buf, |
233 | .buffer = carg3_buf, |
230 | .len = sizeof(carg3_buf) |
234 | .len = sizeof(carg3_buf) |
231 | } |
235 | } |
232 | 236 | ||
233 | }; |
237 | }; |
234 | static cmd_info_t call3_info = { |
238 | static cmd_info_t call3_info = { |
235 | .name = "call3", |
239 | .name = "call3", |
236 | .description = "call3 <function> <arg1> <arg2> <arg3> -> call function(arg1,arg2,arg3).", |
240 | .description = "call3 <function> <arg1> <arg2> <arg3> -> call function(arg1,arg2,arg3).", |
237 | .func = cmd_call3, |
241 | .func = cmd_call3, |
238 | .argc = 4, |
242 | .argc = 4, |
239 | .argv = call3_argv |
243 | .argv = call3_argv |
240 | }; |
244 | }; |
241 | 245 | ||
242 | /** Data and methods for 'halt' command. */ |
246 | /* Data and methods for 'halt' command. */ |
243 | static int cmd_halt(cmd_arg_t *argv); |
247 | static int cmd_halt(cmd_arg_t *argv); |
244 | static cmd_info_t halt_info = { |
248 | static cmd_info_t halt_info = { |
245 | .name = "halt", |
249 | .name = "halt", |
246 | .description = "Halt the kernel.", |
250 | .description = "Halt the kernel.", |
247 | .func = cmd_halt, |
251 | .func = cmd_halt, |
248 | .argc = 0 |
252 | .argc = 0 |
249 | }; |
253 | }; |
250 | 254 | ||
251 | /** Data and methods for 'tlb' command. */ |
255 | /* Data and methods for 'tlb' command. */ |
252 | static int cmd_tlb(cmd_arg_t *argv); |
256 | static int cmd_tlb(cmd_arg_t *argv); |
253 | cmd_info_t tlb_info = { |
257 | cmd_info_t tlb_info = { |
254 | .name = "tlb", |
258 | .name = "tlb", |
255 | .description = "Print TLB of current processor.", |
259 | .description = "Print TLB of current processor.", |
256 | .help = NULL, |
260 | .help = NULL, |
257 | .func = cmd_tlb, |
261 | .func = cmd_tlb, |
258 | .argc = 0, |
262 | .argc = 0, |
259 | .argv = NULL |
263 | .argv = NULL |
260 | }; |
264 | }; |
261 | 265 | ||
262 | static int cmd_threads(cmd_arg_t *argv); |
266 | static int cmd_threads(cmd_arg_t *argv); |
263 | static cmd_info_t threads_info = { |
267 | static cmd_info_t threads_info = { |
264 | .name = "threads", |
268 | .name = "threads", |
265 | .description = "List all threads.", |
269 | .description = "List all threads.", |
266 | .func = cmd_threads, |
270 | .func = cmd_threads, |
267 | .argc = 0 |
271 | .argc = 0 |
268 | }; |
272 | }; |
269 | 273 | ||
270 | static int cmd_tasks(cmd_arg_t *argv); |
274 | static int cmd_tasks(cmd_arg_t *argv); |
271 | static cmd_info_t tasks_info = { |
275 | static cmd_info_t tasks_info = { |
272 | .name = "tasks", |
276 | .name = "tasks", |
273 | .description = "List all tasks.", |
277 | .description = "List all tasks.", |
274 | .func = cmd_tasks, |
278 | .func = cmd_tasks, |
275 | .argc = 0 |
279 | .argc = 0 |
276 | }; |
280 | }; |
277 | 281 | ||
278 | 282 | ||
279 | static int cmd_sched(cmd_arg_t *argv); |
283 | static int cmd_sched(cmd_arg_t *argv); |
280 | static cmd_info_t sched_info = { |
284 | static cmd_info_t sched_info = { |
281 | .name = "scheduler", |
285 | .name = "scheduler", |
282 | .description = "List all scheduler information.", |
286 | .description = "List all scheduler information.", |
283 | .func = cmd_sched, |
287 | .func = cmd_sched, |
284 | .argc = 0 |
288 | .argc = 0 |
285 | }; |
289 | }; |
286 | 290 | ||
287 | static int cmd_slabs(cmd_arg_t *argv); |
291 | static int cmd_slabs(cmd_arg_t *argv); |
288 | static cmd_info_t slabs_info = { |
292 | static cmd_info_t slabs_info = { |
289 | .name = "slabs", |
293 | .name = "slabs", |
290 | .description = "List slab caches.", |
294 | .description = "List slab caches.", |
291 | .func = cmd_slabs, |
295 | .func = cmd_slabs, |
292 | .argc = 0 |
296 | .argc = 0 |
293 | }; |
297 | }; |
294 | 298 | ||
295 | /** Data and methods for 'zones' command */ |
299 | /* Data and methods for 'zones' command */ |
296 | static int cmd_zones(cmd_arg_t *argv); |
300 | static int cmd_zones(cmd_arg_t *argv); |
297 | static cmd_info_t zones_info = { |
301 | static cmd_info_t zones_info = { |
298 | .name = "zones", |
302 | .name = "zones", |
299 | .description = "List of memory zones.", |
303 | .description = "List of memory zones.", |
300 | .func = cmd_zones, |
304 | .func = cmd_zones, |
301 | .argc = 0 |
305 | .argc = 0 |
302 | }; |
306 | }; |
303 | 307 | ||
304 | /** Data and methods for 'ipc_task' command */ |
308 | /* Data and methods for 'ipc_task' command */ |
305 | static int cmd_ipc_task(cmd_arg_t *argv); |
309 | static int cmd_ipc_task(cmd_arg_t *argv); |
306 | static cmd_arg_t ipc_task_argv = { |
310 | static cmd_arg_t ipc_task_argv = { |
307 | .type = ARG_TYPE_INT, |
311 | .type = ARG_TYPE_INT, |
308 | }; |
312 | }; |
309 | static cmd_info_t ipc_task_info = { |
313 | static cmd_info_t ipc_task_info = { |
310 | .name = "ipc_task", |
314 | .name = "ipc_task", |
311 | .description = "ipc_task <taskid> Show IPC information of given task.", |
315 | .description = "ipc_task <taskid> Show IPC information of given task.", |
312 | .func = cmd_ipc_task, |
316 | .func = cmd_ipc_task, |
313 | .argc = 1, |
317 | .argc = 1, |
314 | .argv = &ipc_task_argv |
318 | .argv = &ipc_task_argv |
315 | }; |
319 | }; |
316 | 320 | ||
317 | /** Data and methods for 'zone' command */ |
321 | /* Data and methods for 'zone' command */ |
318 | static int cmd_zone(cmd_arg_t *argv); |
322 | static int cmd_zone(cmd_arg_t *argv); |
319 | static cmd_arg_t zone_argv = { |
323 | static cmd_arg_t zone_argv = { |
320 | .type = ARG_TYPE_INT, |
324 | .type = ARG_TYPE_INT, |
321 | }; |
325 | }; |
322 | 326 | ||
323 | static cmd_info_t zone_info = { |
327 | static cmd_info_t zone_info = { |
324 | .name = "zone", |
328 | .name = "zone", |
325 | .description = "Show memory zone structure.", |
329 | .description = "Show memory zone structure.", |
326 | .func = cmd_zone, |
330 | .func = cmd_zone, |
327 | .argc = 1, |
331 | .argc = 1, |
328 | .argv = &zone_argv |
332 | .argv = &zone_argv |
329 | }; |
333 | }; |
330 | 334 | ||
331 | /** Data and methods for 'cpus' command. */ |
335 | /* Data and methods for 'cpus' command. */ |
332 | static int cmd_cpus(cmd_arg_t *argv); |
336 | static int cmd_cpus(cmd_arg_t *argv); |
333 | cmd_info_t cpus_info = { |
337 | cmd_info_t cpus_info = { |
334 | .name = "cpus", |
338 | .name = "cpus", |
335 | .description = "List all processors.", |
339 | .description = "List all processors.", |
336 | .help = NULL, |
340 | .help = NULL, |
337 | .func = cmd_cpus, |
341 | .func = cmd_cpus, |
338 | .argc = 0, |
342 | .argc = 0, |
339 | .argv = NULL |
343 | .argv = NULL |
340 | }; |
344 | }; |
341 | 345 | ||
342 | /** Data and methods for 'version' command. */ |
346 | /* Data and methods for 'version' command. */ |
343 | static int cmd_version(cmd_arg_t *argv); |
347 | static int cmd_version(cmd_arg_t *argv); |
344 | cmd_info_t version_info = { |
348 | cmd_info_t version_info = { |
345 | .name = "version", |
349 | .name = "version", |
346 | .description = "Print version information.", |
350 | .description = "Print version information.", |
347 | .help = NULL, |
351 | .help = NULL, |
348 | .func = cmd_version, |
352 | .func = cmd_version, |
349 | .argc = 0, |
353 | .argc = 0, |
350 | .argv = NULL |
354 | .argv = NULL |
351 | }; |
355 | }; |
352 | 356 | ||
353 | static cmd_info_t *basic_commands[] = { |
357 | static cmd_info_t *basic_commands[] = { |
354 | &call0_info, |
358 | &call0_info, |
355 | &call1_info, |
359 | &call1_info, |
356 | &call2_info, |
360 | &call2_info, |
357 | &call3_info, |
361 | &call3_info, |
358 | &continue_info, |
362 | &continue_info, |
359 | &cpus_info, |
363 | &cpus_info, |
360 | &desc_info, |
364 | &desc_info, |
361 | &exit_info, |
365 | &exit_info, |
362 | &halt_info, |
366 | &halt_info, |
363 | &help_info, |
367 | &help_info, |
364 | &ipc_task_info, |
368 | &ipc_task_info, |
365 | &set4_info, |
369 | &set4_info, |
366 | &slabs_info, |
370 | &slabs_info, |
367 | &symaddr_info, |
371 | &symaddr_info, |
368 | &sched_info, |
372 | &sched_info, |
369 | &threads_info, |
373 | &threads_info, |
370 | &tasks_info, |
374 | &tasks_info, |
371 | &tlb_info, |
375 | &tlb_info, |
372 | &version_info, |
376 | &version_info, |
373 | &zones_info, |
377 | &zones_info, |
374 | &zone_info, |
378 | &zone_info, |
375 | NULL |
379 | NULL |
376 | }; |
380 | }; |
377 | 381 | ||
378 | 382 | ||
379 | /** Initialize command info structure. |
383 | /** Initialize command info structure. |
380 | * |
384 | * |
381 | * @param cmd Command info structure. |
385 | * @param cmd Command info structure. |
382 | * |
386 | * |
383 | */ |
387 | */ |
384 | void cmd_initialize(cmd_info_t *cmd) |
388 | void cmd_initialize(cmd_info_t *cmd) |
385 | { |
389 | { |
386 | spinlock_initialize(&cmd->lock, "cmd"); |
390 | spinlock_initialize(&cmd->lock, "cmd"); |
387 | link_initialize(&cmd->link); |
391 | link_initialize(&cmd->link); |
388 | } |
392 | } |
389 | 393 | ||
390 | /** Initialize and register commands. */ |
394 | /** Initialize and register commands. */ |
391 | void cmd_init(void) |
395 | void cmd_init(void) |
392 | { |
396 | { |
393 | int i; |
397 | int i; |
394 | 398 | ||
395 | for (i=0;basic_commands[i]; i++) { |
399 | for (i=0;basic_commands[i]; i++) { |
396 | cmd_initialize(basic_commands[i]); |
400 | cmd_initialize(basic_commands[i]); |
397 | if (!cmd_register(basic_commands[i])) |
401 | if (!cmd_register(basic_commands[i])) |
398 | panic("could not register command %s\n", |
402 | panic("could not register command %s\n", |
399 | basic_commands[i]->name); |
403 | basic_commands[i]->name); |
400 | } |
404 | } |
401 | } |
405 | } |
402 | 406 | ||
403 | 407 | ||
404 | /** List supported commands. |
408 | /** List supported commands. |
405 | * |
409 | * |
406 | * @param argv Argument vector. |
410 | * @param argv Argument vector. |
407 | * |
411 | * |
408 | * @return 0 on failure, 1 on success. |
412 | * @return 0 on failure, 1 on success. |
409 | */ |
413 | */ |
410 | int cmd_help(cmd_arg_t *argv) |
414 | int cmd_help(cmd_arg_t *argv) |
411 | { |
415 | { |
412 | link_t *cur; |
416 | link_t *cur; |
413 | 417 | ||
414 | spinlock_lock(&cmd_lock); |
418 | spinlock_lock(&cmd_lock); |
415 | 419 | ||
416 | for (cur = cmd_head.next; cur != &cmd_head; cur = cur->next) { |
420 | for (cur = cmd_head.next; cur != &cmd_head; cur = cur->next) { |
417 | cmd_info_t *hlp; |
421 | cmd_info_t *hlp; |
418 | 422 | ||
419 | hlp = list_get_instance(cur, cmd_info_t, link); |
423 | hlp = list_get_instance(cur, cmd_info_t, link); |
420 | spinlock_lock(&hlp->lock); |
424 | spinlock_lock(&hlp->lock); |
421 | 425 | ||
422 | printf("%s - %s\n", hlp->name, hlp->description); |
426 | printf("%s - %s\n", hlp->name, hlp->description); |
423 | 427 | ||
424 | spinlock_unlock(&hlp->lock); |
428 | spinlock_unlock(&hlp->lock); |
425 | } |
429 | } |
426 | 430 | ||
427 | spinlock_unlock(&cmd_lock); |
431 | spinlock_unlock(&cmd_lock); |
428 | 432 | ||
429 | return 1; |
433 | return 1; |
430 | } |
434 | } |
431 | 435 | ||
432 | /** Describe specified command. |
436 | /** Describe specified command. |
433 | * |
437 | * |
434 | * @param argv Argument vector. |
438 | * @param argv Argument vector. |
435 | * |
439 | * |
436 | * @return 0 on failure, 1 on success. |
440 | * @return 0 on failure, 1 on success. |
437 | */ |
441 | */ |
438 | int cmd_desc(cmd_arg_t *argv) |
442 | int cmd_desc(cmd_arg_t *argv) |
439 | { |
443 | { |
440 | link_t *cur; |
444 | link_t *cur; |
441 | 445 | ||
442 | spinlock_lock(&cmd_lock); |
446 | spinlock_lock(&cmd_lock); |
443 | 447 | ||
444 | for (cur = cmd_head.next; cur != &cmd_head; cur = cur->next) { |
448 | for (cur = cmd_head.next; cur != &cmd_head; cur = cur->next) { |
445 | cmd_info_t *hlp; |
449 | cmd_info_t *hlp; |
446 | 450 | ||
447 | hlp = list_get_instance(cur, cmd_info_t, link); |
451 | hlp = list_get_instance(cur, cmd_info_t, link); |
448 | spinlock_lock(&hlp->lock); |
452 | spinlock_lock(&hlp->lock); |
449 | 453 | ||
450 | if (strncmp(hlp->name, (const char *) argv->buffer, strlen(hlp->name)) == 0) { |
454 | if (strncmp(hlp->name, (const char *) argv->buffer, strlen(hlp->name)) == 0) { |
451 | printf("%s - %s\n", hlp->name, hlp->description); |
455 | printf("%s - %s\n", hlp->name, hlp->description); |
452 | if (hlp->help) |
456 | if (hlp->help) |
453 | hlp->help(); |
457 | hlp->help(); |
454 | spinlock_unlock(&hlp->lock); |
458 | spinlock_unlock(&hlp->lock); |
455 | break; |
459 | break; |
456 | } |
460 | } |
457 | 461 | ||
458 | spinlock_unlock(&hlp->lock); |
462 | spinlock_unlock(&hlp->lock); |
459 | } |
463 | } |
460 | 464 | ||
461 | spinlock_unlock(&cmd_lock); |
465 | spinlock_unlock(&cmd_lock); |
462 | 466 | ||
463 | return 1; |
467 | return 1; |
464 | } |
468 | } |
465 | 469 | ||
466 | /** Search symbol table */ |
470 | /** Search symbol table */ |
467 | int cmd_symaddr(cmd_arg_t *argv) |
471 | int cmd_symaddr(cmd_arg_t *argv) |
468 | { |
472 | { |
469 | symtab_print_search(argv->buffer); |
473 | symtab_print_search(argv->buffer); |
470 | 474 | ||
471 | return 1; |
475 | return 1; |
472 | } |
476 | } |
473 | 477 | ||
474 | /** Call function with zero parameters */ |
478 | /** Call function with zero parameters */ |
475 | int cmd_call0(cmd_arg_t *argv) |
479 | int cmd_call0(cmd_arg_t *argv) |
476 | { |
480 | { |
477 | __address symaddr; |
481 | __address symaddr; |
478 | char *symbol; |
482 | char *symbol; |
479 | __native (*f)(void); |
483 | __native (*f)(void); |
480 | #ifdef ia64 |
484 | #ifdef ia64 |
481 | struct { |
485 | struct { |
482 | __native f; |
486 | __native f; |
483 | __native gp; |
487 | __native gp; |
484 | }fptr; |
488 | }fptr; |
485 | #endif |
489 | #endif |
486 | 490 | ||
487 | symaddr = get_symbol_addr(argv->buffer); |
491 | symaddr = get_symbol_addr(argv->buffer); |
488 | if (!symaddr) |
492 | if (!symaddr) |
489 | printf("Symbol %s not found.\n", argv->buffer); |
493 | printf("Symbol %s not found.\n", argv->buffer); |
490 | else if (symaddr == (__address) -1) { |
494 | else if (symaddr == (__address) -1) { |
491 | symtab_print_search(argv->buffer); |
495 | symtab_print_search(argv->buffer); |
492 | printf("Duplicate symbol, be more specific.\n"); |
496 | printf("Duplicate symbol, be more specific.\n"); |
493 | } else { |
497 | } else { |
494 | symbol = get_symtab_entry(symaddr); |
498 | symbol = get_symtab_entry(symaddr); |
495 | printf("Calling f(): %.*p: %s\n", sizeof(__address) * 2, symaddr, symbol); |
499 | printf("Calling f(): %.*p: %s\n", sizeof(__address) * 2, symaddr, symbol); |
496 | #ifdef ia64 |
500 | #ifdef ia64 |
497 | fptr.f = symaddr; |
501 | fptr.f = symaddr; |
498 | fptr.gp = ((__native *)cmd_call2)[1]; |
502 | fptr.gp = ((__native *)cmd_call2)[1]; |
499 | f = (__native (*)(void)) &fptr; |
503 | f = (__native (*)(void)) &fptr; |
500 | #else |
504 | #else |
501 | f = (__native (*)(void)) symaddr; |
505 | f = (__native (*)(void)) symaddr; |
502 | #endif |
506 | #endif |
503 | printf("Result: %#zx\n", f()); |
507 | printf("Result: %#zx\n", f()); |
504 | } |
508 | } |
505 | 509 | ||
506 | return 1; |
510 | return 1; |
507 | } |
511 | } |
508 | 512 | ||
509 | /** Call function with one parameter */ |
513 | /** Call function with one parameter */ |
510 | int cmd_call1(cmd_arg_t *argv) |
514 | int cmd_call1(cmd_arg_t *argv) |
511 | { |
515 | { |
512 | __address symaddr; |
516 | __address symaddr; |
513 | char *symbol; |
517 | char *symbol; |
514 | __native (*f)(__native,...); |
518 | __native (*f)(__native,...); |
515 | __native arg1 = argv[1].intval; |
519 | __native arg1 = argv[1].intval; |
516 | #ifdef ia64 |
520 | #ifdef ia64 |
517 | struct { |
521 | struct { |
518 | __native f; |
522 | __native f; |
519 | __native gp; |
523 | __native gp; |
520 | }fptr; |
524 | }fptr; |
521 | #endif |
525 | #endif |
522 | 526 | ||
523 | symaddr = get_symbol_addr(argv->buffer); |
527 | symaddr = get_symbol_addr(argv->buffer); |
524 | if (!symaddr) |
528 | if (!symaddr) |
525 | printf("Symbol %s not found.\n", argv->buffer); |
529 | printf("Symbol %s not found.\n", argv->buffer); |
526 | else if (symaddr == (__address) -1) { |
530 | else if (symaddr == (__address) -1) { |
527 | symtab_print_search(argv->buffer); |
531 | symtab_print_search(argv->buffer); |
528 | printf("Duplicate symbol, be more specific.\n"); |
532 | printf("Duplicate symbol, be more specific.\n"); |
529 | } else { |
533 | } else { |
530 | symbol = get_symtab_entry(symaddr); |
534 | symbol = get_symtab_entry(symaddr); |
531 | 535 | ||
532 | printf("Calling f(0x%zX): %.*p: %s\n", arg1, sizeof(__address) * 2, symaddr, symbol); |
536 | printf("Calling f(0x%zX): %.*p: %s\n", arg1, sizeof(__address) * 2, symaddr, symbol); |
533 | #ifdef ia64 |
537 | #ifdef ia64 |
534 | fptr.f = symaddr; |
538 | fptr.f = symaddr; |
535 | fptr.gp = ((__native *)cmd_call2)[1]; |
539 | fptr.gp = ((__native *)cmd_call2)[1]; |
536 | f = (__native (*)(__native,...)) &fptr; |
540 | f = (__native (*)(__native,...)) &fptr; |
537 | #else |
541 | #else |
538 | f = (__native (*)(__native,...)) symaddr; |
542 | f = (__native (*)(__native,...)) symaddr; |
539 | #endif |
543 | #endif |
540 | printf("Result: %#zx\n", f(arg1)); |
544 | printf("Result: %#zx\n", f(arg1)); |
541 | } |
545 | } |
542 | 546 | ||
543 | return 1; |
547 | return 1; |
544 | } |
548 | } |
545 | 549 | ||
546 | /** Call function with two parameters */ |
550 | /** Call function with two parameters */ |
547 | int cmd_call2(cmd_arg_t *argv) |
551 | int cmd_call2(cmd_arg_t *argv) |
548 | { |
552 | { |
549 | __address symaddr; |
553 | __address symaddr; |
550 | char *symbol; |
554 | char *symbol; |
551 | __native (*f)(__native,__native,...); |
555 | __native (*f)(__native,__native,...); |
552 | __native arg1 = argv[1].intval; |
556 | __native arg1 = argv[1].intval; |
553 | __native arg2 = argv[2].intval; |
557 | __native arg2 = argv[2].intval; |
554 | #ifdef ia64 |
558 | #ifdef ia64 |
555 | struct { |
559 | struct { |
556 | __native f; |
560 | __native f; |
557 | __native gp; |
561 | __native gp; |
558 | }fptr; |
562 | }fptr; |
559 | #endif |
563 | #endif |
560 | 564 | ||
561 | symaddr = get_symbol_addr(argv->buffer); |
565 | symaddr = get_symbol_addr(argv->buffer); |
562 | if (!symaddr) |
566 | if (!symaddr) |
563 | printf("Symbol %s not found.\n", argv->buffer); |
567 | printf("Symbol %s not found.\n", argv->buffer); |
564 | else if (symaddr == (__address) -1) { |
568 | else if (symaddr == (__address) -1) { |
565 | symtab_print_search(argv->buffer); |
569 | symtab_print_search(argv->buffer); |
566 | printf("Duplicate symbol, be more specific.\n"); |
570 | printf("Duplicate symbol, be more specific.\n"); |
567 | } else { |
571 | } else { |
568 | symbol = get_symtab_entry(symaddr); |
572 | symbol = get_symtab_entry(symaddr); |
569 | printf("Calling f(0x%zx,0x%zx): %.*p: %s\n", |
573 | printf("Calling f(0x%zx,0x%zx): %.*p: %s\n", |
570 | arg1, arg2, sizeof(__address) * 2, symaddr, symbol); |
574 | arg1, arg2, sizeof(__address) * 2, symaddr, symbol); |
571 | #ifdef ia64 |
575 | #ifdef ia64 |
572 | fptr.f = symaddr; |
576 | fptr.f = symaddr; |
573 | fptr.gp = ((__native *)cmd_call2)[1]; |
577 | fptr.gp = ((__native *)cmd_call2)[1]; |
574 | f = (__native (*)(__native,__native,...)) &fptr; |
578 | f = (__native (*)(__native,__native,...)) &fptr; |
575 | #else |
579 | #else |
576 | f = (__native (*)(__native,__native,...)) symaddr; |
580 | f = (__native (*)(__native,__native,...)) symaddr; |
577 | #endif |
581 | #endif |
578 | printf("Result: %#zx\n", f(arg1, arg2)); |
582 | printf("Result: %#zx\n", f(arg1, arg2)); |
579 | } |
583 | } |
580 | 584 | ||
581 | return 1; |
585 | return 1; |
582 | } |
586 | } |
583 | 587 | ||
584 | /** Call function with three parameters */ |
588 | /** Call function with three parameters */ |
585 | int cmd_call3(cmd_arg_t *argv) |
589 | int cmd_call3(cmd_arg_t *argv) |
586 | { |
590 | { |
587 | __address symaddr; |
591 | __address symaddr; |
588 | char *symbol; |
592 | char *symbol; |
589 | __native (*f)(__native,__native,__native,...); |
593 | __native (*f)(__native,__native,__native,...); |
590 | __native arg1 = argv[1].intval; |
594 | __native arg1 = argv[1].intval; |
591 | __native arg2 = argv[2].intval; |
595 | __native arg2 = argv[2].intval; |
592 | __native arg3 = argv[3].intval; |
596 | __native arg3 = argv[3].intval; |
593 | #ifdef ia64 |
597 | #ifdef ia64 |
594 | struct { |
598 | struct { |
595 | __native f; |
599 | __native f; |
596 | __native gp; |
600 | __native gp; |
597 | }fptr; |
601 | }fptr; |
598 | #endif |
602 | #endif |
599 | 603 | ||
600 | symaddr = get_symbol_addr(argv->buffer); |
604 | symaddr = get_symbol_addr(argv->buffer); |
601 | if (!symaddr) |
605 | if (!symaddr) |
602 | printf("Symbol %s not found.\n", argv->buffer); |
606 | printf("Symbol %s not found.\n", argv->buffer); |
603 | else if (symaddr == (__address) -1) { |
607 | else if (symaddr == (__address) -1) { |
604 | symtab_print_search(argv->buffer); |
608 | symtab_print_search(argv->buffer); |
605 | printf("Duplicate symbol, be more specific.\n"); |
609 | printf("Duplicate symbol, be more specific.\n"); |
606 | } else { |
610 | } else { |
607 | symbol = get_symtab_entry(symaddr); |
611 | symbol = get_symtab_entry(symaddr); |
608 | printf("Calling f(0x%zx,0x%zx, 0x%zx): %.*p: %s\n", |
612 | printf("Calling f(0x%zx,0x%zx, 0x%zx): %.*p: %s\n", |
609 | arg1, arg2, arg3, sizeof(__address) * 2, symaddr, symbol); |
613 | arg1, arg2, arg3, sizeof(__address) * 2, symaddr, symbol); |
610 | #ifdef ia64 |
614 | #ifdef ia64 |
611 | fptr.f = symaddr; |
615 | fptr.f = symaddr; |
612 | fptr.gp = ((__native *)cmd_call2)[1]; |
616 | fptr.gp = ((__native *)cmd_call2)[1]; |
613 | f = (__native (*)(__native,__native,__native,...)) &fptr; |
617 | f = (__native (*)(__native,__native,__native,...)) &fptr; |
614 | #else |
618 | #else |
615 | f = (__native (*)(__native,__native,__native,...)) symaddr; |
619 | f = (__native (*)(__native,__native,__native,...)) symaddr; |
616 | #endif |
620 | #endif |
617 | printf("Result: %#zx\n", f(arg1, arg2, arg3)); |
621 | printf("Result: %#zx\n", f(arg1, arg2, arg3)); |
618 | } |
622 | } |
619 | 623 | ||
620 | return 1; |
624 | return 1; |
621 | } |
625 | } |
622 | 626 | ||
623 | 627 | ||
624 | /** Print detailed description of 'describe' command. */ |
628 | /** Print detailed description of 'describe' command. */ |
625 | void desc_help(void) |
629 | void desc_help(void) |
626 | { |
630 | { |
627 | printf("Syntax: describe command_name\n"); |
631 | printf("Syntax: describe command_name\n"); |
628 | } |
632 | } |
629 | 633 | ||
630 | /** Halt the kernel. |
634 | /** Halt the kernel. |
631 | * |
635 | * |
632 | * @param argv Argument vector (ignored). |
636 | * @param argv Argument vector (ignored). |
633 | * |
637 | * |
634 | * @return 0 on failure, 1 on success (never returns). |
638 | * @return 0 on failure, 1 on success (never returns). |
635 | */ |
639 | */ |
636 | int cmd_halt(cmd_arg_t *argv) |
640 | int cmd_halt(cmd_arg_t *argv) |
637 | { |
641 | { |
638 | halt(); |
642 | halt(); |
639 | return 1; |
643 | return 1; |
640 | } |
644 | } |
641 | 645 | ||
642 | /** Command for printing TLB contents. |
646 | /** Command for printing TLB contents. |
643 | * |
647 | * |
644 | * @param argv Not used. |
648 | * @param argv Not used. |
645 | * |
649 | * |
646 | * @return Always returns 1. |
650 | * @return Always returns 1. |
647 | */ |
651 | */ |
648 | int cmd_tlb(cmd_arg_t *argv) |
652 | int cmd_tlb(cmd_arg_t *argv) |
649 | { |
653 | { |
650 | tlb_print(); |
654 | tlb_print(); |
651 | return 1; |
655 | return 1; |
652 | } |
656 | } |
653 | 657 | ||
654 | /** Write 4 byte value to address */ |
658 | /** Write 4 byte value to address */ |
655 | int cmd_set4(cmd_arg_t *argv) |
659 | int cmd_set4(cmd_arg_t *argv) |
656 | { |
660 | { |
657 | __u32 *addr ; |
661 | __u32 *addr ; |
658 | __u32 arg1 = argv[1].intval; |
662 | __u32 arg1 = argv[1].intval; |
659 | bool pointer = false; |
663 | bool pointer = false; |
660 | 664 | ||
661 | if (((char *)argv->buffer)[0] == '*') { |
665 | if (((char *)argv->buffer)[0] == '*') { |
662 | addr = (__u32 *) get_symbol_addr(argv->buffer+1); |
666 | addr = (__u32 *) get_symbol_addr(argv->buffer+1); |
663 | pointer = true; |
667 | pointer = true; |
664 | } else if (((char *)argv->buffer)[0] >= '0' && |
668 | } else if (((char *)argv->buffer)[0] >= '0' && |
665 | ((char *)argv->buffer)[0] <= '9') |
669 | ((char *)argv->buffer)[0] <= '9') |
666 | addr = (__u32 *)atoi((char *)argv->buffer); |
670 | addr = (__u32 *)atoi((char *)argv->buffer); |
667 | else |
671 | else |
668 | addr = (__u32 *)get_symbol_addr(argv->buffer); |
672 | addr = (__u32 *)get_symbol_addr(argv->buffer); |
669 | 673 | ||
670 | if (!addr) |
674 | if (!addr) |
671 | printf("Symbol %s not found.\n", argv->buffer); |
675 | printf("Symbol %s not found.\n", argv->buffer); |
672 | else if (addr == (__u32 *) -1) { |
676 | else if (addr == (__u32 *) -1) { |
673 | symtab_print_search(argv->buffer); |
677 | symtab_print_search(argv->buffer); |
674 | printf("Duplicate symbol, be more specific.\n"); |
678 | printf("Duplicate symbol, be more specific.\n"); |
675 | } else { |
679 | } else { |
676 | if (pointer) |
680 | if (pointer) |
677 | addr = (__u32 *)(*(__native *)addr); |
681 | addr = (__u32 *)(*(__native *)addr); |
678 | printf("Writing 0x%x -> %.*p\n", arg1, sizeof(__address) * 2, addr); |
682 | printf("Writing 0x%x -> %.*p\n", arg1, sizeof(__address) * 2, addr); |
679 | *addr = arg1; |
683 | *addr = arg1; |
680 | 684 | ||
681 | } |
685 | } |
682 | 686 | ||
683 | return 1; |
687 | return 1; |
684 | } |
688 | } |
685 | 689 | ||
686 | /** Command for listings SLAB caches |
690 | /** Command for listings SLAB caches |
687 | * |
691 | * |
688 | * @param argv Ignores |
692 | * @param argv Ignores |
689 | * |
693 | * |
690 | * @return Always 1 |
694 | * @return Always 1 |
691 | */ |
695 | */ |
692 | int cmd_slabs(cmd_arg_t * argv) { |
696 | int cmd_slabs(cmd_arg_t * argv) { |
693 | slab_print_list(); |
697 | slab_print_list(); |
694 | return 1; |
698 | return 1; |
695 | } |
699 | } |
696 | 700 | ||
697 | 701 | ||
698 | /** Command for listings Thread information |
702 | /** Command for listings Thread information |
699 | * |
703 | * |
700 | * @param argv Ignores |
704 | * @param argv Ignores |
701 | * |
705 | * |
702 | * @return Always 1 |
706 | * @return Always 1 |
703 | */ |
707 | */ |
704 | int cmd_threads(cmd_arg_t * argv) { |
708 | int cmd_threads(cmd_arg_t * argv) { |
705 | thread_print_list(); |
709 | thread_print_list(); |
706 | return 1; |
710 | return 1; |
707 | } |
711 | } |
708 | 712 | ||
709 | /** Command for listings Task information |
713 | /** Command for listings Task information |
710 | * |
714 | * |
711 | * @param argv Ignores |
715 | * @param argv Ignores |
712 | * |
716 | * |
713 | * @return Always 1 |
717 | * @return Always 1 |
714 | */ |
718 | */ |
715 | int cmd_tasks(cmd_arg_t * argv) { |
719 | int cmd_tasks(cmd_arg_t * argv) { |
716 | task_print_list(); |
720 | task_print_list(); |
717 | return 1; |
721 | return 1; |
718 | } |
722 | } |
719 | 723 | ||
720 | /** Command for listings Thread information |
724 | /** Command for listings Thread information |
721 | * |
725 | * |
722 | * @param argv Ignores |
726 | * @param argv Ignores |
723 | * |
727 | * |
724 | * @return Always 1 |
728 | * @return Always 1 |
725 | */ |
729 | */ |
726 | int cmd_sched(cmd_arg_t * argv) { |
730 | int cmd_sched(cmd_arg_t * argv) { |
727 | sched_print_list(); |
731 | sched_print_list(); |
728 | return 1; |
732 | return 1; |
729 | } |
733 | } |
730 | 734 | ||
731 | /** Command for listing memory zones |
735 | /** Command for listing memory zones |
732 | * |
736 | * |
733 | * @param argv Ignored |
737 | * @param argv Ignored |
734 | * |
738 | * |
735 | * return Always 1 |
739 | * return Always 1 |
736 | */ |
740 | */ |
737 | int cmd_zones(cmd_arg_t * argv) { |
741 | int cmd_zones(cmd_arg_t * argv) { |
738 | zone_print_list(); |
742 | zone_print_list(); |
739 | return 1; |
743 | return 1; |
740 | } |
744 | } |
741 | 745 | ||
742 | /** Command for memory zone details |
746 | /** Command for memory zone details |
743 | * |
747 | * |
744 | * @param argv Integer argument from cmdline expected |
748 | * @param argv Integer argument from cmdline expected |
745 | * |
749 | * |
746 | * return Always 1 |
750 | * return Always 1 |
747 | */ |
751 | */ |
748 | int cmd_zone(cmd_arg_t * argv) { |
752 | int cmd_zone(cmd_arg_t * argv) { |
749 | zone_print_one(argv[0].intval); |
753 | zone_print_one(argv[0].intval); |
750 | return 1; |
754 | return 1; |
751 | } |
755 | } |
752 | 756 | ||
753 | /** Command for printing task ipc details |
757 | /** Command for printing task ipc details |
754 | * |
758 | * |
755 | * @param argv Integer argument from cmdline expected |
759 | * @param argv Integer argument from cmdline expected |
756 | * |
760 | * |
757 | * return Always 1 |
761 | * return Always 1 |
758 | */ |
762 | */ |
759 | int cmd_ipc_task(cmd_arg_t * argv) { |
763 | int cmd_ipc_task(cmd_arg_t * argv) { |
760 | ipc_print_task(argv[0].intval); |
764 | ipc_print_task(argv[0].intval); |
761 | return 1; |
765 | return 1; |
762 | } |
766 | } |
763 | 767 | ||
764 | 768 | ||
765 | /** Command for listing processors. |
769 | /** Command for listing processors. |
766 | * |
770 | * |
767 | * @param argv Ignored. |
771 | * @param argv Ignored. |
768 | * |
772 | * |
769 | * return Always 1. |
773 | * return Always 1. |
770 | */ |
774 | */ |
771 | int cmd_cpus(cmd_arg_t *argv) |
775 | int cmd_cpus(cmd_arg_t *argv) |
772 | { |
776 | { |
773 | cpu_list(); |
777 | cpu_list(); |
774 | return 1; |
778 | return 1; |
775 | } |
779 | } |
776 | 780 | ||
777 | /** Command for printing kernel version. |
781 | /** Command for printing kernel version. |
778 | * |
782 | * |
779 | * @param argv Ignored. |
783 | * @param argv Ignored. |
780 | * |
784 | * |
781 | * return Always 1. |
785 | * return Always 1. |
782 | */ |
786 | */ |
783 | int cmd_version(cmd_arg_t *argv) |
787 | int cmd_version(cmd_arg_t *argv) |
784 | { |
788 | { |
785 | version_print(); |
789 | version_print(); |
786 | return 1; |
790 | return 1; |
787 | } |
791 | } |
788 | 792 | ||
789 | /** Command for returning console back to userspace. |
793 | /** Command for returning console back to userspace. |
790 | * |
794 | * |
791 | * @param argv Ignored. |
795 | * @param argv Ignored. |
792 | * |
796 | * |
793 | * return Always 1. |
797 | * return Always 1. |
794 | */ |
798 | */ |
795 | int cmd_continue(cmd_arg_t *argv) |
799 | int cmd_continue(cmd_arg_t *argv) |
796 | { |
800 | { |
797 | printf("The kernel will now relinquish the console.\n"); |
801 | printf("The kernel will now relinquish the console.\n"); |
798 | printf("Use userspace controls to redraw the screen.\n"); |
802 | printf("Use userspace controls to redraw the screen.\n"); |
799 | arch_release_console(); |
803 | arch_release_console(); |
800 | return 1; |
804 | return 1; |
801 | } |
805 | } |
- | 806 | ||
- | 807 | /** @} |
|
- | 808 | */ |
|
- | 809 | ||
802 | 810 |