Changeset 3636964 in mainline for uspace/app/klog/klog.c


Ignore:
Timestamp:
2009-04-06T19:32:58Z (15 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
2845930
Parents:
13a638d
Message:

make klog more generic

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/klog/klog.c

    r13a638d r3636964  
    4848#define NAME "klog"
    4949
    50 #define KLOG_SIZE       PAGE_SIZE
    51 #define KLOG_LENGTH     (KLOG_SIZE / sizeof(wchar_t))
    52 
    5350/* Pointer to klog area */
    5451static wchar_t *klog;
     52static count_t klog_length;
    5553
    5654static void interrupt_received(ipc_callid_t callid, ipc_call_t *call)
     
    5856        async_serialize_start();
    5957       
    60         size_t klog_start = (size_t) IPC_GET_ARG1(*call);
    61         size_t klog_len = (size_t) IPC_GET_ARG2(*call);
    62         size_t klog_stored = (size_t) IPC_GET_ARG3(*call);
    63         size_t i;
     58        count_t klog_start = (count_t) IPC_GET_ARG1(*call);
     59        count_t klog_len = (count_t) IPC_GET_ARG2(*call);
     60        count_t klog_stored = (count_t) IPC_GET_ARG3(*call);
     61        count_t i;
     62       
    6463        for (i = klog_len - klog_stored; i < klog_len; i++)
    65                 putchar(klog[(klog_start + i) % KLOG_LENGTH]);
     64                putchar(klog[(klog_start + i) % klog_length]);
    6665       
    6766        async_serialize_end();
     
    7271        console_wait();
    7372       
    74         klog = (char *) as_get_mappable_page(KLOG_SIZE);
     73        count_t klog_pages = sysinfo_value("klog.pages");
     74        size_t klog_size = klog_pages * PAGE_SIZE;
     75        klog_length = klog_size / sizeof(wchar_t);
     76       
     77        klog = (char *) as_get_mappable_page(klog_pages);
    7578        if (klog == NULL) {
    7679                printf(NAME ": Error allocating memory area\n");
     
    7881        }
    7982       
    80         int res = ipc_share_in_start_1_0(PHONE_NS, (void *) klog, KLOG_SIZE,
    81             SERVICE_MEM_KLOG);
     83        int res = ipc_share_in_start_1_0(PHONE_NS, (void *) klog,
     84            klog_size, SERVICE_MEM_KLOG);
    8285        if (res != EOK) {
    8386                printf(NAME ": Error initializing memory area\n");
     
    9396        klog_update();
    9497        async_manager();
    95 
     98       
    9699        return 0;
    97100}
Note: See TracChangeset for help on using the changeset viewer.