Changeset eec616b in mainline for kernel/generic/src/console/console.c


Ignore:
Timestamp:
2009-03-24T14:43:25Z (15 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
8f29e336
Parents:
74c8da2c
Message:

Unicode aware printf and family functions
(this breaks some things, but will be fixed soon)

File:
1 edited

Legend:

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

    r74c8da2c reec616b  
    4747#include <func.h>
    4848#include <print.h>
     49#include <putchar.h>
    4950#include <atomic.h>
    5051#include <syscall/copy.h>
    5152#include <errno.h>
    5253
    53 #define KLOG_SIZE PAGE_SIZE
    54 #define KLOG_LATENCY 8
     54#define KLOG_SIZE     PAGE_SIZE
     55#define KLOG_LATENCY  8
    5556
    5657/** Kernel log cyclic buffer */
    57 static char klog[KLOG_SIZE] __attribute__ ((aligned (PAGE_SIZE)));
     58static wchar_t klog[KLOG_SIZE] __attribute__ ((aligned (PAGE_SIZE)));
    5859
    5960/** Kernel log initialized */
     
    9697       
    9798        klog_parea.pbase = (uintptr_t) faddr;
    98         klog_parea.frames = SIZE2FRAMES(KLOG_SIZE);
     99        klog_parea.frames = SIZE2FRAMES(sizeof(klog));
    99100        ddi_parea_register(&klog_parea);
    100101       
    101102        sysinfo_set_item_val("klog.faddr", NULL, (unative_t) faddr);
    102         sysinfo_set_item_val("klog.pages", NULL, SIZE2FRAMES(KLOG_SIZE));
     103        sysinfo_set_item_val("klog.pages", NULL, SIZE2FRAMES(sizeof(klog)));
    103104       
    104105        spinlock_lock(&klog_lock);
     
    246247}
    247248
    248 void putchar(char c)
     249void putchar(const wchar_t ch)
    249250{
    250251        spinlock_lock(&klog_lock);
     
    259260       
    260261        /* Store character in the cyclic kernel log */
    261         klog[(klog_start + klog_len) % KLOG_SIZE] = c;
     262        klog[(klog_start + klog_len) % KLOG_SIZE] = ch;
    262263        if (klog_len < KLOG_SIZE)
    263264                klog_len++;
     
    266267       
    267268        if ((stdout) && (stdout->op->write))
    268                 stdout->op->write(stdout, c, silent);
     269                stdout->op->write(stdout, ch, silent);
    269270        else {
    270271                /* The character is just in the kernel log */
     
    279280        /* Check notify uspace to update */
    280281        bool update;
    281         if ((klog_uspace > KLOG_LATENCY) || (c == '\n'))
     282        if ((klog_uspace > KLOG_LATENCY) || (ch == '\n'))
    282283                update = true;
    283284        else
     
    295296 *
    296297 */
    297 unative_t sys_klog(int fd, const void * buf, size_t count) 
     298unative_t sys_klog(int fd, const void * buf, size_t count)
    298299{
    299300        char *data;
    300301        int rc;
    301 
     302       
    302303        if (count > PAGE_SIZE)
    303304                return ELIMIT;
Note: See TracChangeset for help on using the changeset viewer.