Rev 1547 | Rev 1719 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1547 | Rev 1596 | ||
---|---|---|---|
Line 31... | Line 31... | ||
31 | * @brief Naming service for HelenOS IPC. |
31 | * @brief Naming service for HelenOS IPC. |
32 | */ |
32 | */ |
33 | 33 | ||
34 | #include <ipc/ipc.h> |
34 | #include <ipc/ipc.h> |
35 | #include <ipc/ns.h> |
35 | #include <ipc/ns.h> |
- | 36 | #include <ipc/services.h> |
|
36 | #include <stdio.h> |
37 | #include <stdio.h> |
37 | #include <unistd.h> |
38 | #include <unistd.h> |
38 | #include <stdlib.h> |
39 | #include <stdlib.h> |
39 | #include <errno.h> |
40 | #include <errno.h> |
40 | #include <assert.h> |
41 | #include <assert.h> |
Line 74... | Line 75... | ||
74 | ipcarg_t in_phone_hash; /**< Incoming phone hash. */ |
75 | ipcarg_t in_phone_hash; /**< Incoming phone hash. */ |
75 | } hashed_service_t; |
76 | } hashed_service_t; |
76 | 77 | ||
77 | int static ping_phone; |
78 | int static ping_phone; |
78 | 79 | ||
- | 80 | static void *clockaddr = NULL; |
|
- | 81 | static void *klogaddr = NULL; |
|
- | 82 | ||
79 | static void get_realtime_as(ipc_callid_t callid, ipc_call_t *call) |
83 | static void get_as(ipc_callid_t callid, ipc_call_t *call, char *name, void **addr) |
80 | { |
84 | { |
81 | static void *addr = NULL; |
- | |
82 | void *ph_addr; |
85 | void *ph_addr; |
83 | 86 | ||
84 | if (!addr) { |
87 | if (!*addr) { |
85 | ph_addr = (void *)sysinfo_value("clock.faddr"); |
88 | ph_addr = (void *)sysinfo_value(name); |
86 | if (!ph_addr) { |
89 | if (!ph_addr) { |
87 | ipc_answer_fast(callid, ENOENT, 0, 0); |
90 | ipc_answer_fast(callid, ENOENT, 0, 0); |
88 | return; |
91 | return; |
89 | } |
92 | } |
90 | addr = as_get_mappable_page(PAGE_SIZE); |
93 | *addr = as_get_mappable_page(PAGE_SIZE); |
91 | map_physmem(ph_addr, addr, 1, AS_AREA_READ | AS_AREA_CACHEABLE); |
94 | map_physmem(ph_addr, *addr, 1, AS_AREA_READ | AS_AREA_CACHEABLE); |
92 | } |
95 | } |
93 | ipc_answer_fast(callid, 0, (ipcarg_t)addr, AS_AREA_READ); |
96 | ipc_answer_fast(callid, 0, (ipcarg_t)*addr, AS_AREA_READ); |
94 | } |
97 | } |
95 | 98 | ||
96 | int main(int argc, char **argv) |
99 | int main(int argc, char **argv) |
97 | { |
100 | { |
98 | ipc_call_t call; |
101 | ipc_call_t call; |
Line 107... | Line 110... | ||
107 | 110 | ||
108 | while (1) { |
111 | while (1) { |
109 | callid = ipc_wait_for_call(&call); |
112 | callid = ipc_wait_for_call(&call); |
110 | switch (IPC_GET_METHOD(call)) { |
113 | switch (IPC_GET_METHOD(call)) { |
111 | case IPC_M_AS_AREA_RECV: |
114 | case IPC_M_AS_AREA_RECV: |
- | 115 | switch (IPC_GET_ARG3(call)) { |
|
- | 116 | case SERVICE_MEM_REALTIME: |
|
- | 117 | get_as(callid, &call, "clock.faddr", &clockaddr); |
|
- | 118 | break; |
|
- | 119 | case SERVICE_MEM_KLOG: |
|
- | 120 | get_as(callid, &call, "klog.faddr", &klogaddr); |
|
- | 121 | break; |
|
- | 122 | default: |
|
112 | get_realtime_as(callid, &call); |
123 | ipc_answer_fast(callid, ENOENT, 0, 0); |
- | 124 | } |
|
113 | continue; |
125 | continue; |
114 | case IPC_M_PHONE_HUNGUP: |
126 | case IPC_M_PHONE_HUNGUP: |
115 | retval = 0; |
127 | retval = 0; |
116 | break; |
128 | break; |
117 | case IPC_M_CONNECT_TO_ME: |
129 | case IPC_M_CONNECT_TO_ME: |