Changeset 3636964 in mainline


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

Location:
uspace
Files:
4 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}
  • uspace/lib/libc/generic/event.c

    r13a638d r3636964  
    3939#include <libc.h>
    4040#include <event.h>
    41 #include <kernel/event/event_types.h>
     41#include <kernel/ipc/event_types.h>
    4242#include <ipc/ipc.h>
    4343
    4444/** Subscribe for event notifications.
    4545 *
    46  * @param e             Event number.
    47  * @param method        Use this method for notifying me.
     46 * @param evno   Event number.
     47 * @param method Use this method for notifying me.
    4848 *
    49  * @return              Value returned by the kernel.
     49 * @return Value returned by the kernel.
    5050 */
    5151int event_subscribe(event_type_t e, ipcarg_t method)
  • uspace/lib/libc/include/event.h

    r13a638d r3636964  
    3636#define LIBC_EVENT_H_
    3737
    38 #include <kernel/event/event_types.h>
     38#include <kernel/ipc/event_types.h>
    3939#include <ipc/ipc.h>
    4040
  • uspace/srv/ns/ns.c

    r13a638d r3636964  
    121121}
    122122
    123 static void get_as_area(ipc_callid_t callid, ipc_call_t *call, char *name, void **addr)
    124 {
    125         void *ph_addr;
    126        
    127         if (!*addr) {
    128                 ph_addr = (void *) sysinfo_value(name);
    129                 if (!ph_addr) {
     123static void get_as_area(ipc_callid_t callid, ipc_call_t *call, void *ph_addr, count_t pages, void **addr)
     124{
     125        if (ph_addr == NULL) {
     126                ipc_answer_0(callid, ENOENT);
     127                return;
     128        }
     129       
     130        if (*addr == NULL) {
     131                *addr = as_get_mappable_page(pages * PAGE_SIZE);
     132               
     133                if (*addr == NULL) {
    130134                        ipc_answer_0(callid, ENOENT);
    131135                        return;
    132136                }
    133                 *addr = as_get_mappable_page(PAGE_SIZE);
    134                 if (physmem_map(ph_addr, *addr, 1,
     137               
     138                if (physmem_map(ph_addr, *addr, pages,
    135139                    AS_AREA_READ | AS_AREA_CACHEABLE) != 0) {
    136140                        ipc_answer_0(callid, ENOENT);
     
    138142                }
    139143        }
     144       
    140145        ipc_answer_2(callid, EOK, (ipcarg_t) *addr, AS_AREA_READ);
    141146}
     
    198203                        switch (IPC_GET_ARG3(call)) {
    199204                        case SERVICE_MEM_REALTIME:
    200                                 get_as_area(callid, &call, "clock.faddr", &clockaddr);
     205                                get_as_area(callid, &call, sysinfo_value("clock.faddr"), 1, &clockaddr);
    201206                                break;
    202207                        case SERVICE_MEM_KLOG:
    203                                 get_as_area(callid, &call, "klog.faddr", &klogaddr);
     208                                get_as_area(callid, &call, sysinfo_value("klog.faddr"), sysinfo_value("klog.pages"), &klogaddr);
    204209                                break;
    205210                        default:
Note: See TracChangeset for help on using the changeset viewer.