Ignore:
Timestamp:
2025-04-17T16:01:16Z (5 days ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
master
Children:
888c06e
Parents:
1db4e2ae (diff), 250a435 (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.
git-author:
Jiří Zárevúcky <zarevucky.jiri@…> (2025-04-17 15:51:11)
git-committer:
Jiří Zárevúcky <zarevucky.jiri@…> (2025-04-17 16:01:16)
Message:

Convert kernel console writing to byte arrays

More buffer per buffer (the original char32_t buffer takes up four
times as much space for the same amount of backlog, which is wasteful).
It is also faster, possibly thanks to bigger chunks being processed in bulk.
Gonna try to figure out if the locking can be improved further.

Also changed to use a syscall for reading KIO buffer from uspace,
to allow better synchronization.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/genarch/src/drivers/ns16550/ns16550.c

    r1db4e2ae rc4cfe4c  
    112112}
    113113
    114 static void ns16550_putuchar(outdev_t *dev, char32_t ch)
     114static void ns16550_write(outdev_t *dev, const char *s, size_t n)
    115115{
    116116        ns16550_instance_t *instance = (ns16550_instance_t *) dev->data;
    117117
    118         if ((!instance->parea.mapped) || (console_override)) {
    119                 if (ch == '\n')
     118        if (instance->parea.mapped && !console_override)
     119                return;
     120
     121        const char *top = s + n;
     122        assert(top >= s);
     123
     124        for (; s < top; s++) {
     125                if (*s == '\n')
    120126                        ns16550_sendb(instance, '\r');
    121127
    122                 if (ascii_check(ch))
    123                         ns16550_sendb(instance, (uint8_t) ch);
    124                 else
    125                         ns16550_sendb(instance, U_SPECIAL);
     128                ns16550_sendb(instance, (uint8_t) *s);
    126129        }
    127130}
    128131
    129132static outdev_operations_t ns16550_ops = {
    130         .write = ns16550_putuchar,
     133        .write = ns16550_write,
    131134        .redraw = NULL
    132135};
Note: See TracChangeset for help on using the changeset viewer.