Changeset 8a568e3 in mainline
- Timestamp:
- 2006-05-14T17:17:35Z (19 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 52352ec
- Parents:
- 8071af9f
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
init/init.c
r8071af9f r8a568e3 39 39 #include <as.h> 40 40 #include <ddi.h> 41 #include <string.h> 41 42 42 43 int a; … … 292 293 } 293 294 295 static int test_as_send() 296 { 297 char *as; 298 int retval; 299 ipcarg_t result; 300 301 as = as_area_create((void *)(1024*1024), 16384, AS_AREA_READ | AS_AREA_WRITE); 302 if (!as) { 303 printf("Error creating as.\n"); 304 return 0; 305 } 306 307 memcpy(as, "Hello world.\n", 14); 308 309 retval = ipc_call_sync_2(PHONE_NS, IPC_M_AS_SEND, 0, (sysarg_t) as, 310 NULL, NULL); 311 if (retval) { 312 printf("AS_SEND failed.\n"); 313 return 0; 314 } 315 printf("Done\n"); 316 } 317 294 318 int main(int argc, char *argv[]) 295 319 { … … 307 331 // test_hangup(); 308 332 // test_slam(); 309 333 test_as_send(); 334 /* 310 335 printf("Userspace task, taskid=%llX\n", task_get_id()); 311 336 … … 350 375 351 376 printf("Main thread exiting.\n"); 377 */ 352 378 return 0; 353 379 } -
libc/generic/as.c
r8071af9f r8a568e3 70 70 } 71 71 72 /** Prepare to accept address space area.73 *74 * @param id Task ID of the donor task.75 * @param base Destination address for the new address space area.76 * @param size Size of the new address space area.77 * @param flags Flags of the area TASK is willing to accept.78 *79 * @return 0 on success or a code from errno.h.80 */81 int as_area_accept(task_id_t id, void *base, size_t size, int flags)82 {83 as_area_acptsnd_arg_t arg;84 85 arg.task_id = id;86 arg.base = base;87 arg.size = size;88 arg.flags = flags;89 90 return __SYSCALL1(SYS_AS_AREA_ACCEPT, (sysarg_t) &arg);91 }92 93 /** Send address space area to another task.94 *95 * @param id Task ID of the acceptor task.96 * @param base Source address of the existing address space area.97 *98 * @return 0 on success or a code from errno.h.99 */100 int as_area_send(task_id_t id, void *base)101 {102 as_area_acptsnd_arg_t arg;103 104 arg.task_id = id;105 arg.base = base;106 arg.size = 0;107 arg.flags = 0;108 109 return __SYSCALL1(SYS_AS_AREA_SEND, (sysarg_t) &arg);110 }111 112 72 static size_t heapsize = 0; 113 73 /* Start of heap linker symbol */ -
libc/include/as.h
r8071af9f r8a568e3 27 27 */ 28 28 29 #ifndef __ AS_H__30 #define __ AS_H__29 #ifndef __libc_AS_H__ 30 #define __libc_AS_H__ 31 31 32 32 #include <types.h> 33 33 #include <task.h> 34 #include <kernel/mm/as.h> 34 35 35 36 extern void *as_area_create(void *address, size_t size, int flags); 36 37 extern int as_area_resize(void *address, size_t size, int flags); 37 38 extern int as_area_destroy(void *address); 38 extern int as_area_accept(task_id_t id, void *base, size_t size, int flags);39 extern int as_area_send(task_id_t id, void *base);40 39 41 40 #endif -
libipc/generic/ipc.c
r8071af9f r8a568e3 149 149 150 150 /** Send answer to a received call */ 151 voidipc_answer(ipc_callid_t callid, ipcarg_t retval, ipcarg_t arg1,151 ipcarg_t ipc_answer(ipc_callid_t callid, ipcarg_t retval, ipcarg_t arg1, 152 152 ipcarg_t arg2) 153 153 { 154 __SYSCALL4(SYS_IPC_ANSWER_FAST, callid, retval, arg1, arg2);154 return __SYSCALL4(SYS_IPC_ANSWER_FAST, callid, retval, arg1, arg2); 155 155 } 156 156 … … 272 272 return __SYSCALL1(SYS_IPC_UNREGISTER_IRQ, irq); 273 273 } 274 275 /* 276 int ipc_open_dgrconn(int pohoneid, size_t max_dgram) 277 { 278 279 } 280 281 282 */ -
libipc/include/ipc.h
r8071af9f r8a568e3 55 55 ipcarg_t *result); 56 56 extern ipc_callid_t ipc_wait_for_call(ipc_call_t *data, int flags); 57 extern voidipc_answer(ipc_callid_t callid, ipcarg_t retval, ipcarg_t arg1,58 57 extern ipcarg_t ipc_answer(ipc_callid_t callid, ipcarg_t retval, ipcarg_t arg1, 58 ipcarg_t arg2); 59 59 60 60 #define ipc_call_async(phoneid,method,arg1,private, callback) (ipc_call_async_2(phoneid, method, arg1, 0, private, callback)) -
ns/ns.c
r8071af9f r8a568e3 32 32 ipc_call_t call; 33 33 ipc_callid_t callid; 34 char *as; 34 35 35 36 ipcarg_t retval, arg1, arg2; … … 42 43 printf("NS:Call phone=%lX..", call.phoneid); 43 44 switch (IPC_GET_METHOD(call)) { 45 case IPC_M_AS_SEND: 46 as = (char *)IPC_GET_ARG2(call); 47 printf("Received as: %P, size:%d\n", as, IPC_GET_ARG3(call)); 48 retval = ipc_answer(callid, 0,(sysarg_t)(1024*1024), 0); 49 if (!retval) { 50 printf("Reading shared memory..."); 51 printf("Text: %s", as); 52 } else 53 printf("Failed answer: %d\n", retval); 54 continue; 55 break; 44 56 case IPC_M_INTERRUPT: 45 57 printf("GOT INTERRUPT: %c\n", IPC_GET_ARG2(call));
Note:
See TracChangeset
for help on using the changeset viewer.