Changeset 04803bf in mainline for kernel/generic/src/console/console.c


Ignore:
Timestamp:
2011-03-21T22:00:17Z (13 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
143932e
Parents:
b50b5af2 (diff), 7308e84 (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.
Message:

Merge mainline changes (needs fixes).

File:
1 edited

Legend:

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

    rb50b5af2 r04803bf  
    3939#include <synch/waitq.h>
    4040#include <synch/spinlock.h>
    41 #include <arch/types.h>
     41#include <typedefs.h>
    4242#include <ddi/irq.h>
    4343#include <ddi/ddi.h>
     
    4545#include <ipc/irq.h>
    4646#include <arch.h>
     47#include <panic.h>
    4748#include <print.h>
    4849#include <putchar.h>
     
    5051#include <syscall/copy.h>
    5152#include <errno.h>
    52 #include <string.h>
     53#include <str.h>
    5354
    5455#define KLOG_PAGES    4
     
    6162/** Kernel log initialized */
    6263static bool klog_inited = false;
     64
    6365/** First kernel log characters */
    6466static size_t klog_start = 0;
     67
    6568/** Number of valid kernel log characters */
    6669static size_t klog_len = 0;
     70
    6771/** Number of stored (not printed) kernel log characters */
    6872static size_t klog_stored = 0;
     73
    6974/** Number of stored kernel log characters for uspace */
    7075static size_t klog_uspace = 0;
     
    8388};
    8489
    85 static void stdout_write(outdev_t *dev, wchar_t ch, bool silent);
    86 static void stdout_redraw(outdev_t *dev);
     90static void stdout_write(outdev_t *, wchar_t, bool);
     91static void stdout_redraw(outdev_t *);
    8792
    8893static outdev_operations_t stdout_ops = {
     
    155160        klog_parea.pbase = (uintptr_t) faddr;
    156161        klog_parea.frames = SIZE2FRAMES(sizeof(klog));
     162        klog_parea.unpriv = false;
    157163        ddi_parea_register(&klog_parea);
    158164       
    159         sysinfo_set_item_val("klog.faddr", NULL, (unative_t) faddr);
     165        sysinfo_set_item_val("klog.faddr", NULL, (sysarg_t) faddr);
    160166        sysinfo_set_item_val("klog.pages", NULL, KLOG_PAGES);
    161167       
     
    173179                stdout->op->redraw(stdout);
    174180       
    175         /* Force the console to print the prompt */
    176         if ((stdin) && (prev))
     181        if ((stdin) && (prev)) {
     182                /*
     183                 * Force the console to print the prompt.
     184                 */
    177185                indev_push_character(stdin, '\n');
     186        }
    178187}
    179188
     
    185194
    186195/** Tell kernel to get keyboard/console access again */
    187 unative_t sys_debug_enable_console(void)
     196sysarg_t sys_debug_enable_console(void)
    188197{
    189198#ifdef CONFIG_KCONSOLE
     
    196205
    197206/** Tell kernel to relinquish keyboard/console access */
    198 unative_t sys_debug_disable_console(void)
     207sysarg_t sys_debug_disable_console(void)
    199208{
    200209        release_console();
     
    286295                stdout->op->write(stdout, ch, silent);
    287296        else {
    288                 /* The character is just in the kernel log */
     297                /*
     298                 * No standard output routine defined yet.
     299                 * The character is still stored in the kernel log
     300                 * for possible future output.
     301                 *
     302                 * The early_putchar() function is used to output
     303                 * the character for low-level debugging purposes.
     304                 * Note that the early_putc() function might be
     305                 * a no-op on certain hardware configurations.
     306                 *
     307                 */
     308                early_putchar(ch);
     309               
    289310                if (klog_stored < klog_len)
    290311                        klog_stored++;
     
    313334 *
    314335 */
    315 unative_t sys_klog(int fd, const void *buf, size_t size)
     336sysarg_t sys_klog(int fd, const void *buf, size_t size)
    316337{
    317338        char *data;
     
    319340       
    320341        if (size > PAGE_SIZE)
    321                 return ELIMIT;
     342                return (sysarg_t) ELIMIT;
    322343       
    323344        if (size > 0) {
    324345                data = (char *) malloc(size + 1, 0);
    325346                if (!data)
    326                         return ENOMEM;
     347                        return (sysarg_t) ENOMEM;
    327348               
    328349                rc = copy_from_uspace(data, buf, size);
    329350                if (rc) {
    330351                        free(data);
    331                         return rc;
     352                        return (sysarg_t) rc;
    332353                }
    333354                data[size] = 0;
Note: See TracChangeset for help on using the changeset viewer.