Subversion Repositories HelenOS

Rev

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

Rev 4345 Rev 4348
Line 118... Line 118...
118
static bool service_clonable(int service)
118
static bool service_clonable(int service)
119
{
119
{
120
    return (service == SERVICE_LOAD);
120
    return (service == SERVICE_LOAD);
121
}
121
}
122
 
122
 
123
static void get_as_area(ipc_callid_t callid, ipc_call_t *call, char *name, void **addr)
123
static void get_as_area(ipc_callid_t callid, ipc_call_t *call, void *ph_addr, count_t pages, void **addr)
124
{
124
{
125
    void *ph_addr;
125
    if (ph_addr == NULL) {
-
 
126
        ipc_answer_0(callid, ENOENT);
-
 
127
        return;
-
 
128
    }
126
   
129
   
127
    if (!*addr) {
130
    if (*addr == NULL) {
128
        ph_addr = (void *) sysinfo_value(name);
131
        *addr = as_get_mappable_page(pages * PAGE_SIZE);
-
 
132
       
129
        if (!ph_addr) {
133
        if (*addr == NULL) {
130
            ipc_answer_0(callid, ENOENT);
134
            ipc_answer_0(callid, ENOENT);
131
            return;
135
            return;
132
        }
136
        }
133
        *addr = as_get_mappable_page(PAGE_SIZE);
-
 
-
 
137
       
134
        if (physmem_map(ph_addr, *addr, 1,
138
        if (physmem_map(ph_addr, *addr, pages,
135
            AS_AREA_READ | AS_AREA_CACHEABLE) != 0) {
139
            AS_AREA_READ | AS_AREA_CACHEABLE) != 0) {
136
            ipc_answer_0(callid, ENOENT);
140
            ipc_answer_0(callid, ENOENT);
137
            return;
141
            return;
138
        }
142
        }
139
    }
143
    }
-
 
144
   
140
    ipc_answer_2(callid, EOK, (ipcarg_t) *addr, AS_AREA_READ);
145
    ipc_answer_2(callid, EOK, (ipcarg_t) *addr, AS_AREA_READ);
141
}
146
}
142
 
147
 
143
/** Process pending connection requests */
148
/** Process pending connection requests */
144
static void process_pending_req()
149
static void process_pending_req()
Line 195... Line 200...
195
       
200
       
196
        switch (IPC_GET_METHOD(call)) {
201
        switch (IPC_GET_METHOD(call)) {
197
        case IPC_M_SHARE_IN:
202
        case IPC_M_SHARE_IN:
198
            switch (IPC_GET_ARG3(call)) {
203
            switch (IPC_GET_ARG3(call)) {
199
            case SERVICE_MEM_REALTIME:
204
            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);
201
                break;
206
                break;
202
            case SERVICE_MEM_KLOG:
207
            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);
204
                break;
209
                break;
205
            default:
210
            default:
206
                ipc_answer_0(callid, ENOENT);
211
                ipc_answer_0(callid, ENOENT);
207
            }
212
            }
208
            continue;
213
            continue;
Line 322... Line 327...
322
    }
327
    }
323
   
328
   
324
    hashed_service_t *hs = hash_table_get_instance(link, hashed_service_t, link);
329
    hashed_service_t *hs = hash_table_get_instance(link, hashed_service_t, link);
325
    retval = ipc_forward_fast(callid, hs->phone, IPC_GET_ARG2(*call),
330
    retval = ipc_forward_fast(callid, hs->phone, IPC_GET_ARG2(*call),
326
        IPC_GET_ARG3(*call), 0, IPC_FF_NONE);
331
        IPC_GET_ARG3(*call), 0, IPC_FF_NONE);
327
   
-
 
328
out:
332
out:
329
    if (!(callid & IPC_CALLID_NOTIFICATION))
333
    if (!(callid & IPC_CALLID_NOTIFICATION))
330
        ipc_answer_0(callid, retval);
334
        ipc_answer_0(callid, retval);
331
}
335
}
332
 
336
 
Line 355... Line 359...
355
   
359
   
356
    ipc_answer_0(callid, EOK);
360
    ipc_answer_0(callid, EOK);
357
   
361
   
358
    int rc = ipc_forward_fast(csr->callid, phone, IPC_GET_ARG2(csr->call),
362
    int rc = ipc_forward_fast(csr->callid, phone, IPC_GET_ARG2(csr->call),
359
        IPC_GET_ARG3(csr->call), 0, IPC_FF_NONE);
363
        IPC_GET_ARG3(csr->call), 0, IPC_FF_NONE);
360
   
364
 
361
    free(csr);
365
    free(csr);
-
 
366
    ipc_hangup(phone);
362
}
367
}
363
 
368
 
364
/** Connect client to clonable service.
369
/** Connect client to clonable service.
365
 *
370
 *
366
 * @param service Service to be connected to.
371
 * @param service Service to be connected to.