Rev 4337 | Rev 4344 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4337 | Rev 4341 | ||
---|---|---|---|
Line 60... | Line 60... | ||
60 | * Print to kernel log. |
60 | * Print to kernel log. |
61 | * |
61 | * |
62 | */ |
62 | */ |
63 | static unative_t sys_klog(int fd, const void * buf, size_t count) |
63 | static unative_t sys_klog(int fd, const void * buf, size_t count) |
64 | { |
64 | { |
65 | size_t i; |
- | |
66 | char *data; |
65 | char *data; |
67 | int rc; |
66 | int rc; |
68 | 67 | ||
69 | if (count > PAGE_SIZE) |
68 | if (count > PAGE_SIZE) |
70 | return ELIMIT; |
69 | return ELIMIT; |
71 | 70 | ||
72 | if (count > 0) { |
71 | if (count > 0) { |
73 | data = (char *) malloc(count, 0); |
72 | data = (char *) malloc(count + 1, 0); |
74 | if (!data) |
73 | if (!data) |
75 | return ENOMEM; |
74 | return ENOMEM; |
76 | 75 | ||
77 | rc = copy_from_uspace(data, buf, count); |
76 | rc = copy_from_uspace(data, buf, count); |
78 | if (rc) { |
77 | if (rc) { |
79 | free(data); |
78 | free(data); |
80 | return rc; |
79 | return rc; |
81 | } |
80 | } |
- | 81 | data[count] = 0; |
|
82 | 82 | ||
83 | for (i = 0; i < count; i++) |
- | |
84 | putchar(data[i]); |
83 | printf("%s", data); |
85 | free(data); |
84 | free(data); |
86 | } else |
85 | } else |
87 | klog_update(); |
86 | klog_update(); |
88 | 87 | ||
89 | return count; |
88 | return count; |
Line 91... | Line 90... | ||
91 | 90 | ||
92 | /** Tell kernel to get keyboard/console access again */ |
91 | /** Tell kernel to get keyboard/console access again */ |
93 | static unative_t sys_debug_enable_console(void) |
92 | static unative_t sys_debug_enable_console(void) |
94 | { |
93 | { |
95 | #ifdef CONFIG_KCONSOLE |
94 | #ifdef CONFIG_KCONSOLE |
96 | arch_grab_console(); |
95 | grab_console(); |
97 | return true; |
96 | return true; |
98 | #else |
97 | #else |
99 | return false; |
98 | return false; |
100 | #endif |
99 | #endif |
101 | } |
100 | } |
Line 105... | Line 104... | ||
105 | { |
104 | { |
106 | printf("[task:0x%x]", i); |
105 | printf("[task:0x%x]", i); |
107 | return 0; |
106 | return 0; |
108 | } |
107 | } |
109 | 108 | ||
- | 109 | /** Tell kernel to relinquish keyboard/console access */ |
|
- | 110 | static unative_t sys_debug_disable_console(void) |
|
- | 111 | { |
|
- | 112 | release_console(); |
|
- | 113 | return true; |
|
- | 114 | } |
|
- | 115 | ||
110 | /** Dispatch system call */ |
116 | /** Dispatch system call */ |
111 | unative_t syscall_handler(unative_t a1, unative_t a2, unative_t a3, |
117 | unative_t syscall_handler(unative_t a1, unative_t a2, unative_t a3, |
112 | unative_t a4, unative_t a5, unative_t a6, unative_t id) |
118 | unative_t a4, unative_t a5, unative_t a6, unative_t id) |
113 | { |
119 | { |
114 | unative_t rc; |
120 | unative_t rc; |
Line 169... | Line 175... | ||
169 | (syshandler_t) sys_ipc_call_async_fast, |
175 | (syshandler_t) sys_ipc_call_async_fast, |
170 | (syshandler_t) sys_ipc_call_async_slow, |
176 | (syshandler_t) sys_ipc_call_async_slow, |
171 | (syshandler_t) sys_ipc_answer_fast, |
177 | (syshandler_t) sys_ipc_answer_fast, |
172 | (syshandler_t) sys_ipc_answer_slow, |
178 | (syshandler_t) sys_ipc_answer_slow, |
173 | (syshandler_t) sys_ipc_forward_fast, |
179 | (syshandler_t) sys_ipc_forward_fast, |
- | 180 | (syshandler_t) sys_ipc_forward_slow, |
|
174 | (syshandler_t) sys_ipc_wait_for_call, |
181 | (syshandler_t) sys_ipc_wait_for_call, |
175 | (syshandler_t) sys_ipc_hangup, |
182 | (syshandler_t) sys_ipc_hangup, |
176 | (syshandler_t) sys_ipc_register_irq, |
183 | (syshandler_t) sys_ipc_register_irq, |
177 | (syshandler_t) sys_ipc_unregister_irq, |
184 | (syshandler_t) sys_ipc_unregister_irq, |
178 | 185 | ||
Line 190... | Line 197... | ||
190 | (syshandler_t) sys_sysinfo_value, |
197 | (syshandler_t) sys_sysinfo_value, |
191 | 198 | ||
192 | /* Debug calls */ |
199 | /* Debug calls */ |
193 | (syshandler_t) sys_debug_putint, |
200 | (syshandler_t) sys_debug_putint, |
194 | (syshandler_t) sys_debug_enable_console, |
201 | (syshandler_t) sys_debug_enable_console, |
- | 202 | (syshandler_t) sys_debug_disable_console, |
|
195 | 203 | ||
196 | (syshandler_t) sys_ipc_connect_kbox |
204 | (syshandler_t) sys_ipc_connect_kbox |
197 | }; |
205 | }; |
198 | 206 | ||
199 | /** @} |
207 | /** @} |
200 | */ |
208 | */ |