Changeset 533e2d7 in mainline for uspace/lib


Ignore:
Timestamp:
2013-06-03T07:55:35Z (13 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
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.
Message:

Merge mainline changes

Location:
uspace/lib
Files:
5 added
33 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/bithenge/src/blob.c

    rea15a89a r533e2d7  
    477477                if (rc != EOK)
    478478                        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) {
    480480                        *out = false;
    481481                        return EOK;
  • uspace/lib/c/Makefile

    rea15a89a r533e2d7  
    7474        generic/device/pci.c \
    7575        generic/device/ahci.c \
     76        generic/dnsr.c \
    7677        generic/dlfcn.c \
    7778        generic/elf/elf_load.c \
     
    9192        generic/task.c \
    9293        generic/futex.c \
     94        generic/inet/addr.c \
    9395        generic/inet.c \
    9496        generic/inetcfg.c \
  • uspace/lib/c/arch/abs32le/Makefile.common

    rea15a89a r533e2d7  
    2727#
    2828
    29 ifeq ($(COMPILER),clang)
    30         CLANG_ARCH = i386
    31 endif
    32 
    3329ENDIANESS = LE
  • uspace/lib/c/arch/amd64/Makefile.common

    rea15a89a r533e2d7  
    2727#
    2828
    29 CLANG_ARCH = x86_64
    30 CLANG_TARGET = x86_64-unknown-linux
    3129GCC_CFLAGS += -fno-omit-frame-pointer
    3230CLANG_CFLAGS += -fno-omit-frame-pointer
  • uspace/lib/c/arch/amd64/src/entry.s

    rea15a89a r533e2d7  
    4242        #
    4343        pushq $0
     44        pushq $0
    4445        movq %rsp, %rbp
    4546       
  • uspace/lib/c/arch/amd64/src/entryjmp.s

    rea15a89a r533e2d7  
    3636# Jump to program entry point
    3737entry_point_jmp:
     38        # use standard amd32 prologue not to confuse anybody
     39        push %rbp
     40        movq %rsp, %rbp
     41       
    3842        # pcb must be passed in %rdi, use %rdx as a scratch register
    3943        mov %rdi, %rdx
    4044        mov %rsi, %rdi
    41 
     45       
    4246        # jump to entry point
    4347        jmp %rdx
  • uspace/lib/c/arch/amd64/src/fibril.S

    rea15a89a r533e2d7  
    4242        movq (%rsp), %rdx     # the caller's return %eip
    4343       
    44         # In %edi is passed 1st argument
     44        # in %edi is passed 1st argument
    4545        CONTEXT_SAVE_ARCH_CORE %rdi %rdx
    4646       
    47         # Save TLS
     47        # save TLS
    4848        movq %fs:0, %rax
    4949        movq %rax, OFFSET_TLS(%rdi)
    50                
    51         xorl %eax, %eax         # context_save returns 1
     50       
     51        xorl %eax, %eax       # context_save returns 1
    5252        incl %eax
    5353        ret
    54 
    5554
    5655## Restore current CPU context
     
    6463       
    6564        movq %rdx,(%rsp)
    66 
     65       
    6766        # Set thread local storage
    68         movq OFFSET_TLS(%rdi), %rdi   # Set arg1 to TLS addr
    69         movl $1, %eax           # SYS_TLS_SET
     67        movq OFFSET_TLS(%rdi), %rdi  # Set arg1 to TLS addr
     68        movl $1, %eax                # SYS_TLS_SET
    7069        syscall
    71 
    72         xorl %eax, %eax         # context_restore returns 0
     70       
     71        xorl %eax, %eax              # context_restore returns 0
    7372        ret
  • uspace/lib/c/arch/amd64/src/thread_entry.s

    rea15a89a r533e2d7  
    3939        #
    4040        pushq $0
     41        pushq $0
    4142        movq %rsp, %rbp
    42 
     43       
    4344        #
    4445        # RAX contains address of uarg
  • uspace/lib/c/arch/ia32/Makefile.common

    rea15a89a r533e2d7  
    2727#
    2828
    29 CLANG_ARCH = i386
    30 CLANG_TARGET = i386-unknown-linux
    31 
    3229ifeq ($(PROCESSOR),i486)
    3330        GCC_CFLAGS += -march=i486 -fno-omit-frame-pointer
  • uspace/lib/c/arch/ia32/include/libarch/fibril.h

    rea15a89a r533e2d7  
    4343 * panic sooner or later
    4444 */
    45 #define SP_DELTA  12
     45#define SP_DELTA  8
    4646
    4747#define context_set(c, _pc, stack, size, ptls) \
  • uspace/lib/c/arch/ia32/src/entry.S

    rea15a89a r533e2d7  
    4747        # Do not set %gs, it contains descriptor that can see TLS
    4848       
    49 #ifndef PROCESSOR_i486 
     49#ifndef PROCESSOR_i486
    5050        # Detect the mechanism used for making syscalls
    5151        movl $(INTEL_CPUID_STANDARD), %eax
     
    6262        #
    6363        pushl $0
     64        pushl $0
    6465        movl %esp, %ebp
    6566       
  • uspace/lib/c/arch/ia32/src/entryjmp.s

    rea15a89a r533e2d7  
    3636        push %ebp
    3737        movl %esp, %ebp
    38 
     38       
    3939        # %eax := entry_point
    4040        movl 0x8(%ebp), %eax
    41 
     41       
    4242        # %edi := pcb
    4343        # pcb is passed to the entry point in %edi
    4444        mov 0xc(%ebp), %edi
    45 
     45       
    4646        # Save a tiny bit of stack space
    4747        pop %ebp
    48 
     48       
    4949        jmp *%eax
  • uspace/lib/c/arch/ia32/src/fibril.S

    rea15a89a r533e2d7  
    3434.global context_restore
    3535
    36 
    3736## Save current CPU context
    3837#
     
    4140#
    4241context_save:
    43         movl 0(%esp),%eax       # the caller's return %eip
    44         movl 4(%esp),%edx       # address of the context variable to save context to
    45 
    46                 # save registers to the context structure
     42        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
    4746        CONTEXT_SAVE_ARCH_CORE %edx %eax
    48 
    49         # Save TLS
     47       
     48        # save TLS
    5049        movl %gs:0, %eax
    5150        movl %eax, OFFSET_TLS(%edx)     # tls -> ctx->tls
    5251       
    53         xorl %eax,%eax          # context_save returns 1
     52        xorl %eax, %eax     # context_save returns 1
    5453        incl %eax
    5554        ret
    56 
    5755
    5856## Restore saved CPU context
     
    6260#
    6361context_restore:
    64         movl 4(%esp),%eax       # address of the context variable to restore context from
    65 
    66                 # restore registers from the context structure
     62        movl 4(%esp), %eax  # address of the context variable to restore context from
     63       
     64        # restore registers from the context structure
    6765        CONTEXT_RESTORE_ARCH_CORE %eax %edx
    68 
    69         movl %edx,0(%esp)       # ctx->pc -> saver's return %eip
    70 
    71         # Set thread local storage
     66       
     67        movl %edx, 0(%esp)  # ctx->pc -> saver's return %eip
     68       
     69        # set thread local storage
    7270        pushl %edx
    73         movl OFFSET_TLS(%eax), %edx   # Set arg1 to TLS addr
    74         movl $1, %eax         # Syscall SYS_TLS_SET
     71        movl OFFSET_TLS(%eax), %edx  # Set arg1 to TLS addr
     72        movl $1, %eax                # Syscall SYS_TLS_SET
    7573        int $0x30
    7674        popl %edx
    7775       
    78         xorl %eax,%eax          # context_restore returns 0
     76        xorl %eax, %eax     # context_restore returns 0
    7977        ret
  • uspace/lib/c/arch/ia32/src/setjmp.S

    rea15a89a r533e2d7  
    3535.type setjmp,@function
    3636setjmp:
    37         movl 0(%esp),%eax  # save pc value into eax
    38         movl 4(%esp),%edx  # address of the jmp_buf structure to save context to
     37        movl 0(%esp), %eax  # save pc value into eax
     38        movl 4(%esp), %edx  # address of the jmp_buf structure to save context to
    3939       
    4040        # save registers to the jmp_buf structure
    4141        CONTEXT_SAVE_ARCH_CORE %edx %eax
    4242       
    43         xorl %eax,%eax  # set_jmp returns 0
     43        xorl %eax, %eax     # set_jmp returns 0
    4444        ret
    4545
     
    5252        CONTEXT_RESTORE_ARCH_CORE %ecx %edx
    5353       
    54         movl %edx,0(%esp)  # put saved pc on stack
     54        movl %edx, 0(%esp)  # put saved pc on stack
    5555        ret
  • uspace/lib/c/arch/ia32/src/thread_entry.s

    rea15a89a r533e2d7  
    4040        mov %dx, %fs
    4141        # Do not set %gs, it contains descriptor that can see TLS
    42 
     42       
    4343        #
    4444        # Create the first stack frame.
    4545        #
    4646        pushl $0
     47        pushl $0
    4748        mov %esp, %ebp
    48 
     49       
    4950        #
    5051        # EAX contains address of uarg.
  • uspace/lib/c/generic/device/hw_res_parsed.c

    rea15a89a r533e2d7  
    188188        hw_resource_list_t hw_resources;
    189189        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));
    191191       
    192192        int rc = hw_res_get_resource_list(sess, &hw_resources);
  • uspace/lib/c/generic/mem.c

    rea15a89a r533e2d7  
    224224 * @param s1  Pointer to the first area to compare.
    225225 * @param s2  Pointer to the second area to compare.
    226  * @param len Size of the first area in bytes. Both areas must have
    227  *            the same length.
    228  *
    229  * @return If len is 0, return zero. If the areas match, return
    230  *         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 */
     233int memcmp(const void *s1, const void *s2, size_t len)
    234234{
    235235        uint8_t *u1 = (uint8_t *) s1;
    236236        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;
    241247}
    242248
  • uspace/lib/c/generic/net/inet.c

    rea15a89a r533e2d7  
    144144        /* Erase if no address */
    145145        if (!address) {
    146                 bzero(data, count);
     146                memset(data, 0, count);
    147147                return ENOENT;
    148148        }
     
    181181                } else {
    182182                        /* Erase the rest of the address */
    183                         bzero(data + index, count - index);
     183                        memset(data + index, 0, count - index);
    184184                        return EOK;
    185185                }
  • uspace/lib/c/generic/net/socket_client.c

    rea15a89a r533e2d7  
    446446                return ENOMEM;
    447447
    448         bzero(socket, sizeof(*socket));
     448        memset(socket, 0, sizeof(*socket));
    449449        fibril_rwlock_write_lock(&socket_globals.lock);
    450450
     
    657657                return ENOMEM;
    658658        }
    659         bzero(new_socket, sizeof(*new_socket));
     659        memset(new_socket, 0, sizeof(*new_socket));
    660660        socket_id = socket_generate_new_id();
    661661        if (socket_id <= 0) {
  • uspace/lib/c/include/device/hw_res_parsed.h

    rea15a89a r533e2d7  
    127127        free(list->dma_channels.channels);
    128128       
    129         bzero(list, sizeof(hw_res_list_parsed_t));
     129        memset(list, 0, sizeof(hw_res_list_parsed_t));
    130130}
    131131
     
    136136static inline void hw_res_list_parsed_init(hw_res_list_parsed_t *list)
    137137{
    138         bzero(list, sizeof(hw_res_list_parsed_t));
     138        memset(list, 0, sizeof(hw_res_list_parsed_t));
    139139}
    140140
  • uspace/lib/c/include/inet/inet.h

    rea15a89a r533e2d7  
    3636#define LIBC_INET_INET_H_
    3737
     38#include <inet/addr.h>
    3839#include <sys/types.h>
    3940
    4041#define INET_TTL_MAX 255
    41 
    42 typedef struct {
    43         uint32_t ipv4;
    44 } inet_addr_t;
    4542
    4643typedef struct {
  • uspace/lib/c/include/inet/inetcfg.h

    rea15a89a r533e2d7  
    3838#include <inet/inet.h>
    3939#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;
    4840
    4941/** Address object info */
  • uspace/lib/c/include/ipc/services.h

    rea15a89a r533e2d7  
    5353} services_t;
    5454
     55#define SERVICE_NAME_DNSR     "net/dnsr"
    5556#define SERVICE_NAME_INET     "net/inet"
    5657#define SERVICE_NAME_INETCFG  "net/inetcfg"
  • uspace/lib/c/include/mem.h

    rea15a89a r533e2d7  
    3838#include <sys/types.h>
    3939
    40 #define bzero(ptr, len)  memset((ptr), 0, (len))
    41 
    4240extern void *memset(void *, int, size_t)
    4341    __attribute__ ((optimize("-fno-tree-loop-distribute-patterns")));
     
    4543    __attribute__ ((optimize("-fno-tree-loop-distribute-patterns")));
    4644extern void *memmove(void *, const void *, size_t);
    47 
    48 extern int bcmp(const void *, const void *, size_t);
     45extern int memcmp(const void *, const void *, size_t);
    4946
    5047#endif
  • uspace/lib/drv/generic/remote_nic.c

    rea15a89a r533e2d7  
    104104       
    105105        nic_address_t address;
    106         bzero(&address, sizeof(nic_address_t));
     106        memset(&address, 0, sizeof(nic_address_t));
    107107       
    108108        int rc = nic_iface->get_address(dev, &address);
     
    173173       
    174174        nic_device_stats_t stats;
    175         bzero(&stats, sizeof(nic_device_stats_t));
     175        memset(&stats, 0, sizeof(nic_device_stats_t));
    176176       
    177177        int rc = nic_iface->get_stats(dev, &stats);
     
    208208       
    209209        nic_device_info_t info;
    210         bzero(&info, sizeof(nic_device_info_t));
     210        memset(&info, 0, sizeof(nic_device_info_t));
    211211       
    212212        int rc = nic_iface->get_device_info(dev, &info);
     
    399399        }
    400400       
    401         bzero(address_list, max_count * sizeof(nic_address_t));
     401        memset(address_list, 0, max_count * sizeof(nic_address_t));
    402402        nic_unicast_mode_t mode = NIC_UNICAST_DEFAULT;
    403403        size_t address_count = 0;
     
    503503        }
    504504       
    505         bzero(address_list, max_count * sizeof(nic_address_t));
     505        memset(address_list, 0, max_count * sizeof(nic_address_t));
    506506        nic_multicast_mode_t mode = NIC_MULTICAST_BLOCKED;
    507507        size_t address_count = 0;
     
    667667        }
    668668       
    669         bzero(address_list, max_count * sizeof(nic_address_t));
     669        memset(address_list, 0, max_count * sizeof(nic_address_t));
    670670        size_t address_count = 0;
    671671       
     
    759759       
    760760        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));
    762762       
    763763        int rc = nic_iface->vlan_get_mask(dev, &vlan_mask);
     
    932932        }
    933933       
    934         bzero(data, max_length);
     934        memset(data, 0, max_length);
    935935       
    936936        int rc = nic_iface->wol_virtue_probe(dev, id, &type, max_length,
     
    982982        }
    983983       
    984         bzero(id_list, max_count * sizeof (nic_wv_id_t));
     984        memset(id_list, 0, max_count * sizeof (nic_wv_id_t));
    985985       
    986986        int rc = nic_iface->wol_virtue_list(dev, type, max_count, id_list,
     
    10471047        }
    10481048       
    1049         bzero(data, max_length);
     1049        memset(data, 0, max_length);
    10501050       
    10511051        int rc = nic_iface->wol_load_info(dev, &type, max_length, data,
  • uspace/lib/ext4/libext4_directory.c

    rea15a89a r533e2d7  
    725725                            name_len) {
    726726                                /* Compare names */
    727                                 if (bcmp((uint8_t *) name, dentry->name, name_len) == 0) {
     727                                if (memcmp((uint8_t *) name, dentry->name, name_len) == 0) {
    728728                                        *res_entry = dentry;
    729729                                        return EOK;
  • uspace/lib/nic/src/nic_addr_db.c

    rea15a89a r533e2d7  
    7070        nic_addr_entry_t *entry = member_to_inst(item, nic_addr_entry_t, link);
    7171       
    72         return 0 == bcmp(entry->addr, key->addr, entry->len);
     72        return memcmp(entry->addr, key->addr, entry->len) == 0;
    7373}
    7474
  • uspace/lib/nic/src/nic_driver.c

    rea15a89a r533e2d7  
    682682        fibril_rwlock_initialize(&nic_data->wv_lock);
    683683       
    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));
    687687       
    688688        return nic_data;
  • uspace/lib/nic/src/nic_impl.c

    rea15a89a r533e2d7  
    129129
    130130                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));
    132132                fibril_rwlock_write_unlock(&nic_data->stats_lock);
    133133
     
    535535                return ENOMEM;
    536536        }
    537         bzero(virtue, sizeof (nic_wol_virtue_t));
     537        memset(virtue, 0, sizeof(nic_wol_virtue_t));
    538538        if (length != 0) {
    539539                virtue->data = malloc(length);
  • uspace/lib/nic/src/nic_rx_control.c

    rea15a89a r533e2d7  
    5555int nic_rxc_init(nic_rxc_t *rxc)
    5656{
    57         bzero(rxc, sizeof (nic_rxc_t));
     57        memset(rxc, 0, sizeof(nic_rxc_t));
    5858        int rc;
    5959        rc = nic_addr_db_init(&rxc->blocked_sources, ETH_ADDR);
  • uspace/lib/nic/src/nic_wol_virtues.c

    rea15a89a r533e2d7  
    7373int nic_wol_virtues_init(nic_wol_virtues_t *wvs)
    7474{
    75         bzero(wvs, sizeof(nic_wol_virtues_t));
     75        memset(wvs, 0, sizeof(nic_wol_virtues_t));
    7676        wvs->table_operations.hash = nic_wv_hash;
    7777        wvs->table_operations.key_hash = nic_wv_key_hash;
  • uspace/lib/posix/source/strings.c

    rea15a89a r533e2d7  
    131131int posix_bcmp(const void *mem1, const void *mem2, size_t n)
    132132{
    133         return bcmp(mem1, mem2, n);
     133        return memcmp(mem1, mem2, n);
    134134}
    135135
     
    155155void posix_bzero(void *mem, size_t n)
    156156{
    157         bzero(mem, n);
     157        memset(mem, 0, n);
    158158}
    159159
  • uspace/lib/usb/src/debug.c

    rea15a89a r533e2d7  
    8484         * Remove previous string.
    8585         */
    86         bzero(buffer_dump[buffer_dump_index], BUFFER_DUMP_LEN);
     86        memset(buffer_dump[buffer_dump_index], 0, BUFFER_DUMP_LEN);
    8787
    8888        /* Do the actual dump. */
Note: See TracChangeset for help on using the changeset viewer.