Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/console/console.c

    ra71c158 r98000fb  
    7171
    7272/** Kernel log spinlock */
    73 SPINLOCK_STATIC_INITIALIZE_NAME(klog_lock, "*klog_lock");
     73SPINLOCK_INITIALIZE(klog_lock);
    7474
    7575/** Physical memory area used for klog buffer */
    7676static parea_t klog_parea;
    77 
    78 static indev_t stdin_sink;
    79 static outdev_t stdout_source;
    8077
    8178static indev_operations_t stdin_ops = {
     
    8380};
    8481
    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_redraw
    91 };
    92 
    9382/** Silence output */
    9483bool silent = false;
     
    10190{
    10291        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);
    10595        }
    10696       
    10797        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         }
    14098}
    14199
     
    170128       
    171129        silent = false;
    172         if ((stdout) && (stdout->op->redraw))
    173                 stdout->op->redraw(stdout);
     130        arch_grab_console();
    174131       
    175132        /* Force the console to print the prompt */
     
    180137void release_console(void)
    181138{
    182         // FIXME arch_release_console
    183139        silent = true;
     140        arch_release_console();
    184141}
    185142
Note: See TracChangeset for help on using the changeset viewer.