Changeset 04803bf in mainline for kernel/generic/src/console/console.c
- Timestamp:
- 2011-03-21T22:00:17Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 143932e
- Parents:
- b50b5af2 (diff), 7308e84 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/console/console.c
rb50b5af2 r04803bf 39 39 #include <synch/waitq.h> 40 40 #include <synch/spinlock.h> 41 #include < arch/types.h>41 #include <typedefs.h> 42 42 #include <ddi/irq.h> 43 43 #include <ddi/ddi.h> … … 45 45 #include <ipc/irq.h> 46 46 #include <arch.h> 47 #include <panic.h> 47 48 #include <print.h> 48 49 #include <putchar.h> … … 50 51 #include <syscall/copy.h> 51 52 #include <errno.h> 52 #include <str ing.h>53 #include <str.h> 53 54 54 55 #define KLOG_PAGES 4 … … 61 62 /** Kernel log initialized */ 62 63 static bool klog_inited = false; 64 63 65 /** First kernel log characters */ 64 66 static size_t klog_start = 0; 67 65 68 /** Number of valid kernel log characters */ 66 69 static size_t klog_len = 0; 70 67 71 /** Number of stored (not printed) kernel log characters */ 68 72 static size_t klog_stored = 0; 73 69 74 /** Number of stored kernel log characters for uspace */ 70 75 static size_t klog_uspace = 0; … … 83 88 }; 84 89 85 static void stdout_write(outdev_t * dev, wchar_t ch, bool silent);86 static void stdout_redraw(outdev_t * dev);90 static void stdout_write(outdev_t *, wchar_t, bool); 91 static void stdout_redraw(outdev_t *); 87 92 88 93 static outdev_operations_t stdout_ops = { … … 155 160 klog_parea.pbase = (uintptr_t) faddr; 156 161 klog_parea.frames = SIZE2FRAMES(sizeof(klog)); 162 klog_parea.unpriv = false; 157 163 ddi_parea_register(&klog_parea); 158 164 159 sysinfo_set_item_val("klog.faddr", NULL, ( unative_t) faddr);165 sysinfo_set_item_val("klog.faddr", NULL, (sysarg_t) faddr); 160 166 sysinfo_set_item_val("klog.pages", NULL, KLOG_PAGES); 161 167 … … 173 179 stdout->op->redraw(stdout); 174 180 175 /* Force the console to print the prompt */ 176 if ((stdin) && (prev)) 181 if ((stdin) && (prev)) { 182 /* 183 * Force the console to print the prompt. 184 */ 177 185 indev_push_character(stdin, '\n'); 186 } 178 187 } 179 188 … … 185 194 186 195 /** Tell kernel to get keyboard/console access again */ 187 unative_t sys_debug_enable_console(void)196 sysarg_t sys_debug_enable_console(void) 188 197 { 189 198 #ifdef CONFIG_KCONSOLE … … 196 205 197 206 /** Tell kernel to relinquish keyboard/console access */ 198 unative_t sys_debug_disable_console(void)207 sysarg_t sys_debug_disable_console(void) 199 208 { 200 209 release_console(); … … 286 295 stdout->op->write(stdout, ch, silent); 287 296 else { 288 /* The character is just in the kernel log */ 297 /* 298 * No standard output routine defined yet. 299 * The character is still stored in the kernel log 300 * for possible future output. 301 * 302 * The early_putchar() function is used to output 303 * the character for low-level debugging purposes. 304 * Note that the early_putc() function might be 305 * a no-op on certain hardware configurations. 306 * 307 */ 308 early_putchar(ch); 309 289 310 if (klog_stored < klog_len) 290 311 klog_stored++; … … 313 334 * 314 335 */ 315 unative_t sys_klog(int fd, const void *buf, size_t size)336 sysarg_t sys_klog(int fd, const void *buf, size_t size) 316 337 { 317 338 char *data; … … 319 340 320 341 if (size > PAGE_SIZE) 321 return ELIMIT;342 return (sysarg_t) ELIMIT; 322 343 323 344 if (size > 0) { 324 345 data = (char *) malloc(size + 1, 0); 325 346 if (!data) 326 return ENOMEM;347 return (sysarg_t) ENOMEM; 327 348 328 349 rc = copy_from_uspace(data, buf, size); 329 350 if (rc) { 330 351 free(data); 331 return rc;352 return (sysarg_t) rc; 332 353 } 333 354 data[size] = 0;
Note:
See TracChangeset
for help on using the changeset viewer.