Changeset ad7a6c9 in mainline for kernel/generic/src/lib/memfnc.c
- Timestamp:
- 2011-03-30T13:10:24Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 4ae90f9
- Parents:
- 6e50466 (diff), d6b81941 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)links above to see all the changes relative to each parent. - File:
-
- 1 moved
-
kernel/generic/src/lib/memfnc.c (moved) (moved from uspace/srv/net/il/ip/ip_module.c ) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/lib/memfnc.c
r6e50466 rad7a6c9 1 /*2 * Copyright (c) 20 09 Lukas Mejdrech1 /* 2 * Copyright (c) 2011 Martin Decky 3 3 * All rights reserved. 4 4 * … … 27 27 */ 28 28 29 /** @addtogroup ip29 /** @addtogroup generic 30 30 * @{ 31 31 */ 32 32 33 /** @file 34 * IP standalone module implementation. 35 * Contains skeleton module functions mapping. 36 * The functions are used by the module skeleton as module specific entry 37 * points. 33 /** 34 * @file 35 * @brief Memory string functions. 38 36 * 39 * @see module.c 37 * This file provides architecture independent functions to manipulate blocks 38 * of memory. These functions are optimized as much as generic functions of 39 * this type can be. 40 40 */ 41 41 42 #include <async.h> 43 #include <stdio.h> 44 #include <ipc/ipc.h> 45 #include <ipc/services.h> 46 #include <errno.h> 42 #include <lib/memfnc.h> 43 #include <typedefs.h> 47 44 48 #include <net/modules.h> 49 #include <net_interface.h> 50 #include <net/packet.h> 51 #include <il_local.h> 52 53 #include "ip.h" 54 #include "ip_module.h" 55 56 /** IP module global data. */ 57 extern ip_globals_t ip_globals; 58 59 int 60 il_module_message_standalone(ipc_callid_t callid, ipc_call_t *call, 61 ipc_call_t *answer, int *answer_count) 45 /** Fill block of memory. 46 * 47 * Fill cnt bytes at dst address with the value val. 48 * 49 * @param dst Destination address to fill. 50 * @param val Value to fill. 51 * @param cnt Number of bytes to fill. 52 * 53 * @return Destination address. 54 * 55 */ 56 void *memset(void *dst, int val, size_t cnt) 62 57 { 63 return ip_message_standalone(callid, call, answer, answer_count); 58 size_t i; 59 uint8_t *ptr = (uint8_t *) dst; 60 61 for (i = 0; i < cnt; i++) 62 ptr[i] = val; 63 64 return dst; 64 65 } 65 66 66 int il_module_start_standalone(async_client_conn_t client_connection) 67 /** Move memory block without overlapping. 68 * 69 * Copy cnt bytes from src address to dst address. The source 70 * and destination memory areas cannot overlap. 71 * 72 * @param dst Destination address to copy to. 73 * @param src Source address to copy from. 74 * @param cnt Number of bytes to copy. 75 * 76 * @return Destination address. 77 * 78 */ 79 void *memcpy(void *dst, const void *src, size_t cnt) 67 80 { 68 sysarg_t phonehash;69 intrc;81 uint8_t *dp = (uint8_t *) dst; 82 const uint8_t *sp = (uint8_t *) src; 70 83 71 async_set_client_connection(client_connection); 72 ip_globals.net_phone = net_connect_module(); 73 74 rc = pm_init(); 75 if (rc != EOK) 76 return rc; 84 while (cnt-- != 0) 85 *dp++ = *sp++; 77 86 78 rc = ip_initialize(client_connection); 79 if (rc != EOK) 80 goto out; 81 82 rc = ipc_connect_to_me(PHONE_NS, SERVICE_IP, 0, 0, &phonehash); 83 if (rc != EOK) 84 goto out; 85 86 async_manager(); 87 88 out: 89 pm_destroy(); 90 return rc; 87 return dst; 91 88 } 92 89
Note:
See TracChangeset
for help on using the changeset viewer.
