Changes in kernel/generic/src/console/console.c [a71c158:98000fb] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/console/console.c
ra71c158 r98000fb 71 71 72 72 /** Kernel log spinlock */ 73 SPINLOCK_ STATIC_INITIALIZE_NAME(klog_lock, "*klog_lock");73 SPINLOCK_INITIALIZE(klog_lock); 74 74 75 75 /** Physical memory area used for klog buffer */ 76 76 static parea_t klog_parea; 77 78 static indev_t stdin_sink;79 static outdev_t stdout_source;80 77 81 78 static indev_operations_t stdin_ops = { … … 83 80 }; 84 81 85 static void stdout_write(outdev_t *dev, wchar_t ch, bool silent);86 static void stdout_redraw(outdev_t *dev);87 88 static outdev_operations_t stdout_ops = {89 .write = stdout_write,90 .redraw = stdout_redraw91 };92 93 82 /** Silence output */ 94 83 bool silent = false; … … 101 90 { 102 91 if (stdin == NULL) { 103 indev_initialize("stdin", &stdin_sink, &stdin_ops); 104 stdin = &stdin_sink; 92 stdin = malloc(sizeof(indev_t), FRAME_ATOMIC); 93 if (stdin != NULL) 94 indev_initialize("stdin", stdin, &stdin_ops); 105 95 } 106 96 107 97 return stdin; 108 }109 110 void stdout_wire(outdev_t *outdev)111 {112 if (stdout == NULL) {113 outdev_initialize("stdout", &stdout_source, &stdout_ops);114 stdout = &stdout_source;115 }116 117 list_append(&outdev->link, &stdout->list);118 }119 120 static void stdout_write(outdev_t *dev, wchar_t ch, bool silent)121 {122 link_t *cur;123 124 for (cur = dev->list.next; cur != &dev->list; cur = cur->next) {125 outdev_t *sink = list_get_instance(cur, outdev_t, link);126 if ((sink) && (sink->op->write))127 sink->op->write(sink, ch, silent);128 }129 }130 131 static void stdout_redraw(outdev_t *dev)132 {133 link_t *cur;134 135 for (cur = dev->list.next; cur != &dev->list; cur = cur->next) {136 outdev_t *sink = list_get_instance(cur, outdev_t, link);137 if ((sink) && (sink->op->redraw))138 sink->op->redraw(sink);139 }140 98 } 141 99 … … 170 128 171 129 silent = false; 172 if ((stdout) && (stdout->op->redraw)) 173 stdout->op->redraw(stdout); 130 arch_grab_console(); 174 131 175 132 /* Force the console to print the prompt */ … … 180 137 void release_console(void) 181 138 { 182 // FIXME arch_release_console183 139 silent = true; 140 arch_release_console(); 184 141 } 185 142
Note:
See TracChangeset
for help on using the changeset viewer.