Changeset c4cfe4c in mainline for kernel/genarch/src/drivers/ega/ega.c


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/ega/ega.c

    r1db4e2ae rc4cfe4c  
    6969        uint8_t *backbuf;
    7070        ioport8_t *base;
     71        mbstate_t mbstate;
    7172} ega_instance_t;
    7273
    73 static void ega_putuchar(outdev_t *, char32_t);
     74static void ega_write(outdev_t *, const char *, size_t);
    7475static void ega_redraw(outdev_t *);
    7576
    7677static outdev_operations_t egadev_ops = {
    77         .write = ega_putuchar,
     78        .write = ega_write,
    7879        .redraw = ega_redraw,
    7980        .scroll_up = NULL,
     
    538539}
    539540
    540 static void ega_putuchar(outdev_t *dev, char32_t ch)
    541 {
    542         ega_instance_t *instance = (ega_instance_t *) dev->data;
    543 
    544         irq_spinlock_lock(&instance->lock, true);
    545 
     541static void _putuchar(ega_instance_t *instance, char32_t ch)
     542{
    546543        switch (ch) {
    547544        case '\n':
     
    564561        ega_check_cursor(instance);
    565562        ega_move_cursor(instance);
     563}
     564
     565static void ega_write(outdev_t *dev, const char *s, size_t n)
     566{
     567        ega_instance_t *instance = (ega_instance_t *) dev->data;
     568
     569        irq_spinlock_lock(&instance->lock, true);
     570
     571        size_t offset = 0;
     572        char32_t ch;
     573
     574        while ((ch = str_decode_r(s, &offset, n, U_SPECIAL, &instance->mbstate)))
     575                _putuchar(instance, ch);
    566576
    567577        irq_spinlock_unlock(&instance->lock, true);
Note: See TracChangeset for help on using the changeset viewer.