Subversion Repositories HelenOS

Rev

Rev 3904 | Rev 4241 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3904 Rev 3908
Line 106... Line 106...
106
static bool service_clonable(int service)
106
static bool service_clonable(int service)
107
{
107
{
108
    return service == SERVICE_LOAD;
108
    return service == SERVICE_LOAD;
109
}
109
}
110
 
110
 
111
static void get_as_area(ipc_callid_t callid, ipc_call_t *call, char *name,
111
static void get_as_area(ipc_callid_t callid, ipc_call_t *call, char *name, void **addr)
112
    void **addr)
-
 
113
{
112
{
114
    void *ph_addr;
113
    void *ph_addr;
115
 
114
   
116
    if (!*addr) {
115
    if (!*addr) {
117
        ph_addr = (void *) sysinfo_value(name);
116
        ph_addr = (void *) sysinfo_value(name);
118
        if (!ph_addr) {
117
        if (!ph_addr) {
119
            ipc_answer_0(callid, ENOENT);
118
            ipc_answer_0(callid, ENOENT);
120
            return;
119
            return;
121
        }
120
        }
122
        *addr = as_get_mappable_page(PAGE_SIZE);
121
        *addr = as_get_mappable_page(PAGE_SIZE);
123
        physmem_map(ph_addr, *addr, 1,
122
        if (physmem_map(ph_addr, *addr, 1,
124
            AS_AREA_READ | AS_AREA_CACHEABLE);
123
            AS_AREA_READ | AS_AREA_CACHEABLE) != 0) {
-
 
124
            ipc_answer_0(callid, ENOENT);
-
 
125
            return;
-
 
126
        }
125
    }
127
    }
126
    ipc_answer_2(callid, EOK, (ipcarg_t) *addr, AS_AREA_READ);
128
    ipc_answer_2(callid, EOK, (ipcarg_t) *addr, AS_AREA_READ);
127
}
129
}
128
 
130
 
129
int main(int argc, char **argv)
131
int main(int argc, char **argv)
Line 148... Line 150...
148
        callid = ipc_wait_for_call(&call);
150
        callid = ipc_wait_for_call(&call);
149
        switch (IPC_GET_METHOD(call)) {
151
        switch (IPC_GET_METHOD(call)) {
150
        case IPC_M_SHARE_IN:
152
        case IPC_M_SHARE_IN:
151
            switch (IPC_GET_ARG3(call)) {
153
            switch (IPC_GET_ARG3(call)) {
152
            case SERVICE_MEM_REALTIME:
154
            case SERVICE_MEM_REALTIME:
153
                get_as_area(callid, &call, "clock.faddr",
155
                get_as_area(callid, &call, "clock.faddr", &clockaddr);
154
                    &clockaddr);
-
 
155
                break;
156
                break;
156
            case SERVICE_MEM_KLOG:
157
            case SERVICE_MEM_KLOG:
157
                get_as_area(callid, &call, "klog.faddr",
158
                get_as_area(callid, &call, "klog.faddr", &klogaddr);
158
                    &klogaddr);
-
 
159
                break;
159
                break;
160
            default:
160
            default:
161
                ipc_answer_0(callid, ENOENT);
161
                ipc_answer_0(callid, ENOENT);
162
            }
162
            }
163
            continue;
163
            continue;