/trunk/uspace/app/klog/klog.c |
---|
47,22 → 47,21 |
#define NAME "klog" |
#define KLOG_SIZE PAGE_SIZE |
#define KLOG_LENGTH (KLOG_SIZE / sizeof(wchar_t)) |
/* Pointer to klog area */ |
static wchar_t *klog; |
static count_t klog_length; |
static void interrupt_received(ipc_callid_t callid, ipc_call_t *call) |
{ |
async_serialize_start(); |
size_t klog_start = (size_t) IPC_GET_ARG1(*call); |
size_t klog_len = (size_t) IPC_GET_ARG2(*call); |
size_t klog_stored = (size_t) IPC_GET_ARG3(*call); |
size_t i; |
count_t klog_start = (count_t) IPC_GET_ARG1(*call); |
count_t klog_len = (count_t) IPC_GET_ARG2(*call); |
count_t klog_stored = (count_t) IPC_GET_ARG3(*call); |
count_t i; |
for (i = klog_len - klog_stored; i < klog_len; i++) |
putchar(klog[(klog_start + i) % KLOG_LENGTH]); |
putchar(klog[(klog_start + i) % klog_length]); |
async_serialize_end(); |
} |
71,14 → 70,18 |
{ |
console_wait(); |
klog = (char *) as_get_mappable_page(KLOG_SIZE); |
count_t klog_pages = sysinfo_value("klog.pages"); |
size_t klog_size = klog_pages * PAGE_SIZE; |
klog_length = klog_size / sizeof(wchar_t); |
klog = (char *) as_get_mappable_page(klog_pages); |
if (klog == NULL) { |
printf(NAME ": Error allocating memory area\n"); |
return -1; |
} |
int res = ipc_share_in_start_1_0(PHONE_NS, (void *) klog, KLOG_SIZE, |
SERVICE_MEM_KLOG); |
int res = ipc_share_in_start_1_0(PHONE_NS, (void *) klog, |
klog_size, SERVICE_MEM_KLOG); |
if (res != EOK) { |
printf(NAME ": Error initializing memory area\n"); |
return -1; |
92,7 → 95,7 |
async_set_interrupt_received(interrupt_received); |
klog_update(); |
async_manager(); |
return 0; |
} |
/trunk/uspace/lib/libc/include/event.h |
---|
35,7 → 35,7 |
#ifndef LIBC_EVENT_H_ |
#define LIBC_EVENT_H_ |
#include <kernel/event/event_types.h> |
#include <kernel/ipc/event_types.h> |
#include <ipc/ipc.h> |
extern int event_subscribe(event_type_t, ipcarg_t); |
/trunk/uspace/lib/libc/generic/event.c |
---|
38,15 → 38,15 |
#include <libc.h> |
#include <event.h> |
#include <kernel/event/event_types.h> |
#include <kernel/ipc/event_types.h> |
#include <ipc/ipc.h> |
/** Subscribe for event notifications. |
* |
* @param e Event number. |
* @param method Use this method for notifying me. |
* @param evno Event number. |
* @param method Use this method for notifying me. |
* |
* @return Value returned by the kernel. |
* @return Value returned by the kernel. |
*/ |
int event_subscribe(event_type_t e, ipcarg_t method) |
{ |
/trunk/uspace/srv/ns/ns.c |
---|
120,23 → 120,28 |
return (service == SERVICE_LOAD); |
} |
static void get_as_area(ipc_callid_t callid, ipc_call_t *call, char *name, void **addr) |
static void get_as_area(ipc_callid_t callid, ipc_call_t *call, void *ph_addr, count_t pages, void **addr) |
{ |
void *ph_addr; |
if (ph_addr == NULL) { |
ipc_answer_0(callid, ENOENT); |
return; |
} |
if (!*addr) { |
ph_addr = (void *) sysinfo_value(name); |
if (!ph_addr) { |
if (*addr == NULL) { |
*addr = as_get_mappable_page(pages * PAGE_SIZE); |
if (*addr == NULL) { |
ipc_answer_0(callid, ENOENT); |
return; |
} |
*addr = as_get_mappable_page(PAGE_SIZE); |
if (physmem_map(ph_addr, *addr, 1, |
if (physmem_map(ph_addr, *addr, pages, |
AS_AREA_READ | AS_AREA_CACHEABLE) != 0) { |
ipc_answer_0(callid, ENOENT); |
return; |
} |
} |
ipc_answer_2(callid, EOK, (ipcarg_t) *addr, AS_AREA_READ); |
} |
197,10 → 202,10 |
case IPC_M_SHARE_IN: |
switch (IPC_GET_ARG3(call)) { |
case SERVICE_MEM_REALTIME: |
get_as_area(callid, &call, "clock.faddr", &clockaddr); |
get_as_area(callid, &call, sysinfo_value("clock.faddr"), 1, &clockaddr); |
break; |
case SERVICE_MEM_KLOG: |
get_as_area(callid, &call, "klog.faddr", &klogaddr); |
get_as_area(callid, &call, sysinfo_value("klog.faddr"), sysinfo_value("klog.pages"), &klogaddr); |
break; |
default: |
ipc_answer_0(callid, ENOENT); |