Changeset 533e2d7 in mainline for uspace/lib
- Timestamp:
- 2013-06-03T07:55:35Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 797d4d19
- Parents:
- ea15a89a (diff), 6db5d4b (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. - Location:
- uspace/lib
- Files:
-
- 5 added
- 33 edited
-
bithenge/src/blob.c (modified) (1 diff)
-
c/Makefile (modified) (2 diffs)
-
c/arch/abs32le/Makefile.common (modified) (1 diff)
-
c/arch/amd64/Makefile.common (modified) (1 diff)
-
c/arch/amd64/src/entry.s (modified) (1 diff)
-
c/arch/amd64/src/entryjmp.s (modified) (1 diff)
-
c/arch/amd64/src/fibril.S (modified) (2 diffs)
-
c/arch/amd64/src/thread_entry.s (modified) (1 diff)
-
c/arch/ia32/Makefile.common (modified) (1 diff)
-
c/arch/ia32/include/libarch/fibril.h (modified) (1 diff)
-
c/arch/ia32/src/entry.S (modified) (2 diffs)
-
c/arch/ia32/src/entryjmp.s (modified) (1 diff)
-
c/arch/ia32/src/fibril.S (modified) (3 diffs)
-
c/arch/ia32/src/setjmp.S (modified) (2 diffs)
-
c/arch/ia32/src/thread_entry.s (modified) (1 diff)
-
c/generic/device/hw_res_parsed.c (modified) (1 diff)
-
c/generic/dnsr.c (added)
-
c/generic/inet/addr.c (added)
-
c/generic/mem.c (modified) (1 diff)
-
c/generic/net/inet.c (modified) (2 diffs)
-
c/generic/net/socket_client.c (modified) (2 diffs)
-
c/include/device/hw_res_parsed.h (modified) (2 diffs)
-
c/include/inet/addr.h (added)
-
c/include/inet/dnsr.h (added)
-
c/include/inet/inet.h (modified) (1 diff)
-
c/include/inet/inetcfg.h (modified) (1 diff)
-
c/include/ipc/dnsr.h (added)
-
c/include/ipc/services.h (modified) (1 diff)
-
c/include/mem.h (modified) (2 diffs)
-
drv/generic/remote_nic.c (modified) (10 diffs)
-
ext4/libext4_directory.c (modified) (1 diff)
-
nic/src/nic_addr_db.c (modified) (1 diff)
-
nic/src/nic_driver.c (modified) (1 diff)
-
nic/src/nic_impl.c (modified) (2 diffs)
-
nic/src/nic_rx_control.c (modified) (1 diff)
-
nic/src/nic_wol_virtues.c (modified) (1 diff)
-
posix/source/strings.c (modified) (2 diffs)
-
usb/src/debug.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/bithenge/src/blob.c
rea15a89a r533e2d7 477 477 if (rc != EOK) 478 478 return rc; 479 if (size_a != size_b || bcmp(buffer_a, buffer_b, size_a)) {479 if (size_a != size_b || memcmp(buffer_a, buffer_b, size_a) != 0) { 480 480 *out = false; 481 481 return EOK; -
uspace/lib/c/Makefile
rea15a89a r533e2d7 74 74 generic/device/pci.c \ 75 75 generic/device/ahci.c \ 76 generic/dnsr.c \ 76 77 generic/dlfcn.c \ 77 78 generic/elf/elf_load.c \ … … 91 92 generic/task.c \ 92 93 generic/futex.c \ 94 generic/inet/addr.c \ 93 95 generic/inet.c \ 94 96 generic/inetcfg.c \ -
uspace/lib/c/arch/abs32le/Makefile.common
rea15a89a r533e2d7 27 27 # 28 28 29 ifeq ($(COMPILER),clang)30 CLANG_ARCH = i38631 endif32 33 29 ENDIANESS = LE -
uspace/lib/c/arch/amd64/Makefile.common
rea15a89a r533e2d7 27 27 # 28 28 29 CLANG_ARCH = x86_6430 CLANG_TARGET = x86_64-unknown-linux31 29 GCC_CFLAGS += -fno-omit-frame-pointer 32 30 CLANG_CFLAGS += -fno-omit-frame-pointer -
uspace/lib/c/arch/amd64/src/entry.s
rea15a89a r533e2d7 42 42 # 43 43 pushq $0 44 pushq $0 44 45 movq %rsp, %rbp 45 46 -
uspace/lib/c/arch/amd64/src/entryjmp.s
rea15a89a r533e2d7 36 36 # Jump to program entry point 37 37 entry_point_jmp: 38 # use standard amd32 prologue not to confuse anybody 39 push %rbp 40 movq %rsp, %rbp 41 38 42 # pcb must be passed in %rdi, use %rdx as a scratch register 39 43 mov %rdi, %rdx 40 44 mov %rsi, %rdi 41 45 42 46 # jump to entry point 43 47 jmp %rdx -
uspace/lib/c/arch/amd64/src/fibril.S
rea15a89a r533e2d7 42 42 movq (%rsp), %rdx # the caller's return %eip 43 43 44 # In %edi is passed 1st argument44 # in %edi is passed 1st argument 45 45 CONTEXT_SAVE_ARCH_CORE %rdi %rdx 46 46 47 # Save TLS47 # save TLS 48 48 movq %fs:0, %rax 49 49 movq %rax, OFFSET_TLS(%rdi) 50 51 xorl %eax, %eax # context_save returns 150 51 xorl %eax, %eax # context_save returns 1 52 52 incl %eax 53 53 ret 54 55 54 56 55 ## Restore current CPU context … … 64 63 65 64 movq %rdx,(%rsp) 66 65 67 66 # Set thread local storage 68 movq OFFSET_TLS(%rdi), %rdi # Set arg1 to TLS addr69 movl $1, %eax # SYS_TLS_SET67 movq OFFSET_TLS(%rdi), %rdi # Set arg1 to TLS addr 68 movl $1, %eax # SYS_TLS_SET 70 69 syscall 71 72 xorl %eax, %eax # context_restore returns 070 71 xorl %eax, %eax # context_restore returns 0 73 72 ret -
uspace/lib/c/arch/amd64/src/thread_entry.s
rea15a89a r533e2d7 39 39 # 40 40 pushq $0 41 pushq $0 41 42 movq %rsp, %rbp 42 43 43 44 # 44 45 # RAX contains address of uarg -
uspace/lib/c/arch/ia32/Makefile.common
rea15a89a r533e2d7 27 27 # 28 28 29 CLANG_ARCH = i38630 CLANG_TARGET = i386-unknown-linux31 32 29 ifeq ($(PROCESSOR),i486) 33 30 GCC_CFLAGS += -march=i486 -fno-omit-frame-pointer -
uspace/lib/c/arch/ia32/include/libarch/fibril.h
rea15a89a r533e2d7 43 43 * panic sooner or later 44 44 */ 45 #define SP_DELTA 1245 #define SP_DELTA 8 46 46 47 47 #define context_set(c, _pc, stack, size, ptls) \ -
uspace/lib/c/arch/ia32/src/entry.S
rea15a89a r533e2d7 47 47 # Do not set %gs, it contains descriptor that can see TLS 48 48 49 #ifndef PROCESSOR_i486 49 #ifndef PROCESSOR_i486 50 50 # Detect the mechanism used for making syscalls 51 51 movl $(INTEL_CPUID_STANDARD), %eax … … 62 62 # 63 63 pushl $0 64 pushl $0 64 65 movl %esp, %ebp 65 66 -
uspace/lib/c/arch/ia32/src/entryjmp.s
rea15a89a r533e2d7 36 36 push %ebp 37 37 movl %esp, %ebp 38 38 39 39 # %eax := entry_point 40 40 movl 0x8(%ebp), %eax 41 41 42 42 # %edi := pcb 43 43 # pcb is passed to the entry point in %edi 44 44 mov 0xc(%ebp), %edi 45 45 46 46 # Save a tiny bit of stack space 47 47 pop %ebp 48 48 49 49 jmp *%eax -
uspace/lib/c/arch/ia32/src/fibril.S
rea15a89a r533e2d7 34 34 .global context_restore 35 35 36 37 36 ## Save current CPU context 38 37 # … … 41 40 # 42 41 context_save: 43 movl 0(%esp), %eax# the caller's return %eip44 movl 4(%esp), %edx# address of the context variable to save context to45 46 # save registers to the context structure42 movl 0(%esp), %eax # the caller's return %eip 43 movl 4(%esp), %edx # address of the context variable to save context to 44 45 # save registers to the context structure 47 46 CONTEXT_SAVE_ARCH_CORE %edx %eax 48 49 # Save TLS47 48 # save TLS 50 49 movl %gs:0, %eax 51 50 movl %eax, OFFSET_TLS(%edx) # tls -> ctx->tls 52 51 53 xorl %eax, %eax# context_save returns 152 xorl %eax, %eax # context_save returns 1 54 53 incl %eax 55 54 ret 56 57 55 58 56 ## Restore saved CPU context … … 62 60 # 63 61 context_restore: 64 movl 4(%esp), %eax# address of the context variable to restore context from65 66 # restore registers from the context structure62 movl 4(%esp), %eax # address of the context variable to restore context from 63 64 # restore registers from the context structure 67 65 CONTEXT_RESTORE_ARCH_CORE %eax %edx 68 69 movl %edx, 0(%esp)# ctx->pc -> saver's return %eip70 71 # Set thread local storage66 67 movl %edx, 0(%esp) # ctx->pc -> saver's return %eip 68 69 # set thread local storage 72 70 pushl %edx 73 movl OFFSET_TLS(%eax), %edx # Set arg1 to TLS addr74 movl $1, %eax # Syscall SYS_TLS_SET71 movl OFFSET_TLS(%eax), %edx # Set arg1 to TLS addr 72 movl $1, %eax # Syscall SYS_TLS_SET 75 73 int $0x30 76 74 popl %edx 77 75 78 xorl %eax, %eax# context_restore returns 076 xorl %eax, %eax # context_restore returns 0 79 77 ret -
uspace/lib/c/arch/ia32/src/setjmp.S
rea15a89a r533e2d7 35 35 .type setjmp,@function 36 36 setjmp: 37 movl 0(%esp), %eax # save pc value into eax38 movl 4(%esp), %edx # address of the jmp_buf structure to save context to37 movl 0(%esp), %eax # save pc value into eax 38 movl 4(%esp), %edx # address of the jmp_buf structure to save context to 39 39 40 40 # save registers to the jmp_buf structure 41 41 CONTEXT_SAVE_ARCH_CORE %edx %eax 42 42 43 xorl %eax, %eax# set_jmp returns 043 xorl %eax, %eax # set_jmp returns 0 44 44 ret 45 45 … … 52 52 CONTEXT_RESTORE_ARCH_CORE %ecx %edx 53 53 54 movl %edx, 0(%esp) # put saved pc on stack54 movl %edx, 0(%esp) # put saved pc on stack 55 55 ret -
uspace/lib/c/arch/ia32/src/thread_entry.s
rea15a89a r533e2d7 40 40 mov %dx, %fs 41 41 # Do not set %gs, it contains descriptor that can see TLS 42 42 43 43 # 44 44 # Create the first stack frame. 45 45 # 46 46 pushl $0 47 pushl $0 47 48 mov %esp, %ebp 48 49 49 50 # 50 51 # EAX contains address of uarg. -
uspace/lib/c/generic/device/hw_res_parsed.c
rea15a89a r533e2d7 188 188 hw_resource_list_t hw_resources; 189 189 hw_res_list_parsed_clean(hw_res_parsed); 190 bzero(&hw_resources, sizeof(hw_resource_list_t));190 memset(&hw_resources, 0, sizeof(hw_resource_list_t)); 191 191 192 192 int rc = hw_res_get_resource_list(sess, &hw_resources); -
uspace/lib/c/generic/mem.c
rea15a89a r533e2d7 224 224 * @param s1 Pointer to the first area to compare. 225 225 * @param s2 Pointer to the second area to compare. 226 * @param len Size of the first area in bytes. Both areas must have227 * the same length.228 * 229 * @return If len is 0, return zero. If the areas match, return230 * zero. Otherwise return non-zero.231 * 232 */ 233 int bcmp(const void *s1, const void *s2, size_t len)226 * @param len Size of the areas in bytes. 227 * 228 * @return Zero if areas have the same contents. If they differ, 229 * the sign of the result is the same as the sign of the 230 * difference of the first pair of different bytes. 231 * 232 */ 233 int memcmp(const void *s1, const void *s2, size_t len) 234 234 { 235 235 uint8_t *u1 = (uint8_t *) s1; 236 236 uint8_t *u2 = (uint8_t *) s2; 237 238 for (; (len != 0) && (*u1++ == *u2++); len--); 239 240 return len; 237 size_t i; 238 239 for (i = 0; i < len; i++) { 240 if (*u1 != *u2) 241 return (int)(*u1) - (int)(*u2); 242 ++u1; 243 ++u2; 244 } 245 246 return 0; 241 247 } 242 248 -
uspace/lib/c/generic/net/inet.c
rea15a89a r533e2d7 144 144 /* Erase if no address */ 145 145 if (!address) { 146 bzero(data, count);146 memset(data, 0, count); 147 147 return ENOENT; 148 148 } … … 181 181 } else { 182 182 /* Erase the rest of the address */ 183 bzero(data + index, count - index);183 memset(data + index, 0, count - index); 184 184 return EOK; 185 185 } -
uspace/lib/c/generic/net/socket_client.c
rea15a89a r533e2d7 446 446 return ENOMEM; 447 447 448 bzero(socket, sizeof(*socket));448 memset(socket, 0, sizeof(*socket)); 449 449 fibril_rwlock_write_lock(&socket_globals.lock); 450 450 … … 657 657 return ENOMEM; 658 658 } 659 bzero(new_socket, sizeof(*new_socket));659 memset(new_socket, 0, sizeof(*new_socket)); 660 660 socket_id = socket_generate_new_id(); 661 661 if (socket_id <= 0) { -
uspace/lib/c/include/device/hw_res_parsed.h
rea15a89a r533e2d7 127 127 free(list->dma_channels.channels); 128 128 129 bzero(list, sizeof(hw_res_list_parsed_t));129 memset(list, 0, sizeof(hw_res_list_parsed_t)); 130 130 } 131 131 … … 136 136 static inline void hw_res_list_parsed_init(hw_res_list_parsed_t *list) 137 137 { 138 bzero(list, sizeof(hw_res_list_parsed_t));138 memset(list, 0, sizeof(hw_res_list_parsed_t)); 139 139 } 140 140 -
uspace/lib/c/include/inet/inet.h
rea15a89a r533e2d7 36 36 #define LIBC_INET_INET_H_ 37 37 38 #include <inet/addr.h> 38 39 #include <sys/types.h> 39 40 40 41 #define INET_TTL_MAX 255 41 42 typedef struct {43 uint32_t ipv4;44 } inet_addr_t;45 42 46 43 typedef struct { -
uspace/lib/c/include/inet/inetcfg.h
rea15a89a r533e2d7 38 38 #include <inet/inet.h> 39 39 #include <sys/types.h> 40 41 /** Network address */42 typedef struct {43 /** Address */44 uint32_t ipv4;45 /** Number of valid bits in @c ipv4 */46 int bits;47 } inet_naddr_t;48 40 49 41 /** Address object info */ -
uspace/lib/c/include/ipc/services.h
rea15a89a r533e2d7 53 53 } services_t; 54 54 55 #define SERVICE_NAME_DNSR "net/dnsr" 55 56 #define SERVICE_NAME_INET "net/inet" 56 57 #define SERVICE_NAME_INETCFG "net/inetcfg" -
uspace/lib/c/include/mem.h
rea15a89a r533e2d7 38 38 #include <sys/types.h> 39 39 40 #define bzero(ptr, len) memset((ptr), 0, (len))41 42 40 extern void *memset(void *, int, size_t) 43 41 __attribute__ ((optimize("-fno-tree-loop-distribute-patterns"))); … … 45 43 __attribute__ ((optimize("-fno-tree-loop-distribute-patterns"))); 46 44 extern void *memmove(void *, const void *, size_t); 47 48 extern int bcmp(const void *, const void *, size_t); 45 extern int memcmp(const void *, const void *, size_t); 49 46 50 47 #endif -
uspace/lib/drv/generic/remote_nic.c
rea15a89a r533e2d7 104 104 105 105 nic_address_t address; 106 bzero(&address, sizeof(nic_address_t));106 memset(&address, 0, sizeof(nic_address_t)); 107 107 108 108 int rc = nic_iface->get_address(dev, &address); … … 173 173 174 174 nic_device_stats_t stats; 175 bzero(&stats, sizeof(nic_device_stats_t));175 memset(&stats, 0, sizeof(nic_device_stats_t)); 176 176 177 177 int rc = nic_iface->get_stats(dev, &stats); … … 208 208 209 209 nic_device_info_t info; 210 bzero(&info, sizeof(nic_device_info_t));210 memset(&info, 0, sizeof(nic_device_info_t)); 211 211 212 212 int rc = nic_iface->get_device_info(dev, &info); … … 399 399 } 400 400 401 bzero(address_list, max_count * sizeof(nic_address_t));401 memset(address_list, 0, max_count * sizeof(nic_address_t)); 402 402 nic_unicast_mode_t mode = NIC_UNICAST_DEFAULT; 403 403 size_t address_count = 0; … … 503 503 } 504 504 505 bzero(address_list, max_count * sizeof(nic_address_t));505 memset(address_list, 0, max_count * sizeof(nic_address_t)); 506 506 nic_multicast_mode_t mode = NIC_MULTICAST_BLOCKED; 507 507 size_t address_count = 0; … … 667 667 } 668 668 669 bzero(address_list, max_count * sizeof(nic_address_t));669 memset(address_list, 0, max_count * sizeof(nic_address_t)); 670 670 size_t address_count = 0; 671 671 … … 759 759 760 760 nic_vlan_mask_t vlan_mask; 761 bzero(&vlan_mask, sizeof(nic_vlan_mask_t));761 memset(&vlan_mask, 0, sizeof(nic_vlan_mask_t)); 762 762 763 763 int rc = nic_iface->vlan_get_mask(dev, &vlan_mask); … … 932 932 } 933 933 934 bzero(data, max_length);934 memset(data, 0, max_length); 935 935 936 936 int rc = nic_iface->wol_virtue_probe(dev, id, &type, max_length, … … 982 982 } 983 983 984 bzero(id_list, max_count * sizeof (nic_wv_id_t));984 memset(id_list, 0, max_count * sizeof (nic_wv_id_t)); 985 985 986 986 int rc = nic_iface->wol_virtue_list(dev, type, max_count, id_list, … … 1047 1047 } 1048 1048 1049 bzero(data, max_length);1049 memset(data, 0, max_length); 1050 1050 1051 1051 int rc = nic_iface->wol_load_info(dev, &type, max_length, data, -
uspace/lib/ext4/libext4_directory.c
rea15a89a r533e2d7 725 725 name_len) { 726 726 /* Compare names */ 727 if ( bcmp((uint8_t *) name, dentry->name, name_len) == 0) {727 if (memcmp((uint8_t *) name, dentry->name, name_len) == 0) { 728 728 *res_entry = dentry; 729 729 return EOK; -
uspace/lib/nic/src/nic_addr_db.c
rea15a89a r533e2d7 70 70 nic_addr_entry_t *entry = member_to_inst(item, nic_addr_entry_t, link); 71 71 72 return 0 == bcmp(entry->addr, key->addr, entry->len);72 return memcmp(entry->addr, key->addr, entry->len) == 0; 73 73 } 74 74 -
uspace/lib/nic/src/nic_driver.c
rea15a89a r533e2d7 682 682 fibril_rwlock_initialize(&nic_data->wv_lock); 683 683 684 bzero(&nic_data->mac, sizeof(nic_address_t));685 bzero(&nic_data->default_mac, sizeof(nic_address_t));686 bzero(&nic_data->stats, sizeof(nic_device_stats_t));684 memset(&nic_data->mac, 0, sizeof(nic_address_t)); 685 memset(&nic_data->default_mac, 0, sizeof(nic_address_t)); 686 memset(&nic_data->stats, 0, sizeof(nic_device_stats_t)); 687 687 688 688 return nic_data; -
uspace/lib/nic/src/nic_impl.c
rea15a89a r533e2d7 129 129 130 130 fibril_rwlock_write_lock(&nic_data->stats_lock); 131 bzero(&nic_data->stats, sizeof(nic_device_stats_t));131 memset(&nic_data->stats, 0, sizeof(nic_device_stats_t)); 132 132 fibril_rwlock_write_unlock(&nic_data->stats_lock); 133 133 … … 535 535 return ENOMEM; 536 536 } 537 bzero(virtue, sizeof(nic_wol_virtue_t));537 memset(virtue, 0, sizeof(nic_wol_virtue_t)); 538 538 if (length != 0) { 539 539 virtue->data = malloc(length); -
uspace/lib/nic/src/nic_rx_control.c
rea15a89a r533e2d7 55 55 int nic_rxc_init(nic_rxc_t *rxc) 56 56 { 57 bzero(rxc, sizeof(nic_rxc_t));57 memset(rxc, 0, sizeof(nic_rxc_t)); 58 58 int rc; 59 59 rc = nic_addr_db_init(&rxc->blocked_sources, ETH_ADDR); -
uspace/lib/nic/src/nic_wol_virtues.c
rea15a89a r533e2d7 73 73 int nic_wol_virtues_init(nic_wol_virtues_t *wvs) 74 74 { 75 bzero(wvs, sizeof(nic_wol_virtues_t));75 memset(wvs, 0, sizeof(nic_wol_virtues_t)); 76 76 wvs->table_operations.hash = nic_wv_hash; 77 77 wvs->table_operations.key_hash = nic_wv_key_hash; -
uspace/lib/posix/source/strings.c
rea15a89a r533e2d7 131 131 int posix_bcmp(const void *mem1, const void *mem2, size_t n) 132 132 { 133 return bcmp(mem1, mem2, n);133 return memcmp(mem1, mem2, n); 134 134 } 135 135 … … 155 155 void posix_bzero(void *mem, size_t n) 156 156 { 157 bzero(mem, n);157 memset(mem, 0, n); 158 158 } 159 159 -
uspace/lib/usb/src/debug.c
rea15a89a r533e2d7 84 84 * Remove previous string. 85 85 */ 86 bzero(buffer_dump[buffer_dump_index], BUFFER_DUMP_LEN);86 memset(buffer_dump[buffer_dump_index], 0, BUFFER_DUMP_LEN); 87 87 88 88 /* Do the actual dump. */
Note:
See TracChangeset
for help on using the changeset viewer.
