Changeset 925a21e in mainline for uspace/lib/c


Ignore:
Timestamp:
2011-09-24T14:20:29Z (14 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
5bf76c1
Parents:
867e2555 (diff), 1ab4aca (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/c
Files:
42 added
5 deleted
96 edited
2 moved

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/Makefile

    r867e2555 r925a21e  
    3131ROOT_PATH = $(USPACE_PREFIX)/..
    3232
    33 INCLUDE_KERNEL = include/kernel
    34 INCLUDE_ARCH = include/arch
     33INCLUDE_ABI = include/abi
    3534INCLUDE_LIBARCH = include/libarch
    3635
     
    4746        $(LIBC_PREFIX)/arch/$(UARCH)/_link-dlexe.ld
    4847
    49 PRE_DEPEND = $(INCLUDE_KERNEL) $(INCLUDE_ARCH) $(INCLUDE_LIBARCH) $(COMMON_HEADER_ARCH)
     48PRE_DEPEND = $(INCLUDE_ABI) $(INCLUDE_LIBARCH) $(COMMON_HEADER_ARCH)
    5049EXTRA_OUTPUT = $(LINKER_SCRIPTS)
    51 EXTRA_CLEAN = $(INCLUDE_KERNEL) $(INCLUDE_ARCH) $(INCLUDE_LIBARCH) $(COMMON_HEADER_ARCH) $(LINKER_SCRIPTS)
     50EXTRA_CLEAN = $(INCLUDE_ABI) $(INCLUDE_LIBARCH) $(COMMON_HEADER_ARCH) $(LINKER_SCRIPTS)
    5251LIBRARY = libc
    5352SLIBRARY = libc.so.0.0
     
    6463        generic/as.c \
    6564        generic/cap.c \
     65        generic/cfg.c \
    6666        generic/clipboard.c \
    67         generic/devmap.c \
    6867        generic/devman.c \
    6968        generic/device/hw_res.c \
     
    7271        generic/event.c \
    7372        generic/errno.c \
     73        generic/loc.c \
    7474        generic/mem.c \
    7575        generic/str.c \
     
    9494        generic/io/printf_core.c \
    9595        generic/io/console.c \
    96         generic/io/screenbuffer.c \
    9796        generic/malloc.c \
    9897        generic/sysinfo.c \
    9998        generic/ipc.c \
    10099        generic/ns.c \
    101         generic/ns_obsolete.c \
    102100        generic/async.c \
    103         generic/async_obsolete.c \
    104101        generic/loader.c \
    105102        generic/getopt.c \
     
    144141include $(USPACE_PREFIX)/Makefile.common
    145142
    146 $(INCLUDE_ARCH): $(INCLUDE_KERNEL) $(INCLUDE_KERNEL)/arch
    147         ln -sfn kernel/arch $@
    148 
    149143$(INCLUDE_LIBARCH): arch/$(UARCH)/include
    150144        ln -sfn ../$< $@
    151145
    152 $(INCLUDE_KERNEL)/arch: ../../../kernel/generic/include/arch $(INCLUDE_KERNEL)
    153 
    154 $(INCLUDE_KERNEL): ../../../kernel/generic/include/
     146$(INCLUDE_ABI): ../../../abi/include/
    155147        ln -sfn ../$< $@
    156148
  • uspace/lib/c/arch/abs32le/include/istate.h

    • Property mode changed from 100644 to 120000
    r867e2555 r925a21e  
    1 /*
    2  * Copyright (c) 2010 Martin Decky
    3  * All rights reserved.
    4  *
    5  * Redistribution and use in source and binary forms, with or without
    6  * modification, are permitted provided that the following conditions
    7  * are met:
    8  *
    9  * - Redistributions of source code must retain the above copyright
    10  *   notice, this list of conditions and the following disclaimer.
    11  * - Redistributions in binary form must reproduce the above copyright
    12  *   notice, this list of conditions and the following disclaimer in the
    13  *   documentation and/or other materials provided with the distribution.
    14  * - The name of the author may not be used to endorse or promote products
    15  *   derived from this software without specific prior written permission.
    16  *
    17  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
    18  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
    19  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
    20  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
    21  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
    22  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
    23  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
    24  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    25  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
    26  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    27  */
    28 
    29 /** @addtogroup debug
    30  * @{
    31  */
    32 /** @file
    33  */
    34 
    35 #ifndef LIBC_abs32le__ISTATE_H_
    36 #define LIBC_abs32le__ISTATE_H_
    37 
    38 #include <arch/istate.h>
    39 
    40 #endif
    41 
    42 /** @}
    43  */
     1../../../../../../kernel/arch/abs32le/include/istate.h
  • uspace/lib/c/arch/abs32le/include/syscall.h

    r867e2555 r925a21e  
    3838
    3939#include <sys/types.h>
    40 #include <kernel/syscall/syscall.h>
     40#include <abi/syscall.h>
    4141
    4242#define __syscall0  __syscall
  • uspace/lib/c/arch/abs32le/include/types.h

    r867e2555 r925a21e  
    5252
    5353typedef uint32_t uintptr_t;
     54typedef int32_t intptr_t;
    5455typedef uint32_t atomic_count_t;
    5556typedef int32_t atomic_signed_t;
  • uspace/lib/c/arch/amd64/include/atomic.h

    r867e2555 r925a21e  
    4444static inline void atomic_inc(atomic_t *val)
    4545{
     46#ifdef __PCC__
     47        asm volatile (
     48                "lock incq %0\n"
     49                : "+m" (val->count)
     50        );
     51#else
    4652        asm volatile (
    4753                "lock incq %[count]\n"
    4854                : [count] "+m" (val->count)
    4955        );
     56#endif
    5057}
    5158
    5259static inline void atomic_dec(atomic_t *val)
    5360{
     61#ifdef __PCC__
     62        asm volatile (
     63                "lock decq %0\n"
     64                : "+m" (val->count)
     65        );
     66#else
    5467        asm volatile (
    5568                "lock decq %[count]\n"
    5669                : [count] "+m" (val->count)
    5770        );
     71#endif
    5872}
    5973
     
    6276        atomic_count_t r = 1;
    6377       
     78#ifdef __PCC__
     79        asm volatile (
     80                "lock xaddq %1, %0\n"
     81                : "+m" (val->count),
     82                  "+r" (r)
     83        );
     84#else
    6485        asm volatile (
    6586                "lock xaddq %[r], %[count]\n"
     
    6788                  [r] "+r" (r)
    6889        );
     90#endif
    6991       
    7092        return r;
     
    7597        atomic_count_t r = -1;
    7698       
     99#ifdef __PCC__
     100        asm volatile (
     101                "lock xaddq %1, %0\n"
     102                : "+m" (val->count),
     103                  "+r" (r)
     104        );
     105#else
    77106        asm volatile (
    78107                "lock xaddq %[r], %[count]\n"
     
    80109                  [r] "+r" (r)
    81110        );
     111#endif
    82112       
    83113        return r;
  • uspace/lib/c/arch/amd64/include/elf_linux.h

    r867e2555 r925a21e  
    3030 * @{
    3131 */
    32 /** @file
     32/** @file Definitions needed to write core files in Linux-ELF format.
    3333 */
    3434
     
    3939#include <sys/types.h>
    4040
     41/** Linux kernel struct pt_regs structure.
     42 *
     43 * We need this to save register state to a core file in Linux format
     44 * (readable by GDB configured for Linux target).
     45 */
    4146typedef struct {
    42         /* TODO */
    43         uint64_t pad[16];
     47        uint64_t r15;
     48        uint64_t r14;
     49        uint64_t r13;
     50        uint64_t r12;
     51        uint64_t rbp;
     52        uint64_t rbx;
     53        uint64_t r11;
     54        uint64_t r10;
     55        uint64_t r9;
     56        uint64_t r8;
     57        uint64_t rax;
     58        uint64_t rcx;
     59        uint64_t rdx;
     60        uint64_t rsi;
     61        uint64_t rdi;
     62        uint64_t old_rax;
     63        uint64_t rip;
     64        uint64_t cs;
     65        uint64_t rflags;
     66        uint64_t rsp;
     67        uint64_t ss;
    4468} elf_regs_t;
    4569
     70/** Convert istate_t to elf_regs_t. */
    4671static inline void istate_to_elf_regs(istate_t *istate, elf_regs_t *elf_regs)
    4772{
    48         /* TODO */
    49         (void) istate; (void) elf_regs;
     73        elf_regs->r15 = istate->r15;
     74        elf_regs->r14 = istate->r14;
     75        elf_regs->r13 = istate->r13;
     76        elf_regs->r12 = istate->r12;
     77        elf_regs->rbp = istate->rbp;
     78        elf_regs->rbx = istate->rbx;
     79        elf_regs->r11 = istate->r11;
     80        elf_regs->r10 = istate->r10;
     81        elf_regs->r9 = istate->r9;
     82        elf_regs->r8 = istate->r8;
     83        elf_regs->rax = istate->rax;
     84        elf_regs->rcx = istate->rcx;
     85        elf_regs->rdx = istate->rdx;
     86        elf_regs->rsi = istate->rsi;
     87        elf_regs->rdi = istate->rdi;
     88        elf_regs->rip = istate->rip;
     89        elf_regs->cs = istate->cs;
     90        elf_regs->rflags = istate->rflags;
     91        elf_regs->rsp = istate->rsp;
     92        elf_regs->ss = istate->ss;
    5093}
    5194
  • uspace/lib/c/arch/amd64/include/istate.h

    • Property mode changed from 100644 to 120000
    r867e2555 r925a21e  
    1 /*
    2  * Copyright (c) 2010 Jiri Svoboda
    3  * All rights reserved.
    4  *
    5  * Redistribution and use in source and binary forms, with or without
    6  * modification, are permitted provided that the following conditions
    7  * are met:
    8  *
    9  * - Redistributions of source code must retain the above copyright
    10  *   notice, this list of conditions and the following disclaimer.
    11  * - Redistributions in binary form must reproduce the above copyright
    12  *   notice, this list of conditions and the following disclaimer in the
    13  *   documentation and/or other materials provided with the distribution.
    14  * - The name of the author may not be used to endorse or promote products
    15  *   derived from this software without specific prior written permission.
    16  *
    17  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
    18  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
    19  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
    20  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
    21  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
    22  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
    23  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
    24  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    25  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
    26  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    27  */
    28 
    29 /** @addtogroup libcamd64
    30  * @{
    31  */
    32 /** @file
    33  */
    34 
    35 #ifndef LIBC_amd64_ISTATE_H_
    36 #define LIBC_amd64_ISTATE_H_
    37 
    38 #include <arch/istate.h>
    39 
    40 #endif
    41 
    42 /** @}
    43  */
     1../../../../../../kernel/arch/amd64/include/istate.h
  • uspace/lib/c/arch/amd64/include/types.h

    r867e2555 r925a21e  
    5252
    5353typedef uint64_t uintptr_t;
     54typedef int64_t intptr_t;
    5455typedef uint64_t atomic_count_t;
    5556typedef int64_t atomic_signed_t;
  • uspace/lib/c/arch/amd64/src/fibril.S

    r867e2555 r925a21e  
    3232.global context_restore
    3333
    34 #include <kernel/arch/context_offset.h>
     34#include <libarch/context_offset.h>
    3535
    3636## Save current CPU context
  • uspace/lib/c/arch/arm32/include/elf_linux.h

    r867e2555 r925a21e  
    3030 * @{
    3131 */
    32 /** @file
     32/** @file Definitions needed to write core files in Linux-ELF format.
    3333 */
    3434
     
    3939#include <sys/types.h>
    4040
     41/** Linux kernel struct pt_regs structure.
     42 *
     43 * We need this to save register state to a core file in Linux format
     44 * (readable by GDB configured for Linux target).
     45 */
    4146typedef struct {
    42         /* TODO */
    43         uint32_t pad[16];
     47        uint32_t r0;
     48        uint32_t r1;
     49        uint32_t r2;
     50        uint32_t r3;
     51        uint32_t r4;
     52        uint32_t r5;
     53        uint32_t r6;
     54        uint32_t r7;
     55        uint32_t r8;
     56        uint32_t r9;
     57        uint32_t r10;
     58        uint32_t fp;
     59        uint32_t r12;
     60        uint32_t sp;
     61        uint32_t lr;
     62        uint32_t pc;
     63        uint32_t cpsr;
     64        uint32_t old_r0;
    4465} elf_regs_t;
    4566
     67/** Convert istate_t to elf_regs_t. */
    4668static inline void istate_to_elf_regs(istate_t *istate, elf_regs_t *elf_regs)
    4769{
    48         /* TODO */
    49         (void) istate; (void) elf_regs;
     70        elf_regs->r0 = istate->r0;
     71        elf_regs->r1 = istate->r1;
     72        elf_regs->r2 = istate->r2;
     73        elf_regs->r3 = istate->r3;
     74        elf_regs->r4 = istate->r4;
     75        elf_regs->r5 = istate->r5;
     76        elf_regs->r6 = istate->r6;
     77        elf_regs->r7 = istate->r7;
     78        elf_regs->r8 = istate->r8;
     79        elf_regs->r9 = istate->r9;
     80        elf_regs->r10 = istate->r10;
     81
     82        elf_regs->fp = istate->fp;
     83        elf_regs->r12 = istate->r12;
     84        elf_regs->sp = istate->sp;
     85        elf_regs->lr = istate->lr;
     86        elf_regs->pc = istate->pc;
     87        elf_regs->cpsr = istate->spsr;
     88        elf_regs->old_r0 = 0;
    5089}
    5190
  • uspace/lib/c/arch/arm32/include/istate.h

    • Property mode changed from 100644 to 120000
    r867e2555 r925a21e  
    1 /*
    2  * Copyright (c) 2010 Jiri Svoboda
    3  * All rights reserved.
    4  *
    5  * Redistribution and use in source and binary forms, with or without
    6  * modification, are permitted provided that the following conditions
    7  * are met:
    8  *
    9  * - Redistributions of source code must retain the above copyright
    10  *   notice, this list of conditions and the following disclaimer.
    11  * - Redistributions in binary form must reproduce the above copyright
    12  *   notice, this list of conditions and the following disclaimer in the
    13  *   documentation and/or other materials provided with the distribution.
    14  * - The name of the author may not be used to endorse or promote products
    15  *   derived from this software without specific prior written permission.
    16  *
    17  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
    18  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
    19  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
    20  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
    21  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
    22  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
    23  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
    24  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    25  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
    26  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    27  */
    28 
    29 /** @addtogroup libcarm32
    30  * @{
    31  */
    32 /** @file
    33  */
    34 
    35 #ifndef LIBC_arm32__ISTATE_H_
    36 #define LIBC_arm32__ISTATE_H_
    37 
    38 #include <arch/istate.h>
    39 
    40 #endif
    41 
    42 /** @}
    43  */
     1../../../../../../kernel/arch/arm32/include/istate.h
  • uspace/lib/c/arch/arm32/include/types.h

    r867e2555 r925a21e  
    5353
    5454typedef uint32_t uintptr_t;
     55typedef int32_t intptr_t;
    5556typedef uint32_t atomic_count_t;
    5657typedef int32_t atomic_signed_t;
  • uspace/lib/c/arch/ia32/Makefile.common

    r867e2555 r925a21e  
    2828
    2929CLANG_ARCH = i386
    30 GCC_CFLAGS += -march=pentium -fno-omit-frame-pointer
     30
     31ifeq ($(PROCESSOR),i486)
     32        GCC_CFLAGS += -march=i486 -fno-omit-frame-pointer
     33else
     34        GCC_CFLAGS += -march=pentium -fno-omit-frame-pointer
     35endif
    3136
    3237ENDIANESS = LE
  • uspace/lib/c/arch/ia32/Makefile.inc

    r867e2555 r925a21e  
    2828
    2929ARCH_SOURCES = \
    30         arch/$(UARCH)/src/entry.s \
     30        arch/$(UARCH)/src/entry.S \
    3131        arch/$(UARCH)/src/entryjmp.s \
    3232        arch/$(UARCH)/src/thread_entry.s \
  • uspace/lib/c/arch/ia32/include/atomic.h

    r867e2555 r925a21e  
    4242static inline void atomic_inc(atomic_t *val)
    4343{
     44#ifdef __PCC__
     45        asm volatile (
     46                "lock incl %0\n"
     47                : "+m" (val->count)
     48        );
     49#else
    4450        asm volatile (
    4551                "lock incl %[count]\n"
    4652                : [count] "+m" (val->count)
    4753        );
     54#endif
    4855}
    4956
    5057static inline void atomic_dec(atomic_t *val)
    5158{
     59#ifdef __PCC__
     60        asm volatile (
     61                "lock decl %0\n"
     62                : "+m" (val->count)
     63        );
     64#else
    5265        asm volatile (
    5366                "lock decl %[count]\n"
    5467                : [count] "+m" (val->count)
    5568        );
     69#endif
    5670}
    5771
     
    6074        atomic_count_t r = 1;
    6175       
     76#ifdef __PCC__
     77        asm volatile (
     78                "lock xaddl %1, %0\n"
     79                : "+m" (val->count),
     80                  "+r" (r)
     81        );
     82#else
    6283        asm volatile (
    6384                "lock xaddl %[r], %[count]\n"
     
    6586                  [r] "+r" (r)
    6687        );
     88#endif
    6789       
    6890        return r;
     
    7395        atomic_count_t r = -1;
    7496       
     97#ifdef __PCC__
     98        asm volatile (
     99                "lock xaddl %1, %0\n"
     100                : "+m" (val->count),
     101                  "+r" (r)
     102        );
     103#else
    75104        asm volatile (
    76105                "lock xaddl %[r], %[count]\n"
     
    78107                  [r] "+r" (r)
    79108        );
     109#endif
    80110       
    81111        return r;
  • uspace/lib/c/arch/ia32/include/ddi.h

    r867e2555 r925a21e  
    4141static inline uint8_t pio_read_8(ioport8_t *port)
    4242{
    43         uint8_t val;
    44        
    45         asm volatile (
    46                 "inb %w[port], %b[val]\n"
    47                 : [val] "=a" (val)
    48                 : [port] "d" (port)
    49         );
    50        
    51         return val;
     43        if (port < (ioport8_t *) IO_SPACE_BOUNDARY) {
     44                uint8_t val;
     45               
     46                asm volatile (
     47                        "inb %w[port], %b[val]\n"
     48                        : [val] "=a" (val)
     49                        : [port] "d" (port)
     50                );
     51               
     52                return val;
     53        } else
     54                return (uint8_t) *port;
    5255}
    5356
    5457static inline uint16_t pio_read_16(ioport16_t *port)
    5558{
    56         uint16_t val;
    57        
    58         asm volatile (
    59                 "inw %w[port], %w[val]\n"
    60                 : [val] "=a" (val)
    61                 : [port] "d" (port)
    62         );
    63        
    64         return val;
     59        if (port < (ioport16_t *) IO_SPACE_BOUNDARY) {
     60                uint16_t val;
     61               
     62                asm volatile (
     63                        "inw %w[port], %w[val]\n"
     64                        : [val] "=a" (val)
     65                        : [port] "d" (port)
     66                );
     67               
     68                return val;
     69        } else
     70                return (uint16_t) *port;
    6571}
    6672
    6773static inline uint32_t pio_read_32(ioport32_t *port)
    6874{
    69         uint32_t val;
    70        
    71         asm volatile (
    72                 "inl %w[port], %[val]\n"
    73                 : [val] "=a" (val)
    74                 : [port] "d" (port)
    75         );
    76        
    77         return val;
     75        if (port < (ioport32_t *) IO_SPACE_BOUNDARY) {
     76                uint32_t val;
     77               
     78                asm volatile (
     79                        "inl %w[port], %[val]\n"
     80                        : [val] "=a" (val)
     81                        : [port] "d" (port)
     82                );
     83               
     84                return val;
     85        } else
     86                return (uint32_t) *port;
    7887}
    7988
    8089static inline void pio_write_8(ioport8_t *port, uint8_t val)
    8190{
    82         asm volatile (
    83                 "outb %b[val], %w[port]\n"
    84                 :: [val] "a" (val), [port] "d" (port)
    85         );
     91        if (port < (ioport8_t *) IO_SPACE_BOUNDARY) {
     92                asm volatile (
     93                        "outb %b[val], %w[port]\n"
     94                        :: [val] "a" (val), [port] "d" (port)
     95                );     
     96        } else
     97                *port = val;
    8698}
    8799
    88100static inline void pio_write_16(ioport16_t *port, uint16_t val)
    89101{
    90         asm volatile (
    91                 "outw %w[val], %w[port]\n"
    92                 :: [val] "a" (val), [port] "d" (port)
    93         );
     102        if (port < (ioport16_t *) IO_SPACE_BOUNDARY) {
     103                asm volatile (
     104                        "outw %w[val], %w[port]\n"
     105                        :: [val] "a" (val), [port] "d" (port)
     106                );
     107        } else
     108                *port = val;
    94109}
    95110
    96111static inline void pio_write_32(ioport32_t *port, uint32_t val)
    97112{
    98         asm volatile (
    99                 "outl %[val], %w[port]\n"
    100                 :: [val] "a" (val), [port] "d" (port)
    101         );
     113        if (port < (ioport32_t *) IO_SPACE_BOUNDARY) {
     114                asm volatile (
     115                        "outl %[val], %w[port]\n"
     116                        :: [val] "a" (val), [port] "d" (port)
     117                );
     118        } else
     119                *port = val;
    102120}
    103121
  • uspace/lib/c/arch/ia32/include/elf_linux.h

    r867e2555 r925a21e  
    3030 * @{
    3131 */
    32 /** @file
     32/** @file Definitions needed to write core files in Linux-ELF format.
    3333 */
    3434
     
    3939#include <sys/types.h>
    4040
     41/** Linux kernel struct pt_regs structure.
     42 *
     43 * We need this to save register state to a core file in Linux format
     44 * (readable by GDB configured for Linux target).
     45 */
    4146typedef struct {
    4247        uint32_t ebx;
     
    5964} elf_regs_t;
    6065
     66/** Convert istate_t to elf_regs_t. */
    6167static inline void istate_to_elf_regs(istate_t *istate, elf_regs_t *elf_regs)
    6268{
  • uspace/lib/c/arch/ia32/include/istate.h

    • Property mode changed from 100644 to 120000
    r867e2555 r925a21e  
    1 /*
    2  * Copyright (c) 2010 Jiri Svoboda
    3  * All rights reserved.
    4  *
    5  * Redistribution and use in source and binary forms, with or without
    6  * modification, are permitted provided that the following conditions
    7  * are met:
    8  *
    9  * - Redistributions of source code must retain the above copyright
    10  *   notice, this list of conditions and the following disclaimer.
    11  * - Redistributions in binary form must reproduce the above copyright
    12  *   notice, this list of conditions and the following disclaimer in the
    13  *   documentation and/or other materials provided with the distribution.
    14  * - The name of the author may not be used to endorse or promote products
    15  *   derived from this software without specific prior written permission.
    16  *
    17  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
    18  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
    19  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
    20  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
    21  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
    22  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
    23  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
    24  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    25  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
    26  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    27  */
    28 
    29 /** @addtogroup debug
    30  * @{
    31  */
    32 /** @file
    33  */
    34 
    35 #ifndef LIBC_ia32__ISTATE_H_
    36 #define LIBC_ia32__ISTATE_H_
    37 
    38 #include <arch/istate.h>
    39 
    40 #endif
    41 
    42 /** @}
    43  */
     1../../../../../../kernel/arch/ia32/include/istate.h
  • uspace/lib/c/arch/ia32/include/syscall.h

    r867e2555 r925a21e  
    3838
    3939#include <sys/types.h>
    40 #include <kernel/syscall/syscall.h>
     40#include <abi/syscall.h>
    4141
    4242#define __syscall0  __syscall_fast_func
  • uspace/lib/c/arch/ia32/include/types.h

    r867e2555 r925a21e  
    5252
    5353typedef uint32_t uintptr_t;
     54typedef int32_t intptr_t;
    5455typedef uint32_t atomic_count_t;
    5556typedef int32_t atomic_signed_t;
  • uspace/lib/c/arch/ia32/src/entry.S

    r867e2555 r925a21e  
    4747        # Do not set %gs, it contains descriptor that can see TLS
    4848       
     49#ifndef PROCESSOR_i486 
    4950        # Detect the mechanism used for making syscalls
    5051        movl $(INTEL_CPUID_STANDARD), %eax
     
    5253        bt $(INTEL_SEP), %edx
    5354        jnc 0f
    54         leal __syscall_fast_func, %eax
    55         movl $__syscall_fast, (%eax)
    56 0:
     55                leal __syscall_fast_func, %eax
     56                movl $__syscall_fast, (%eax)
     57        0:
     58#endif
     59       
    5760        #
    5861        # Create the first stack frame.
  • uspace/lib/c/arch/ia32/src/fibril.S

    r867e2555 r925a21e  
    2727#
    2828
    29 #include <kernel/arch/context_offset.h>
     29#include <libarch/context_offset.h>
    3030
    3131.text
  • uspace/lib/c/arch/ia32/src/setjmp.S

    r867e2555 r925a21e  
    2727#
    2828
    29 #include <kernel/arch/context_offset.h>
     29#include <libarch/context_offset.h>
    3030
    3131.text
  • uspace/lib/c/arch/ia64/include/istate.h

    • Property mode changed from 100644 to 120000
    r867e2555 r925a21e  
    1 /*
    2  * Copyright (c) 2010 Jiri Svoboda
    3  * All rights reserved.
    4  *
    5  * Redistribution and use in source and binary forms, with or without
    6  * modification, are permitted provided that the following conditions
    7  * are met:
    8  *
    9  * - Redistributions of source code must retain the above copyright
    10  *   notice, this list of conditions and the following disclaimer.
    11  * - Redistributions in binary form must reproduce the above copyright
    12  *   notice, this list of conditions and the following disclaimer in the
    13  *   documentation and/or other materials provided with the distribution.
    14  * - The name of the author may not be used to endorse or promote products
    15  *   derived from this software without specific prior written permission.
    16  *
    17  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
    18  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
    19  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
    20  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
    21  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
    22  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
    23  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
    24  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    25  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
    26  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    27  */
    28 
    29 /** @addtogroup libcsparc64
    30  * @{
    31  */
    32 /** @file
    33  */
    34 
    35 #ifndef LIBC_ia64_ISTATE_H_
    36 #define LIBC_ia64_ISTATE_H_
    37 
    38 #include <arch/istate.h>
    39 
    40 #endif
    41 
    42 /** @}
    43  */
     1../../../../../../kernel/arch/ia64/include/istate.h
  • uspace/lib/c/arch/ia64/include/types.h

    r867e2555 r925a21e  
    6262
    6363typedef uint64_t uintptr_t;
     64typedef int64_t intptr_t;
    6465typedef uint64_t atomic_count_t;
    6566typedef int64_t atomic_signed_t;
  • uspace/lib/c/arch/mips32/include/elf_linux.h

    r867e2555 r925a21e  
    3030 * @{
    3131 */
    32 /** @file
     32/** @file Definitions needed to write core files in Linux-ELF format.
    3333 */
    3434
     
    3939#include <sys/types.h>
    4040
     41/** Linux kernel struct pt_regs structure.
     42 *
     43 * We need this to save register state to a core file in Linux format
     44 * (readable by GDB configured for Linux target).
     45 */
    4146typedef struct {
    42         /* TODO */
    43         uint32_t pad[16];
     47        uint32_t pad0[6];
     48
     49        uint32_t r0;
     50        uint32_t r1;
     51        uint32_t r2;
     52        uint32_t r3;
     53        uint32_t r4;
     54        uint32_t r5;
     55        uint32_t r6;
     56        uint32_t r7;
     57        uint32_t r8;
     58        uint32_t r9;
     59        uint32_t r10;
     60        uint32_t r11;
     61        uint32_t r12;
     62        uint32_t r13;
     63        uint32_t r14;
     64        uint32_t r15;
     65        uint32_t r16;
     66        uint32_t r17;
     67        uint32_t r18;
     68        uint32_t r19;
     69        uint32_t r20;
     70        uint32_t r21;
     71        uint32_t r22;
     72        uint32_t r23;
     73        uint32_t r24;
     74        uint32_t r25;
     75        uint32_t r26;
     76        uint32_t r27;
     77        uint32_t r28;
     78        uint32_t r29;
     79        uint32_t r30;
     80        uint32_t r31;
     81
     82        uint32_t cp0_status;
     83        uint32_t hi;
     84        uint32_t lo;
     85        uint32_t cp0_badvaddr;
     86        uint32_t cp0_cause;
     87        uint32_t cp0_epc;
    4488} elf_regs_t;
    4589
     90/** Convert istate_t to elf_regs_t. */
    4691static inline void istate_to_elf_regs(istate_t *istate, elf_regs_t *elf_regs)
    4792{
    48         /* TODO */
    49         (void) istate; (void) elf_regs;
     93        elf_regs->r1 = istate->at;
     94        elf_regs->r2 = istate->v0;
     95        elf_regs->r3 = istate->v1;
     96        elf_regs->r4 = istate->a0;
     97        elf_regs->r5 = istate->a1;
     98        elf_regs->r6 = istate->a2;
     99        elf_regs->r7 = istate->a3;
     100        elf_regs->r8 = istate->t0;
     101        elf_regs->r9 = istate->t1;
     102        elf_regs->r10 = istate->t2;
     103        elf_regs->r11 = istate->t3;
     104        elf_regs->r12 = istate->t4;
     105        elf_regs->r13 = istate->t5;
     106        elf_regs->r14 = istate->t6;
     107        elf_regs->r15 = istate->t7;
     108        elf_regs->r16 = istate->s0;
     109        elf_regs->r17 = istate->s1;
     110        elf_regs->r18 = istate->s2;
     111        elf_regs->r19 = istate->s3;
     112        elf_regs->r20 = istate->s4;
     113        elf_regs->r21 = istate->s5;
     114        elf_regs->r22 = istate->s6;
     115        elf_regs->r23 = istate->s7;
     116        elf_regs->r24 = istate->t8;
     117        elf_regs->r25 = istate->t9;
     118        elf_regs->r26 = istate->kt0;
     119        elf_regs->r27 = istate->kt1;
     120        elf_regs->r28 = istate->gp;
     121        elf_regs->r29 = istate->sp;
     122        elf_regs->r30 = istate->s8;
     123        elf_regs->r31 = istate->ra;
     124
     125        elf_regs->cp0_status = istate->status;
     126        elf_regs->hi = istate->hi;
     127        elf_regs->lo = istate->lo;
     128        elf_regs->cp0_epc = istate->epc;
    50129}
    51130
  • uspace/lib/c/arch/mips32/include/istate.h

    • Property mode changed from 100644 to 120000
    r867e2555 r925a21e  
    1 /*
    2  * Copyright (c) 2010 Jiri Svoboda
    3  * All rights reserved.
    4  *
    5  * Redistribution and use in source and binary forms, with or without
    6  * modification, are permitted provided that the following conditions
    7  * are met:
    8  *
    9  * - Redistributions of source code must retain the above copyright
    10  *   notice, this list of conditions and the following disclaimer.
    11  * - Redistributions in binary form must reproduce the above copyright
    12  *   notice, this list of conditions and the following disclaimer in the
    13  *   documentation and/or other materials provided with the distribution.
    14  * - The name of the author may not be used to endorse or promote products
    15  *   derived from this software without specific prior written permission.
    16  *
    17  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
    18  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
    19  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
    20  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
    21  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
    22  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
    23  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
    24  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    25  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
    26  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    27  */
    28 
    29 /** @addtogroup libcmips32
    30  * @{
    31  */
    32 /** @file
    33  */
    34 
    35 #ifndef LIBC_mips32__ISTATE_H_
    36 #define LIBC_mips32__ISTATE_H_
    37 
    38 #include <arch/istate.h>
    39 
    40 #endif
    41 
    42 /** @}
    43  */
     1../../../../../../kernel/arch/mips32/include/istate.h
  • uspace/lib/c/arch/mips32/include/types.h

    r867e2555 r925a21e  
    5353
    5454typedef uint32_t uintptr_t;
     55typedef int32_t intptr_t;
    5556typedef uint32_t atomic_count_t;
    5657typedef int32_t atomic_signed_t;
  • uspace/lib/c/arch/mips32/src/fibril.S

    r867e2555 r925a21e  
    3232.set noreorder
    3333
    34 #include <arch/context_offset.h>
     34#include <libarch/context_offset.h>
    3535       
    3636.global context_save
  • uspace/lib/c/arch/mips64/include/istate.h

    • Property mode changed from 100644 to 120000
    r867e2555 r925a21e  
    1 /*
    2  * Copyright (c) 2010 Jiri Svoboda
    3  * All rights reserved.
    4  *
    5  * Redistribution and use in source and binary forms, with or without
    6  * modification, are permitted provided that the following conditions
    7  * are met:
    8  *
    9  * - Redistributions of source code must retain the above copyright
    10  *   notice, this list of conditions and the following disclaimer.
    11  * - Redistributions in binary form must reproduce the above copyright
    12  *   notice, this list of conditions and the following disclaimer in the
    13  *   documentation and/or other materials provided with the distribution.
    14  * - The name of the author may not be used to endorse or promote products
    15  *   derived from this software without specific prior written permission.
    16  *
    17  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
    18  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
    19  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
    20  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
    21  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
    22  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
    23  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
    24  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    25  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
    26  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    27  */
    28 
    29 /** @addtogroup libcmips64
    30  * @{
    31  */
    32 /** @file
    33  */
    34 
    35 #ifndef LIBC_mips64__ISTATE_H_
    36 #define LIBC_mips64__ISTATE_H_
    37 
    38 #include <arch/istate.h>
    39 
    40 #endif
    41 
    42 /** @}
    43  */
     1../../../../../../kernel/arch/mips64/include/istate.h
  • uspace/lib/c/arch/mips64/include/types.h

    r867e2555 r925a21e  
    5353
    5454typedef uint64_t uintptr_t;
     55typedef int64_t intptr_t;
    5556typedef uint64_t atomic_count_t;
    5657typedef int64_t atomic_signed_t;
  • uspace/lib/c/arch/mips64/src/fibril.S

    r867e2555 r925a21e  
    3232.set noreorder
    3333
    34 #include <arch/context_offset.h>
     34#include <libarch/context_offset.h>
    3535
    3636.global context_save
  • uspace/lib/c/arch/ppc32/include/elf_linux.h

    r867e2555 r925a21e  
    3030 * @{
    3131 */
    32 /** @file
     32/** @file Definitions needed to write core files in Linux-ELF format.
    3333 */
    3434
     
    3939#include <sys/types.h>
    4040
     41/** Linux kernel struct pt_regs structure.
     42 *
     43 * We need this to save register state to a core file in Linux format
     44 * (readable by GDB configured for Linux target).
     45 */
    4146typedef struct {
    42         /* TODO */
    43         uint32_t pad[16];
     47        uint32_t r0;
     48        uint32_t r1;
     49        uint32_t r2;
     50        uint32_t r3;
     51        uint32_t r4;
     52        uint32_t r5;
     53        uint32_t r6;
     54        uint32_t r7;
     55        uint32_t r8;
     56        uint32_t r9;
     57        uint32_t r10;
     58        uint32_t r11;
     59        uint32_t r12;
     60        uint32_t r13;
     61        uint32_t r14;
     62        uint32_t r15;
     63        uint32_t r16;
     64        uint32_t r17;
     65        uint32_t r18;
     66        uint32_t r19;
     67        uint32_t r20;
     68        uint32_t r21;
     69        uint32_t r22;
     70        uint32_t r23;
     71        uint32_t r24;
     72        uint32_t r25;
     73        uint32_t r26;
     74        uint32_t r27;
     75        uint32_t r28;
     76        uint32_t r29;
     77        uint32_t r30;
     78        uint32_t r31;
     79
     80        uint32_t nip;
     81        uint32_t msr;
     82        uint32_t old_r3;
     83        uint32_t ctr;
     84        uint32_t link;
     85        uint32_t xer;
     86        uint32_t ccr;
     87        uint32_t mq;
     88        uint32_t trap;
     89        uint32_t dar;
     90        uint32_t dsisr;
     91        uint32_t result;
    4492} elf_regs_t;
    4593
     94/** Convert istate_t to elf_regs_t. */
    4695static inline void istate_to_elf_regs(istate_t *istate, elf_regs_t *elf_regs)
    4796{
    48         /* TODO */
    49         (void) istate; (void) elf_regs;
     97        elf_regs->r0 = istate->r0;
     98        elf_regs->r1 = istate->sp;
     99        elf_regs->r2 = istate->r2;
     100        elf_regs->r3 = istate->r3;
     101        elf_regs->r4 = istate->r4;
     102        elf_regs->r5 = istate->r5;
     103        elf_regs->r6 = istate->r6;
     104        elf_regs->r7 = istate->r7;
     105        elf_regs->r8 = istate->r8;
     106        elf_regs->r9 = istate->r9;
     107        elf_regs->r10 = istate->r10;
     108        elf_regs->r11 = istate->r11;
     109        elf_regs->r12 = istate->r12;
     110        elf_regs->r13 = istate->r13;
     111        elf_regs->r14 = istate->r14;
     112        elf_regs->r15 = istate->r15;
     113        elf_regs->r16 = istate->r16;
     114        elf_regs->r17 = istate->r17;
     115        elf_regs->r18 = istate->r18;
     116        elf_regs->r19 = istate->r19;
     117        elf_regs->r20 = istate->r20;
     118        elf_regs->r21 = istate->r21;
     119        elf_regs->r22 = istate->r22;
     120        elf_regs->r23 = istate->r23;
     121        elf_regs->r24 = istate->r24;
     122        elf_regs->r25 = istate->r25;
     123        elf_regs->r26 = istate->r26;
     124        elf_regs->r27 = istate->r27;
     125        elf_regs->r28 = istate->r28;
     126        elf_regs->r29 = istate->r29;
     127        elf_regs->r30 = istate->r30;
     128        elf_regs->r31 = istate->r31;
     129
     130        elf_regs->ctr = istate->ctr;
     131        elf_regs->link = istate->lr;
     132        elf_regs->xer = istate->xer;
     133        elf_regs->ccr = istate->cr;
     134        elf_regs->dar = istate->dar;
    50135}
    51136
  • uspace/lib/c/arch/ppc32/include/istate.h

    • Property mode changed from 100644 to 120000
    r867e2555 r925a21e  
    1 /*
    2  * Copyright (c) 2010 Jiri Svoboda
    3  * All rights reserved.
    4  *
    5  * Redistribution and use in source and binary forms, with or without
    6  * modification, are permitted provided that the following conditions
    7  * are met:
    8  *
    9  * - Redistributions of source code must retain the above copyright
    10  *   notice, this list of conditions and the following disclaimer.
    11  * - Redistributions in binary form must reproduce the above copyright
    12  *   notice, this list of conditions and the following disclaimer in the
    13  *   documentation and/or other materials provided with the distribution.
    14  * - The name of the author may not be used to endorse or promote products
    15  *   derived from this software without specific prior written permission.
    16  *
    17  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
    18  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
    19  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
    20  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
    21  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
    22  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
    23  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
    24  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    25  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
    26  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    27  */
    28 
    29 /** @addtogroup libcppc32
    30  * @{
    31  */
    32 /** @file
    33  */
    34 
    35 #ifndef LIBC_ppc32_ISTATE_H_
    36 #define LIBC_ppc32_ISTATE_H_
    37 
    38 #include <sys/types.h>
    39 
    40 /** Interrupt context.
    41  *
    42  * This is a copy of the kernel definition with which it must be kept in sync.
    43  */
    44 typedef struct istate {
    45         uint32_t r0;
    46         uint32_t r2;
    47         uint32_t r3;
    48         uint32_t r4;
    49         uint32_t r5;
    50         uint32_t r6;
    51         uint32_t r7;
    52         uint32_t r8;
    53         uint32_t r9;
    54         uint32_t r10;
    55         uint32_t r11;
    56         uint32_t r13;
    57         uint32_t r14;
    58         uint32_t r15;
    59         uint32_t r16;
    60         uint32_t r17;
    61         uint32_t r18;
    62         uint32_t r19;
    63         uint32_t r20;
    64         uint32_t r21;
    65         uint32_t r22;
    66         uint32_t r23;
    67         uint32_t r24;
    68         uint32_t r25;
    69         uint32_t r26;
    70         uint32_t r27;
    71         uint32_t r28;
    72         uint32_t r29;
    73         uint32_t r30;
    74         uint32_t r31;
    75         uint32_t cr;
    76         uint32_t pc;
    77         uint32_t srr1;
    78         uint32_t lr;
    79         uint32_t ctr;
    80         uint32_t xer;
    81         uint32_t dar;
    82         uint32_t r12;
    83         uint32_t sp;
    84 } istate_t;
    85 
    86 static inline uintptr_t istate_get_pc(istate_t *istate)
    87 {
    88         return istate->pc;
    89 }
    90 
    91 static inline uintptr_t istate_get_fp(istate_t *istate)
    92 {
    93         return istate->sp;
    94 }
    95 
    96 #endif
    97 
    98 /** @}
    99  */
     1../../../../../../kernel/arch/ppc32/include/istate.h
  • uspace/lib/c/arch/ppc32/include/types.h

    r867e2555 r925a21e  
    5252
    5353typedef uint32_t uintptr_t;
     54typedef int32_t intptr_t;
    5455typedef uint32_t atomic_count_t;
    5556typedef int32_t atomic_signed_t;
  • uspace/lib/c/arch/ppc32/src/fibril.S

    r867e2555 r925a21e  
    3333
    3434#include <libarch/regname.h>
    35 #include <arch/context_offset.h>
     35#include <libarch/context_offset.h>
    3636
    3737context_save:
  • uspace/lib/c/arch/sparc64/include/istate.h

    • Property mode changed from 100644 to 120000
    r867e2555 r925a21e  
    1 /*
    2  * Copyright (c) 2010 Jiri Svoboda
    3  * All rights reserved.
    4  *
    5  * Redistribution and use in source and binary forms, with or without
    6  * modification, are permitted provided that the following conditions
    7  * are met:
    8  *
    9  * - Redistributions of source code must retain the above copyright
    10  *   notice, this list of conditions and the following disclaimer.
    11  * - Redistributions in binary form must reproduce the above copyright
    12  *   notice, this list of conditions and the following disclaimer in the
    13  *   documentation and/or other materials provided with the distribution.
    14  * - The name of the author may not be used to endorse or promote products
    15  *   derived from this software without specific prior written permission.
    16  *
    17  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
    18  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
    19  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
    20  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
    21  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
    22  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
    23  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
    24  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    25  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
    26  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    27  */
    28 
    29 /** @addtogroup libcsparc64
    30  * @{
    31  */
    32 /** @file
    33  */
    34 
    35 #ifndef LIBC_sparc64_ISTATE_H_
    36 #define LIBC_sparc64_ISTATE_H_
    37 
    38 #include <arch/istate.h>
    39 
    40 #endif
    41 
    42 /** @}
    43  */
     1../../../../../../kernel/arch/sparc64/include/istate.h
  • uspace/lib/c/arch/sparc64/include/syscall.h

    r867e2555 r925a21e  
    3737
    3838#include <sys/types.h>
    39 #include <kernel/syscall/syscall.h>
     39#include <abi/syscall.h>
    4040
    4141#define __syscall0      __syscall
  • uspace/lib/c/arch/sparc64/include/types.h

    r867e2555 r925a21e  
    5252
    5353typedef uint64_t uintptr_t;
     54typedef int64_t intptr_t;
    5455typedef uint64_t atomic_count_t;
    5556typedef int64_t atomic_signed_t;
  • uspace/lib/c/arch/sparc64/src/fibril.S

    r867e2555 r925a21e  
    2727#
    2828
    29 #include <kernel/arch/context_offset.h>
     29#include <libarch/context_offset.h>
    3030
    31 .text   
     31.text
    3232
    3333.global context_save
  • uspace/lib/c/generic/adt/hash_table.c

    r867e2555 r925a21e  
    152152       
    153153        if (keys == h->max_keys) {
    154                 link_t *cur;
    155                
    156154                /*
    157155                 * All keys are known, hash_table_find() can be used to find the
     
    159157                 */
    160158               
    161                 cur = hash_table_find(h, key);
     159                link_t *cur = hash_table_find(h, key);
    162160                if (cur) {
    163161                        list_remove(cur);
     
    174172        hash_index_t chain;
    175173        for (chain = 0; chain < h->entries; chain++) {
    176                 link_t *cur;
    177                
    178                 for (cur = h->entry[chain].head.next; cur != &h->entry[chain].head;
     174                for (link_t *cur = h->entry[chain].head.next;
     175                    cur != &h->entry[chain].head;
    179176                    cur = cur->next) {
    180177                        if (h->op->compare(key, keys, cur)) {
     
    193190}
    194191
    195 /** Apply fucntion to all items in hash table.
     192/** Apply function to all items in hash table.
    196193 *
    197194 * @param h   Hash table.
  • uspace/lib/c/generic/adt/list.c

    r867e2555 r925a21e  
    3333/**
    3434 * @file
    35  * @brief       Functions completing doubly linked circular list implementaion.
     35 * @brief       Functions completing doubly linked circular list implementation.
    3636 *
    3737 * This file contains some of the functions implementing doubly linked circular lists.
     
    5050 * @param list  List to look in.
    5151 *
    52  * @return true if link is contained in head, false otherwise.
     52 * @return true if link is contained in list, false otherwise.
    5353 *
    5454 */
  • uspace/lib/c/generic/as.c

    r867e2555 r925a21e  
    123123 * @retval ENOENT Mapping not found.
    124124 */
    125 int as_get_physical_mapping(void *address, uintptr_t *frame)
     125int as_get_physical_mapping(const void *address, uintptr_t *frame)
    126126{
    127127        uintptr_t tmp_frame;
  • uspace/lib/c/generic/async.c

    r867e2555 r925a21e  
    9898#include <ipc/ipc.h>
    9999#include <async.h>
     100#include "private/async.h"
    100101#undef LIBC_ASYNC_C_
    101102
     
    107108#include <errno.h>
    108109#include <sys/time.h>
    109 #include <arch/barrier.h>
     110#include <libarch/barrier.h>
    110111#include <bool.h>
    111112#include <malloc.h>
    112113#include <mem.h>
    113114#include <stdlib.h>
    114 #include "private/async.h"
     115#include <macros.h>
    115116
    116117#define CLIENT_HASH_TABLE_BUCKETS  32
    117118#define CONN_HASH_TABLE_BUCKETS    32
     119
     120/** Session data */
     121struct async_sess {
     122        /** List of inactive exchanges */
     123        list_t exch_list;
     124       
     125        /** Exchange management style */
     126        exch_mgmt_t mgmt;
     127       
     128        /** Session identification */
     129        int phone;
     130       
     131        /** First clone connection argument */
     132        sysarg_t arg1;
     133       
     134        /** Second clone connection argument */
     135        sysarg_t arg2;
     136       
     137        /** Third clone connection argument */
     138        sysarg_t arg3;
     139       
     140        /** Exchange mutex */
     141        fibril_mutex_t mutex;
     142       
     143        /** Number of opened exchanges */
     144        atomic_t refcnt;
     145       
     146        /** Mutex for stateful connections */
     147        fibril_mutex_t remote_state_mtx;
     148       
     149        /** Data for stateful connections */
     150        void *remote_state_data;
     151};
     152
     153/** Exchange data */
     154struct async_exch {
     155        /** Link into list of inactive exchanges */
     156        link_t sess_link;
     157       
     158        /** Link into global list of inactive exchanges */
     159        link_t global_link;
     160       
     161        /** Session pointer */
     162        async_sess_t *sess;
     163       
     164        /** Exchange identification */
     165        int phone;
     166};
    118167
    119168/** Async framework global futex */
     
    134183} msg_t;
    135184
     185/** Message data */
     186typedef struct {
     187        awaiter_t wdata;
     188       
     189        /** If reply was received. */
     190        bool done;
     191       
     192        /** Pointer to where the answer data is stored. */
     193        ipc_call_t *dataptr;
     194       
     195        sysarg_t retval;
     196} amsg_t;
     197
    136198/* Client connection data */
    137199typedef struct {
    138200        link_t link;
    139201       
    140         sysarg_t in_task_hash;
     202        task_id_t in_task_id;
    141203        atomic_t refcnt;
    142204        void *data;
     
    150212        link_t link;
    151213       
    152         /** Incoming client task hash. */
    153         sysarg_t in_task_hash;
     214        /** Incoming client task ID. */
     215        task_id_t in_task_id;
    154216       
    155217        /** Incoming phone hash. */
     
    203265}
    204266
    205 void *async_get_client_data(void)
    206 {
    207         assert(fibril_connection);
    208         return fibril_connection->client->data;
    209 }
    210 
    211267/** Default fibril function that gets called to handle new connection.
    212268 *
     
    289345{
    290346        assert(key);
     347        assert(keys == 2);
    291348        assert(item);
    292349       
    293350        client_t *client = hash_table_get_instance(item, client_t, link);
    294         return (key[0] == client->in_task_hash);
     351        return (key[0] == LOWER32(client->in_task_id) &&
     352            (key[1] == UPPER32(client->in_task_id)));
    295353}
    296354
     
    580638}
    581639
     640static client_t *async_client_get(task_id_t client_id, bool create)
     641{
     642        unsigned long key[2] = {
     643                LOWER32(client_id),
     644                UPPER32(client_id),
     645        };
     646        client_t *client = NULL;
     647
     648        futex_down(&async_futex);
     649        link_t *lnk = hash_table_find(&client_hash_table, key);
     650        if (lnk) {
     651                client = hash_table_get_instance(lnk, client_t, link);
     652                atomic_inc(&client->refcnt);
     653        } else if (create) {
     654                client = malloc(sizeof(client_t));
     655                if (client) {
     656                        client->in_task_id = client_id;
     657                        client->data = async_client_data_create();
     658               
     659                        atomic_set(&client->refcnt, 1);
     660                        hash_table_insert(&client_hash_table, key, &client->link);
     661                }
     662        }
     663
     664        futex_up(&async_futex);
     665        return client;
     666}
     667
     668static void async_client_put(client_t *client)
     669{
     670        bool destroy;
     671        unsigned long key[2] = {
     672                LOWER32(client->in_task_id),
     673                UPPER32(client->in_task_id)
     674        };
     675       
     676        futex_down(&async_futex);
     677       
     678        if (atomic_predec(&client->refcnt) == 0) {
     679                hash_table_remove(&client_hash_table, key, 2);
     680                destroy = true;
     681        } else
     682                destroy = false;
     683       
     684        futex_up(&async_futex);
     685       
     686        if (destroy) {
     687                if (client->data)
     688                        async_client_data_destroy(client->data);
     689               
     690                free(client);
     691        }
     692}
     693
     694void *async_get_client_data(void)
     695{
     696        assert(fibril_connection);
     697        return fibril_connection->client->data;
     698}
     699
     700void *async_get_client_data_by_id(task_id_t client_id)
     701{
     702        client_t *client = async_client_get(client_id, false);
     703        if (!client)
     704                return NULL;
     705        if (!client->data) {
     706                async_client_put(client);
     707                return NULL;
     708        }
     709
     710        return client->data;
     711}
     712
     713void async_put_client_data_by_id(task_id_t client_id)
     714{
     715        client_t *client = async_client_get(client_id, false);
     716
     717        assert(client);
     718        assert(client->data);
     719
     720        /* Drop the reference we got in async_get_client_data_by_hash(). */
     721        async_client_put(client);
     722
     723        /* Drop our own reference we got at the beginning of this function. */
     724        async_client_put(client);
     725}
     726
    582727/** Wrapper for client connection fibril.
    583728 *
     
    598743         */
    599744        fibril_connection = (connection_t *) arg;
    600        
    601         futex_down(&async_futex);
    602745       
    603746        /*
     
    606749         * hash in a new tracking structure.
    607750         */
    608        
    609         unsigned long key = fibril_connection->in_task_hash;
    610         link_t *lnk = hash_table_find(&client_hash_table, &key);
    611        
    612         client_t *client;
    613        
    614         if (lnk) {
    615                 client = hash_table_get_instance(lnk, client_t, link);
    616                 atomic_inc(&client->refcnt);
    617         } else {
    618                 client = malloc(sizeof(client_t));
    619                 if (!client) {
    620                         ipc_answer_0(fibril_connection->callid, ENOMEM);
    621                         futex_up(&async_futex);
    622                         return 0;
    623                 }
    624                
    625                 client->in_task_hash = fibril_connection->in_task_hash;
    626                 client->data = async_client_data_create();
    627                
    628                 atomic_set(&client->refcnt, 1);
    629                 hash_table_insert(&client_hash_table, &key, &client->link);
    630         }
    631        
    632         futex_up(&async_futex);
    633        
     751
     752        client_t *client = async_client_get(fibril_connection->in_task_id, true);
     753        if (!client) {
     754                ipc_answer_0(fibril_connection->callid, ENOMEM);
     755                return 0;
     756        }
     757
    634758        fibril_connection->client = client;
    635759       
     
    643767         * Remove the reference for this client task connection.
    644768         */
    645         bool destroy;
    646        
    647         futex_down(&async_futex);
    648        
    649         if (atomic_predec(&client->refcnt) == 0) {
    650                 hash_table_remove(&client_hash_table, &key, 1);
    651                 destroy = true;
    652         } else
    653                 destroy = false;
    654        
    655         futex_up(&async_futex);
    656        
    657         if (destroy) {
    658                 if (client->data)
    659                         async_client_data_destroy(client->data);
    660                
    661                 free(client);
    662         }
     769        async_client_put(client);
    663770       
    664771        /*
     
    666773         */
    667774        futex_down(&async_futex);
    668         key = fibril_connection->in_phone_hash;
     775        unsigned long key = fibril_connection->in_phone_hash;
    669776        hash_table_remove(&conn_hash_table, &key, 1);
    670777        futex_up(&async_futex);
     
    700807 * particular fibrils.
    701808 *
    702  * @param in_task_hash  Identification of the incoming connection.
     809 * @param in_task_id    Identification of the incoming connection.
    703810 * @param in_phone_hash Identification of the incoming connection.
    704811 * @param callid        Hash of the opening IPC_M_CONNECT_ME_TO call.
     
    714821 *
    715822 */
    716 fid_t async_new_connection(sysarg_t in_task_hash, sysarg_t in_phone_hash,
     823fid_t async_new_connection(task_id_t in_task_id, sysarg_t in_phone_hash,
    717824    ipc_callid_t callid, ipc_call_t *call,
    718825    async_client_conn_t cfibril, void *carg)
     
    726833        }
    727834       
    728         conn->in_task_hash = in_task_hash;
     835        conn->in_task_id = in_task_id;
    729836        conn->in_phone_hash = in_phone_hash;
    730837        list_initialize(&conn->msg_queue);
     
    785892        case IPC_M_CONNECT_ME_TO:
    786893                /* Open new connection with fibril, etc. */
    787                 async_new_connection(call->in_task_hash, IPC_GET_ARG5(*call),
     894                async_new_connection(call->in_task_id, IPC_GET_ARG5(*call),
    788895                    callid, call, client_connection, NULL);
    789896                return;
     
    9331040{
    9341041        if (!hash_table_create(&client_hash_table, CLIENT_HASH_TABLE_BUCKETS,
    935             1, &client_hash_table_ops))
     1042            2, &client_hash_table_ops))
    9361043                abort();
    9371044       
     
    9491056        session_ns->arg2 = 0;
    9501057        session_ns->arg3 = 0;
     1058       
     1059        fibril_mutex_initialize(&session_ns->remote_state_mtx);
     1060        session_ns->remote_state_data = NULL;
    9511061       
    9521062        list_initialize(&session_ns->exch_list);
     
    14261536                return ENOENT;
    14271537       
    1428         sysarg_t task_hash;
    14291538        sysarg_t phone_hash;
    1430         int rc = async_req_3_5(exch, IPC_M_CONNECT_TO_ME, arg1, arg2, arg3,
    1431             NULL, NULL, NULL, &task_hash, &phone_hash);
     1539        sysarg_t rc;
     1540
     1541        aid_t req;
     1542        ipc_call_t answer;
     1543        req = async_send_3(exch, IPC_M_CONNECT_TO_ME, arg1, arg2, arg3,
     1544            &answer);
     1545        async_wait_for(req, &rc);
    14321546        if (rc != EOK)
    1433                 return rc;
    1434        
     1547                return (int) rc;
     1548
     1549        phone_hash = IPC_GET_ARG5(answer);
     1550
    14351551        if (client_receiver != NULL)
    1436                 async_new_connection(task_hash, phone_hash, 0, NULL,
     1552                async_new_connection(answer.in_task_id, phone_hash, 0, NULL,
    14371553                    client_receiver, carg);
    14381554       
     
    15091625        sess->arg3 = 0;
    15101626       
     1627        fibril_mutex_initialize(&sess->remote_state_mtx);
     1628        sess->remote_state_data = NULL;
     1629       
    15111630        list_initialize(&sess->exch_list);
    15121631        fibril_mutex_initialize(&sess->mutex);
     
    15901709        sess->arg3 = arg3;
    15911710       
     1711        fibril_mutex_initialize(&sess->remote_state_mtx);
     1712        sess->remote_state_data = NULL;
     1713       
    15921714        list_initialize(&sess->exch_list);
    15931715        fibril_mutex_initialize(&sess->mutex);
     
    15951717       
    15961718        return sess;
     1719}
     1720
     1721/** Set arguments for new connections.
     1722 *
     1723 * FIXME This is an ugly hack to work around the problem that parallel
     1724 * exchanges are implemented using parallel connections. When we create
     1725 * a callback session, the framework does not know arguments for the new
     1726 * connections.
     1727 *
     1728 * The proper solution seems to be to implement parallel exchanges using
     1729 * tagging.
     1730 */
     1731void async_sess_args_set(async_sess_t *sess, sysarg_t arg1, sysarg_t arg2,
     1732    sysarg_t arg3)
     1733{
     1734        sess->arg1 = arg1;
     1735        sess->arg2 = arg2;
     1736        sess->arg3 = arg3;
    15971737}
    15981738
     
    16401780        sess->arg3 = arg3;
    16411781       
     1782        fibril_mutex_initialize(&sess->remote_state_mtx);
     1783        sess->remote_state_data = NULL;
     1784       
    16421785        list_initialize(&sess->exch_list);
    16431786        fibril_mutex_initialize(&sess->mutex);
     
    16711814        sess->arg3 = 0;
    16721815       
     1816        fibril_mutex_initialize(&sess->remote_state_mtx);
     1817        sess->remote_state_data = NULL;
     1818       
    16731819        list_initialize(&sess->exch_list);
    16741820        fibril_mutex_initialize(&sess->mutex);
     
    16921838int async_hangup(async_sess_t *sess)
    16931839{
     1840        async_exch_t *exch;
     1841       
    16941842        assert(sess);
    16951843       
    16961844        if (atomic_get(&sess->refcnt) > 0)
    16971845                return EBUSY;
     1846       
     1847        fibril_mutex_lock(&async_sess_mutex);
    16981848       
    16991849        int rc = async_hangup_internal(sess->phone);
    17001850        if (rc == EOK)
    17011851                free(sess);
     1852       
     1853        while (!list_empty(&sess->exch_list)) {
     1854                exch = (async_exch_t *)
     1855                    list_get_instance(list_first(&sess->exch_list),
     1856                    async_exch_t, sess_link);
     1857               
     1858                list_remove(&exch->sess_link);
     1859                list_remove(&exch->global_link);
     1860                async_hangup_internal(exch->phone);
     1861                free(exch);
     1862        }
     1863       
     1864        fibril_mutex_unlock(&async_sess_mutex);
    17021865       
    17031866        return rc;
     
    23342497        sess->arg3 = 0;
    23352498       
     2499        fibril_mutex_initialize(&sess->remote_state_mtx);
     2500        sess->remote_state_data = NULL;
     2501       
    23362502        list_initialize(&sess->exch_list);
    23372503        fibril_mutex_initialize(&sess->mutex);
     
    23802546        sess->arg3 = 0;
    23812547       
     2548        fibril_mutex_initialize(&sess->remote_state_mtx);
     2549        sess->remote_state_data = NULL;
     2550       
    23822551        list_initialize(&sess->exch_list);
    23832552        fibril_mutex_initialize(&sess->mutex);
     
    24222591        sess->arg3 = 0;
    24232592       
     2593        fibril_mutex_initialize(&sess->remote_state_mtx);
     2594        sess->remote_state_data = NULL;
     2595       
    24242596        list_initialize(&sess->exch_list);
    24252597        fibril_mutex_initialize(&sess->mutex);
     
    24292601}
    24302602
     2603int async_state_change_start(async_exch_t *exch, sysarg_t arg1, sysarg_t arg2,
     2604    sysarg_t arg3, async_exch_t *other_exch)
     2605{
     2606        return async_req_5_0(exch, IPC_M_STATE_CHANGE_AUTHORIZE,
     2607            arg1, arg2, arg3, 0, other_exch->phone);
     2608}
     2609
     2610bool async_state_change_receive(ipc_callid_t *callid, sysarg_t *arg1,
     2611    sysarg_t *arg2, sysarg_t *arg3)
     2612{
     2613        assert(callid);
     2614
     2615        ipc_call_t call;
     2616        *callid = async_get_call(&call);
     2617
     2618        if (IPC_GET_IMETHOD(call) != IPC_M_STATE_CHANGE_AUTHORIZE)
     2619                return false;
     2620       
     2621        if (arg1)
     2622                *arg1 = IPC_GET_ARG1(call);
     2623        if (arg2)
     2624                *arg2 = IPC_GET_ARG2(call);
     2625        if (arg3)
     2626                *arg3 = IPC_GET_ARG3(call);
     2627
     2628        return true;
     2629}
     2630
     2631int async_state_change_finalize(ipc_callid_t callid, async_exch_t *other_exch)
     2632{
     2633        return ipc_answer_1(callid, EOK, other_exch->phone);
     2634}
     2635
     2636/** Lock and get session remote state
     2637 *
     2638 * Lock and get the local replica of the remote state
     2639 * in stateful sessions. The call should be paired
     2640 * with async_remote_state_release*().
     2641 *
     2642 * @param[in] sess Stateful session.
     2643 *
     2644 * @return Local replica of the remote state.
     2645 *
     2646 */
     2647void *async_remote_state_acquire(async_sess_t *sess)
     2648{
     2649        fibril_mutex_lock(&sess->remote_state_mtx);
     2650        return sess->remote_state_data;
     2651}
     2652
     2653/** Update the session remote state
     2654 *
     2655 * Update the local replica of the remote state
     2656 * in stateful sessions. The remote state must
     2657 * be already locked.
     2658 *
     2659 * @param[in] sess  Stateful session.
     2660 * @param[in] state New local replica of the remote state.
     2661 *
     2662 */
     2663void async_remote_state_update(async_sess_t *sess, void *state)
     2664{
     2665        assert(fibril_mutex_is_locked(&sess->remote_state_mtx));
     2666        sess->remote_state_data = state;
     2667}
     2668
     2669/** Release the session remote state
     2670 *
     2671 * Unlock the local replica of the remote state
     2672 * in stateful sessions.
     2673 *
     2674 * @param[in] sess Stateful session.
     2675 *
     2676 */
     2677void async_remote_state_release(async_sess_t *sess)
     2678{
     2679        assert(fibril_mutex_is_locked(&sess->remote_state_mtx));
     2680       
     2681        fibril_mutex_unlock(&sess->remote_state_mtx);
     2682}
     2683
     2684/** Release the session remote state and end an exchange
     2685 *
     2686 * Unlock the local replica of the remote state
     2687 * in stateful sessions. This is convenience function
     2688 * which gets the session pointer from the exchange
     2689 * and also ends the exchange.
     2690 *
     2691 * @param[in] exch Stateful session's exchange.
     2692 *
     2693 */
     2694void async_remote_state_release_exchange(async_exch_t *exch)
     2695{
     2696        if (exch == NULL)
     2697                return;
     2698       
     2699        async_sess_t *sess = exch->sess;
     2700        assert(fibril_mutex_is_locked(&sess->remote_state_mtx));
     2701       
     2702        async_exchange_end(exch);
     2703        fibril_mutex_unlock(&sess->remote_state_mtx);
     2704}
     2705
    24312706/** @}
    24322707 */
  • uspace/lib/c/generic/ddi.c

    r867e2555 r925a21e  
    3131 */
    3232/** @file
    33  */ 
     33 */
    3434
     35#include <sys/types.h>
     36#include <abi/ddi/arg.h>
    3537#include <ddi.h>
    3638#include <libarch/ddi.h>
     
    4042#include <align.h>
    4143#include <libarch/config.h>
    42 #include <kernel/ddi/ddi_arg.h>
    4344
    4445/** Return unique device number.
  • uspace/lib/c/generic/devman.c

    r867e2555 r925a21e  
    11/*
    22 * Copyright (c) 2007 Josef Cejka
    3  * Copyright (c) 2009 Jiri Svoboda
     3 * Copyright (c) 2011 Jiri Svoboda
    44 * Copyright (c) 2010 Lenka Trochtova
    55 * All rights reserved.
     
    8989                        if (devman_driver_block_sess == NULL)
    9090                                devman_driver_block_sess =
    91                                     service_connect_blocking(EXCHANGE_SERIALIZE,
     91                                    service_connect_blocking(EXCHANGE_PARALLEL,
    9292                                    SERVICE_DEVMAN, DEVMAN_DRIVER, 0);
    9393                }
     
    138138                if (devman_driver_sess == NULL)
    139139                        devman_driver_sess =
    140                             service_connect(EXCHANGE_SERIALIZE, SERVICE_DEVMAN,
     140                            service_connect(EXCHANGE_PARALLEL, SERVICE_DEVMAN,
    141141                            DEVMAN_DRIVER, 0);
    142142               
     
    195195       
    196196        exch = devman_exchange_begin(DEVMAN_DRIVER);
    197         async_connect_to_me(exch, 0, 0, 0, NULL, NULL);
     197        async_connect_to_me(exch, 0, 0, 0, conn, NULL);
    198198        devman_exchange_end(exch);
    199199       
     
    271271}
    272272
    273 int devman_add_device_to_class(devman_handle_t devman_handle,
    274     const char *class_name)
     273int devman_add_device_to_category(devman_handle_t devman_handle,
     274    const char *cat_name)
    275275{
    276276        async_exch_t *exch = devman_exchange_begin_blocking(DEVMAN_DRIVER);
    277277       
    278278        ipc_call_t answer;
    279         aid_t req = async_send_1(exch, DEVMAN_ADD_DEVICE_TO_CLASS,
     279        aid_t req = async_send_1(exch, DEVMAN_ADD_DEVICE_TO_CATEGORY,
    280280            devman_handle, &answer);
    281         sysarg_t retval = async_data_write_start(exch, class_name,
    282             str_size(class_name));
     281        sysarg_t retval = async_data_write_start(exch, cat_name,
     282            str_size(cat_name));
    283283       
    284284        devman_exchange_end(exch);
     
    308308}
    309309
     310/** Remove function from device.
     311 *
     312 * Request devman to remove function owned by this driver task.
     313 * @param funh      Devman handle of the function
     314 *
     315 * @return EOK on success or negative error code.
     316 */
     317int devman_remove_function(devman_handle_t funh)
     318{
     319        async_exch_t *exch;
     320        sysarg_t retval;
     321       
     322        exch = devman_exchange_begin_blocking(DEVMAN_DRIVER);
     323        retval = async_req_1_0(exch, DEVMAN_REMOVE_FUNCTION, (sysarg_t) funh);
     324        devman_exchange_end(exch);
     325       
     326        return (int) retval;
     327}
     328
     329int devman_drv_fun_online(devman_handle_t funh)
     330{
     331        async_exch_t *exch = devman_exchange_begin(DEVMAN_DRIVER);
     332        if (exch == NULL)
     333                return ENOMEM;
     334       
     335        sysarg_t retval = async_req_1_0(exch, DEVMAN_DRV_FUN_ONLINE, funh);
     336       
     337        devman_exchange_end(exch);
     338        return (int) retval;
     339}
     340
     341int devman_drv_fun_offline(devman_handle_t funh)
     342{
     343        async_exch_t *exch = devman_exchange_begin(DEVMAN_DRIVER);
     344        if (exch == NULL)
     345                return ENOMEM;
     346       
     347        sysarg_t retval = async_req_1_0(exch, DEVMAN_DRV_FUN_OFFLINE, funh);
     348       
     349        devman_exchange_end(exch);
     350        return (int) retval;
     351}
     352
    310353async_sess_t *devman_parent_device_connect(exch_mgmt_t mgmt,
    311354    devman_handle_t handle, unsigned int flags)
     
    323366}
    324367
    325 int devman_device_get_handle(const char *pathname, devman_handle_t *handle,
     368int devman_fun_get_handle(const char *pathname, devman_handle_t *handle,
    326369    unsigned int flags)
    327370{
     
    333376                exch = devman_exchange_begin(DEVMAN_CLIENT);
    334377                if (exch == NULL)
    335                         return errno;
     378                        return ENOMEM;
    336379        }
    337380       
     
    364407}
    365408
    366 int devman_device_get_handle_by_class(const char *classname,
    367     const char *devname, devman_handle_t *handle, unsigned int flags)
     409static int devman_get_str_internal(sysarg_t method, sysarg_t arg1, char *buf,
     410    size_t buf_size)
    368411{
    369412        async_exch_t *exch;
    370        
    371         if (flags & IPC_FLAG_BLOCKING)
    372                 exch = devman_exchange_begin_blocking(DEVMAN_CLIENT);
    373         else {
    374                 exch = devman_exchange_begin(DEVMAN_CLIENT);
    375                 if (exch == NULL)
    376                         return errno;
    377         }
     413        ipc_call_t dreply;
     414        size_t act_size;
     415        sysarg_t dretval;
     416       
     417        exch = devman_exchange_begin_blocking(LOC_PORT_CONSUMER);
    378418       
    379419        ipc_call_t answer;
    380         aid_t req = async_send_1(exch, DEVMAN_DEVICE_GET_HANDLE_BY_CLASS,
    381             flags, &answer);
    382         sysarg_t retval = async_data_write_start(exch, classname,
    383             str_size(classname));
    384        
    385         if (retval != EOK) {
    386                 devman_exchange_end(exch);
     420        aid_t req = async_send_1(exch, method, arg1, &answer);
     421        aid_t dreq = async_data_read(exch, buf, buf_size - 1, &dreply);
     422        async_wait_for(dreq, &dretval);
     423       
     424        devman_exchange_end(exch);
     425       
     426        if (dretval != EOK) {
    387427                async_wait_for(req, NULL);
    388                 return retval;
    389         }
    390        
    391         retval = async_data_write_start(exch, devname,
    392             str_size(devname));
    393        
    394         devman_exchange_end(exch);
    395        
    396         if (retval != EOK) {
    397                 async_wait_for(req, NULL);
    398                 return retval;
    399         }
    400        
     428                return dretval;
     429        }
     430       
     431        sysarg_t retval;
    401432        async_wait_for(req, &retval);
    402433       
    403         if (retval != EOK) {
    404                 if (handle != NULL)
    405                         *handle = (devman_handle_t) -1;
    406                
    407                 return retval;
    408         }
    409        
    410         if (handle != NULL)
    411                 *handle = (devman_handle_t) IPC_GET_ARG1(answer);
    412        
    413         return retval;
    414 }
    415 
    416 int devman_get_device_path(devman_handle_t handle, char *path, size_t path_size)
     434        if (retval != EOK)
     435                return retval;
     436       
     437        act_size = IPC_GET_ARG2(dreply);
     438        assert(act_size <= buf_size - 1);
     439        buf[act_size] = '\0';
     440       
     441        return EOK;
     442}
     443
     444int devman_fun_get_path(devman_handle_t handle, char *buf, size_t buf_size)
     445{
     446        return devman_get_str_internal(DEVMAN_FUN_GET_PATH, handle, buf,
     447            buf_size);
     448}
     449
     450int devman_fun_get_name(devman_handle_t handle, char *buf, size_t buf_size)
     451{
     452        return devman_get_str_internal(DEVMAN_FUN_GET_NAME, handle, buf,
     453            buf_size);
     454}
     455
     456int devman_fun_online(devman_handle_t funh)
    417457{
    418458        async_exch_t *exch = devman_exchange_begin(DEVMAN_CLIENT);
    419459        if (exch == NULL)
    420                 return errno;
    421        
     460                return ENOMEM;
     461       
     462        sysarg_t retval = async_req_1_0(exch, DEVMAN_FUN_ONLINE, funh);
     463       
     464        devman_exchange_end(exch);
     465        return (int) retval;
     466}
     467
     468int devman_fun_offline(devman_handle_t funh)
     469{
     470        async_exch_t *exch = devman_exchange_begin(DEVMAN_CLIENT);
     471        if (exch == NULL)
     472                return ENOMEM;
     473       
     474        sysarg_t retval = async_req_1_0(exch, DEVMAN_FUN_OFFLINE, funh);
     475       
     476        devman_exchange_end(exch);
     477        return (int) retval;
     478}
     479
     480static int devman_get_handles_once(sysarg_t method, sysarg_t arg1,
     481    devman_handle_t *handle_buf, size_t buf_size, size_t *act_size)
     482{
     483        async_exch_t *exch = devman_exchange_begin_blocking(DEVMAN_CLIENT);
     484
    422485        ipc_call_t answer;
    423         aid_t req = async_send_1(exch, DEVMAN_DEVICE_GET_DEVICE_PATH,
    424             handle, &answer);
    425        
    426         ipc_call_t data_request_call;
    427         aid_t data_request = async_data_read(exch, path, path_size,
    428             &data_request_call);
    429        
    430         devman_exchange_end(exch);
    431        
    432         if (data_request == 0) {
     486        aid_t req = async_send_1(exch, method, arg1, &answer);
     487        int rc = async_data_read_start(exch, handle_buf, buf_size);
     488       
     489        devman_exchange_end(exch);
     490       
     491        if (rc != EOK) {
    433492                async_wait_for(req, NULL);
    434                 return ENOMEM;
    435         }
    436        
    437         sysarg_t data_request_rc;
    438         async_wait_for(data_request, &data_request_rc);
    439        
    440         sysarg_t opening_request_rc;
    441         async_wait_for(req, &opening_request_rc);
    442        
    443         if (data_request_rc != EOK) {
    444                 /* Prefer the return code of the opening request. */
    445                 if (opening_request_rc != EOK)
    446                         return (int) opening_request_rc;
    447                 else
    448                         return (int) data_request_rc;
    449         }
    450        
    451         if (opening_request_rc != EOK)
    452                 return (int) opening_request_rc;
    453        
    454         /* To be on the safe-side. */
    455         path[path_size - 1] = 0;
    456         size_t transferred_size = IPC_GET_ARG2(data_request_call);
    457         if (transferred_size >= path_size)
    458                 return ELIMIT;
    459        
    460         /* Terminate the string (trailing 0 not send over IPC). */
    461         path[transferred_size] = 0;
     493                return rc;
     494        }
     495       
     496        sysarg_t retval;
     497        async_wait_for(req, &retval);
     498       
     499        if (retval != EOK) {
     500                return retval;
     501        }
     502       
     503        *act_size = IPC_GET_ARG1(answer);
    462504        return EOK;
    463505}
    464506
     507/** Get list of handles.
     508 *
     509 * Returns an allocated array of handles.
     510 *
     511 * @param method        IPC method
     512 * @param arg1          IPC argument 1
     513 * @param data          Place to store pointer to array of handles
     514 * @param count         Place to store number of handles
     515 * @return              EOK on success or negative error code
     516 */
     517static int devman_get_handles_internal(sysarg_t method, sysarg_t arg1,
     518    devman_handle_t **data, size_t *count)
     519{
     520        devman_handle_t *handles;
     521        size_t act_size;
     522        size_t alloc_size;
     523        int rc;
     524
     525        *data = NULL;
     526        act_size = 0;   /* silence warning */
     527
     528        rc = devman_get_handles_once(method, arg1, NULL, 0,
     529            &act_size);
     530        if (rc != EOK)
     531                return rc;
     532
     533        alloc_size = act_size;
     534        handles = malloc(alloc_size);
     535        if (handles == NULL)
     536                return ENOMEM;
     537
     538        while (true) {
     539                rc = devman_get_handles_once(method, arg1, handles, alloc_size,
     540                    &act_size);
     541                if (rc != EOK)
     542                        return rc;
     543
     544                if (act_size <= alloc_size)
     545                        break;
     546
     547                alloc_size *= 2;
     548                free(handles);
     549
     550                handles = malloc(alloc_size);
     551                if (handles == NULL)
     552                        return ENOMEM;
     553        }
     554
     555        *count = act_size / sizeof(devman_handle_t);
     556        *data = handles;
     557        return EOK;
     558}
     559
     560int devman_fun_get_child(devman_handle_t funh, devman_handle_t *devh)
     561{
     562        async_exch_t *exch = devman_exchange_begin(DEVMAN_CLIENT);
     563        if (exch == NULL)
     564                return ENOMEM;
     565       
     566        sysarg_t retval = async_req_1_1(exch, DEVMAN_FUN_GET_CHILD,
     567            funh, devh);
     568       
     569        devman_exchange_end(exch);
     570        return (int) retval;
     571}
     572
     573int devman_dev_get_functions(devman_handle_t devh, devman_handle_t **funcs,
     574    size_t *count)
     575{
     576        return devman_get_handles_internal(DEVMAN_DEV_GET_FUNCTIONS,
     577            devh, funcs, count);
     578}
     579
     580int devman_fun_sid_to_handle(service_id_t sid, devman_handle_t *handle)
     581{
     582        async_exch_t *exch = devman_exchange_begin(DEVMAN_CLIENT);
     583        if (exch == NULL)
     584                return ENOMEM;
     585       
     586        sysarg_t retval = async_req_1_1(exch, DEVMAN_FUN_SID_TO_HANDLE,
     587            sid, handle);
     588       
     589        devman_exchange_end(exch);
     590        return (int) retval;
     591}
     592
    465593/** @}
    466594 */
  • uspace/lib/c/generic/event.c

    r867e2555 r925a21e  
    3939#include <libc.h>
    4040#include <event.h>
    41 #include <kernel/ipc/event_types.h>
    4241
    4342/** Subscribe event notifications.
     
    5049 */
    5150int event_subscribe(event_type_t evno, sysarg_t imethod)
     51{
     52        return __SYSCALL2(SYS_EVENT_SUBSCRIBE, (sysarg_t) evno,
     53            (sysarg_t) imethod);
     54}
     55
     56int event_task_subscribe(event_task_type_t evno, sysarg_t imethod)
    5257{
    5358        return __SYSCALL2(SYS_EVENT_SUBSCRIBE, (sysarg_t) evno,
     
    6772}
    6873
     74int event_task_unmask(event_task_type_t evno)
     75{
     76        return __SYSCALL1(SYS_EVENT_UNMASK, (sysarg_t) evno);
     77}
     78
    6979/** @}
    7080 */
  • uspace/lib/c/generic/fibril.c

    r867e2555 r925a21e  
    4141#include <unistd.h>
    4242#include <stdio.h>
    43 #include <arch/barrier.h>
     43#include <libarch/barrier.h>
    4444#include <libarch/faddr.h>
    4545#include <futex.h>
  • uspace/lib/c/generic/io/console.c

    r867e2555 r925a21e  
    8787{
    8888        async_exch_t *exch = async_exchange_begin(ctrl->output_sess);
    89         async_msg_0(exch, CONSOLE_CLEAR);
     89        async_req_0_0(exch, CONSOLE_CLEAR);
    9090        async_exchange_end(exch);
    9191}
     
    103103{
    104104        async_exch_t *exch = async_exchange_begin(ctrl->output_sess);
    105         async_msg_1(exch, CONSOLE_SET_STYLE, style);
    106         async_exchange_end(exch);
    107 }
    108 
    109 void console_set_color(console_ctrl_t *ctrl, uint8_t fg_color, uint8_t bg_color,
     105        async_req_1_0(exch, CONSOLE_SET_STYLE, style);
     106        async_exchange_end(exch);
     107}
     108
     109void console_set_color(console_ctrl_t *ctrl, uint8_t bgcolor, uint8_t fgcolor,
    110110    uint8_t flags)
    111111{
    112112        async_exch_t *exch = async_exchange_begin(ctrl->output_sess);
    113         async_msg_3(exch, CONSOLE_SET_COLOR, fg_color, bg_color, flags);
    114         async_exchange_end(exch);
    115 }
    116 
    117 void console_set_rgb_color(console_ctrl_t *ctrl, uint32_t fg_color,
    118     uint32_t bg_color)
    119 {
    120         async_exch_t *exch = async_exchange_begin(ctrl->output_sess);
    121         async_msg_2(exch, CONSOLE_SET_RGB_COLOR, fg_color, bg_color);
     113        async_req_3_0(exch, CONSOLE_SET_COLOR, bgcolor, fgcolor, flags);
     114        async_exchange_end(exch);
     115}
     116
     117void console_set_rgb_color(console_ctrl_t *ctrl, uint32_t bgcolor,
     118    uint32_t fgcolor)
     119{
     120        async_exch_t *exch = async_exchange_begin(ctrl->output_sess);
     121        async_req_2_0(exch, CONSOLE_SET_RGB_COLOR, bgcolor, fgcolor);
    122122        async_exchange_end(exch);
    123123}
     
    126126{
    127127        async_exch_t *exch = async_exchange_begin(ctrl->output_sess);
    128         async_msg_1(exch, CONSOLE_CURSOR_VISIBILITY, (show != false));
     128        async_req_1_0(exch, CONSOLE_CURSOR_VISIBILITY, (show != false));
    129129        async_exchange_end(exch);
    130130}
     
    151151{
    152152        async_exch_t *exch = async_exchange_begin(ctrl->output_sess);
    153         async_msg_2(exch, CONSOLE_GOTO, col, row);
     153        async_req_2_0(exch, CONSOLE_GOTO, col, row);
    154154        async_exchange_end(exch);
    155155}
  • uspace/lib/c/generic/io/io.c

    r867e2555 r925a21e  
    4545#include <vfs/vfs.h>
    4646#include <vfs/vfs_sess.h>
    47 #include <ipc/devmap.h>
     47#include <ipc/loc.h>
    4848#include <adt/list.h>
    4949#include "../private/io.h"
     
    101101static LIST_INITIALIZE(files);
    102102
    103 void __stdio_init(int filc, fdi_node_t *filv[])
     103void __stdio_init(int filc)
    104104{
    105105        if (filc > 0) {
    106                 stdin = fopen_node(filv[0], "r");
     106                stdin = fdopen(0, "r");
    107107        } else {
    108108                stdin = &stdin_null;
     
    111111       
    112112        if (filc > 1) {
    113                 stdout = fopen_node(filv[1], "w");
     113                stdout = fdopen(1, "w");
    114114        } else {
    115115                stdout = &stdout_klog;
     
    118118       
    119119        if (filc > 2) {
    120                 stderr = fopen_node(filv[2], "w");
     120                stderr = fdopen(2, "w");
    121121        } else {
    122122                stderr = &stderr_klog;
     
    285285}
    286286
    287 FILE *fopen_node(fdi_node_t *node, const char *mode)
    288 {
    289         int flags;
    290         if (!parse_mode(mode, &flags))
    291                 return NULL;
    292        
    293         /* Open file. */
    294         FILE *stream = malloc(sizeof(FILE));
    295         if (stream == NULL) {
    296                 errno = ENOMEM;
    297                 return NULL;
    298         }
    299        
    300         stream->fd = open_node(node, flags);
    301         if (stream->fd < 0) {
    302                 /* errno was set by open_node() */
    303                 free(stream);
    304                 return NULL;
    305         }
    306        
    307         stream->error = false;
    308         stream->eof = false;
    309         stream->klog = false;
    310         stream->sess = NULL;
    311         stream->need_sync = false;
    312         _setvbuf(stream);
    313        
    314         list_append(&stream->link, &files);
    315        
    316         return stream;
    317 }
    318 
    319287int fclose(FILE *stream)
    320288{
     
    450418
    451419        bytes_used = stream->buf_head - stream->buf_tail;
    452         if (bytes_used == 0)
    453                 return;
    454420
    455421        /* If buffer has prefetched read data, we need to seek back. */
    456         if (stream->buf_state == _bs_read)
     422        if (bytes_used > 0 && stream->buf_state == _bs_read)
    457423                lseek(stream->fd, - (ssize_t) bytes_used, SEEK_CUR);
    458424
    459425        /* If buffer has unwritten data, we need to write them out. */
    460         if (stream->buf_state == _bs_write)
     426        if (bytes_used > 0 && stream->buf_state == _bs_write)
    461427                (void) _fwrite(stream->buf_tail, 1, bytes_used, stream);
    462428
     
    780746}
    781747
    782 int fnode(FILE *stream, fdi_node_t *node)
    783 {
    784         if (stream->fd >= 0)
    785                 return fd_node(stream->fd, node);
     748int fhandle(FILE *stream, int *handle)
     749{
     750        if (stream->fd >= 0) {
     751                *handle = stream->fd;
     752                return EOK;
     753        }
    786754       
    787755        return ENOENT;
  • uspace/lib/c/generic/io/printf_core.c

    r867e2555 r925a21e  
    7474#define PRINT_NUMBER_BUFFER_SIZE  (64 + 5)
    7575
     76/** Get signed or unsigned integer argument */
     77#define PRINTF_GET_INT_ARGUMENT(type, ap, flags) \
     78        ({ \
     79                unsigned type res; \
     80                \
     81                if ((flags) & __PRINTF_FLAG_SIGNED) { \
     82                        signed type arg = va_arg((ap), signed type); \
     83                        \
     84                        if (arg < 0) { \
     85                                res = -arg; \
     86                                (flags) |= __PRINTF_FLAG_NEGATIVE; \
     87                        } else \
     88                                res = arg; \
     89                } else \
     90                        res = va_arg((ap), unsigned type); \
     91                \
     92                res; \
     93        })
     94
    7695/** Enumeration of possible arguments types.
    7796 */
     
    206225        }
    207226       
    208         return (int) (counter + 1);
     227        return (int) (counter);
    209228}
    210229
     
    244263        }
    245264       
    246         return (int) (counter + 1);
     265        return (int) (counter);
    247266}
    248267
     
    831850                        size_t size;
    832851                        uint64_t number;
     852                       
    833853                        switch (qualifier) {
    834854                        case PrintfQualifierByte:
    835855                                size = sizeof(unsigned char);
    836                                 number = (uint64_t) va_arg(ap, unsigned int);
     856                                number = PRINTF_GET_INT_ARGUMENT(int, ap, flags);
    837857                                break;
    838858                        case PrintfQualifierShort:
    839859                                size = sizeof(unsigned short);
    840                                 number = (uint64_t) va_arg(ap, unsigned int);
     860                                number = PRINTF_GET_INT_ARGUMENT(int, ap, flags);
    841861                                break;
    842862                        case PrintfQualifierInt:
    843863                                size = sizeof(unsigned int);
    844                                 number = (uint64_t) va_arg(ap, unsigned int);
     864                                number = PRINTF_GET_INT_ARGUMENT(int, ap, flags);
    845865                                break;
    846866                        case PrintfQualifierLong:
    847867                                size = sizeof(unsigned long);
    848                                 number = (uint64_t) va_arg(ap, unsigned long);
     868                                number = PRINTF_GET_INT_ARGUMENT(long, ap, flags);
    849869                                break;
    850870                        case PrintfQualifierLongLong:
    851871                                size = sizeof(unsigned long long);
    852                                 number = (uint64_t) va_arg(ap, unsigned long long);
     872                                number = PRINTF_GET_INT_ARGUMENT(long long, ap, flags);
    853873                                break;
    854874                        case PrintfQualifierPointer:
     
    865885                                counter = -counter;
    866886                                goto out;
    867                         }
    868                        
    869                         if (flags & __PRINTF_FLAG_SIGNED) {
    870                                 if (number & (0x1 << (size * 8 - 1))) {
    871                                         flags |= __PRINTF_FLAG_NEGATIVE;
    872                                        
    873                                         if (size == sizeof(uint64_t)) {
    874                                                 number = -((int64_t) number);
    875                                         } else {
    876                                                 number = ~number;
    877                                                 number &=
    878                                                     ~(0xFFFFFFFFFFFFFFFFll <<
    879                                                     (size * 8));
    880                                                 number++;
    881                                         }
    882                                 }
    883887                        }
    884888                       
  • uspace/lib/c/generic/ipc.c

    r867e2555 r925a21e  
    4747#include <futex.h>
    4848#include <fibril.h>
     49#include <macros.h>
    4950
    5051/**
     
    611612/** Request callback connection.
    612613 *
    613  * The @a taskhash and @a phonehash identifiers returned
     614 * The @a task_id and @a phonehash identifiers returned
    614615 * by the kernel can be used for connection tracking.
    615616 *
     
    618619 * @param arg2      User defined argument.
    619620 * @param arg3      User defined argument.
    620  * @param taskhash  Opaque identifier of the client task.
     621 * @param task_id   Identifier of the client task.
    621622 * @param phonehash Opaque identifier of the phone that will
    622623 *                  be used for incoming calls.
     
    626627 */
    627628int ipc_connect_to_me(int phoneid, sysarg_t arg1, sysarg_t arg2, sysarg_t arg3,
    628     sysarg_t *taskhash, sysarg_t *phonehash)
    629 {
    630         return ipc_call_sync_3_5(phoneid, IPC_M_CONNECT_TO_ME, arg1, arg2,
    631             arg3, NULL, NULL, NULL, taskhash, phonehash);
     629    task_id_t *task_id, sysarg_t *phonehash)
     630{
     631        ipc_call_t data;
     632        int rc = __SYSCALL6(SYS_IPC_CALL_SYNC_FAST, phoneid,
     633            IPC_M_CONNECT_TO_ME, arg1, arg2, arg3, (sysarg_t) &data);
     634        if (rc == EOK) {
     635                *task_id = data.in_task_id;
     636                *phonehash = IPC_GET_ARG5(data);
     637        }       
     638        return rc;
    632639}
    633640
  • uspace/lib/c/generic/libc.c

    r867e2555 r925a21e  
    9191                argc = 0;
    9292                argv = NULL;
    93                 __stdio_init(0, NULL);
     93                __stdio_init(0);
    9494        } else {
    9595                argc = __pcb->argc;
    9696                argv = __pcb->argv;
    97                 __stdio_init(__pcb->filc, __pcb->filv);
     97                __stdio_init(__pcb->filc);
    9898                (void) chdir(__pcb->cwd);
    9999        }
  • uspace/lib/c/generic/loader.c

    r867e2555 r925a21e  
    256256 *
    257257 */
    258 int loader_set_files(loader_t *ldr, fdi_node_t *const files[])
    259 {
    260         /*
    261          * Serialize the arguments into a single array. First
    262          * compute size of the buffer needed.
    263          */
    264         fdi_node_t *const *ap = files;
    265         size_t count = 0;
    266         while (*ap != NULL) {
    267                 count++;
    268                 ap++;
    269         }
    270        
    271         fdi_node_t *files_buf;
    272         files_buf = (fdi_node_t *) malloc(count * sizeof(fdi_node_t));
    273         if (files_buf == NULL)
    274                 return ENOMEM;
    275        
    276         /* Fill the buffer */
    277         size_t i;
    278         for (i = 0; i < count; i++)
    279                 files_buf[i] = *files[i];
    280        
     258int loader_set_files(loader_t *ldr, int * const files[])
     259{
    281260        /* Send serialized files to the loader */
    282261        async_exch_t *exch = async_exchange_begin(ldr->sess);
    283        
    284         ipc_call_t answer;
    285         aid_t req = async_send_0(exch, LOADER_SET_FILES, &answer);
    286         sysarg_t rc = async_data_write_start(exch, (void *) files_buf,
    287             count * sizeof(fdi_node_t));
    288        
    289         async_exchange_end(exch);
    290         free(files_buf);
    291        
     262        async_exch_t *vfs_exch = vfs_exchange_begin();
     263       
     264        int i;
     265        for (i = 0; files[i]; i++);
     266
     267        ipc_call_t answer;
     268        aid_t req = async_send_1(exch, LOADER_SET_FILES, i, &answer);
     269
     270        sysarg_t rc = EOK;
     271       
     272        for (i = 0; files[i]; i++) {
     273                rc = async_state_change_start(exch, VFS_PASS_HANDLE, *files[i],
     274                    0, vfs_exch);
     275                if (rc != EOK)
     276                        break;
     277        }
     278       
     279        vfs_exchange_end(vfs_exch);
     280        async_exchange_end(exch);
     281
    292282        if (rc != EOK) {
    293283                async_wait_for(req, NULL);
  • uspace/lib/c/generic/malloc.c

    r867e2555 r925a21e  
    873873void free(const void *addr)
    874874{
     875        if (addr == NULL)
     876                return;
     877
    875878        futex_down(&malloc_futex);
    876879       
  • uspace/lib/c/generic/ns.c

    r867e2555 r925a21e  
    5252{
    5353        async_exch_t *exch = async_exchange_begin(session_ns);
     54        if (!exch)
     55                return NULL;
    5456        async_sess_t *sess =
    5557            async_connect_me_to(mgmt, exch, service, arg2, arg3);
    5658        async_exchange_end(exch);
     59
     60        if (!sess)
     61                return NULL;
     62       
     63        /*
     64         * FIXME Ugly hack to work around limitation of implementing
     65         * parallel exchanges using multiple connections. Shift out
     66         * first argument for non-initial connections.
     67         */
     68        async_sess_args_set(sess, arg2, arg3, 0);
    5769       
    5870        return sess;
     
    6678            async_connect_me_to_blocking(mgmt, exch, service, arg2, arg3);
    6779        async_exchange_end(exch);
     80       
     81        /*
     82         * FIXME Ugly hack to work around limitation of implementing
     83         * parallel exchanges using multiple connections. Shift out
     84         * first argument for non-initial connections.
     85         */
     86        async_sess_args_set(sess, arg2, arg3, 0);
    6887       
    6988        return sess;
  • uspace/lib/c/generic/private/async.h

    r867e2555 r925a21e  
    3636#define LIBC_PRIVATE_ASYNC_H_
    3737
     38#include <async.h>
    3839#include <adt/list.h>
    3940#include <fibril.h>
     41#include <fibril_synch.h>
    4042#include <sys/time.h>
    4143#include <bool.h>
     
    7981} awaiter_t;
    8082
    81 /** Message data */
    82 typedef struct {
    83         awaiter_t wdata;
    84        
    85         /** If reply was received. */
    86         bool done;
    87        
    88         /** Pointer to where the answer data is stored. */
    89         ipc_call_t *dataptr;
    90        
    91         sysarg_t retval;
    92 } amsg_t;
    93 
    9483extern void __async_init(void);
    9584extern void async_insert_timeout(awaiter_t *);
  • uspace/lib/c/generic/private/io.h

    r867e2555 r925a21e  
    3636#define LIBC_PRIVATE_IO_H_
    3737
    38 #include <vfs/vfs.h>
    39 
    40 extern void __stdio_init(int filc, fdi_node_t *filv[]);
     38extern void __stdio_init(int);
    4139extern void __stdio_done(void);
    4240
  • uspace/lib/c/generic/private/thread.h

    r867e2555 r925a21e  
    3636#define LIBC_PRIVATE_THREAD_H_
    3737
    38 #include <kernel/proc/uarg.h>
     38#include <abi/proc/uarg.h>
    3939
    4040extern void __thread_entry(void);
  • uspace/lib/c/generic/str.c

    r867e2555 r925a21e  
    22 * Copyright (c) 2005 Martin Decky
    33 * Copyright (c) 2008 Jiri Svoboda
     4 * Copyright (c) 2011 Martin Sucha
     5 * Copyright (c) 2011 Oleg Romanenko
    46 * All rights reserved.
    57 *
     
    549551 *
    550552 * Common legacy text encoding in hardware is 7-bit ASCII fitted into
    551  * a fixed-with byte buffer (bit 7 always zero), right-padded with spaces
     553 * a fixed-width byte buffer (bit 7 always zero), right-padded with spaces
    552554 * (ASCII 0x20). Convert space-padded ascii to string representation.
    553555 *
     
    639641}
    640642
     643/** Convert UTF16 string to string.
     644 *
     645 * Convert utf16 string @a src to string. The output is written to the buffer
     646 * specified by @a dest and @a size. @a size must be non-zero and the string
     647 * written will always be well-formed. Surrogate pairs also supported.
     648 *
     649 * @param dest  Destination buffer.
     650 * @param size  Size of the destination buffer.
     651 * @param src   Source utf16 string.
     652 *
     653 * @return EOK, if success, negative otherwise.
     654 */
     655int utf16_to_str(char *dest, size_t size, const uint16_t *src)
     656{
     657        size_t idx = 0, dest_off = 0;
     658        wchar_t ch;
     659        int rc = EOK;
     660
     661        /* There must be space for a null terminator in the buffer. */
     662        assert(size > 0);
     663
     664        while (src[idx]) {
     665                if ((src[idx] & 0xfc00) == 0xd800) {
     666                        if (src[idx + 1] && (src[idx + 1] & 0xfc00) == 0xdc00) {
     667                                ch = 0x10000;
     668                                ch += (src[idx] & 0x03FF) << 10;
     669                                ch += (src[idx + 1] & 0x03FF);
     670                                idx += 2;
     671                        }
     672                        else
     673                                break;
     674                } else {
     675                        ch = src[idx];
     676                        idx++;
     677                }
     678                rc = chr_encode(ch, dest, &dest_off, size - 1);
     679                if (rc != EOK)
     680                        break;
     681        }
     682        dest[dest_off] = '\0';
     683        return rc;
     684}
     685
     686int str_to_utf16(uint16_t *dest, size_t size, const char *src)
     687{
     688        int rc = EOK;
     689        size_t offset = 0;
     690        size_t idx = 0;
     691        wchar_t c;
     692
     693        assert(size > 0);
     694       
     695        while ((c = str_decode(src, &offset, STR_NO_LIMIT)) != 0) {
     696                if (c > 0x10000) {
     697                        if (idx + 2 >= size - 1) {
     698                                rc = EOVERFLOW;
     699                                break;
     700                        }
     701                        c = (c - 0x10000);
     702                        dest[idx] = 0xD800 | (c >> 10);
     703                        dest[idx + 1] = 0xDC00 | (c & 0x3FF);
     704                        idx++;
     705                } else {
     706                         dest[idx] = c;
     707                }
     708
     709                idx++;
     710                if (idx >= size - 1) {
     711                        rc = EOVERFLOW;
     712                        break;
     713                }
     714        }
     715
     716        dest[idx] = '\0';
     717        return rc;
     718}
     719
     720
    641721/** Convert wide string to new string.
    642722 *
     
    718798
    719799        dest[dlen - 1] = '\0';
     800}
     801
     802/** Convert string to wide string.
     803 *
     804 * Convert string @a src to wide string. A new wide NULL-terminated
     805 * string will be allocated on the heap.
     806 *
     807 * @param src   Source string.
     808 */
     809wchar_t *str_to_awstr(const char *str)
     810{
     811        size_t len = str_length(str);
     812       
     813        wchar_t *wstr = calloc(len+1, sizeof(wchar_t));
     814        if (wstr == NULL)
     815                return NULL;
     816       
     817        str_to_wstr(wstr, len + 1, str);
     818        return wstr;
    720819}
    721820
     
    10161115        return dest;
    10171116}
    1018 
    10191117
    10201118/** Convert initial part of string to unsigned long according to given base.
     
    11931291}
    11941292
     1293/** Convert string to uint8_t.
     1294 *
     1295 * @param nptr   Pointer to string.
     1296 * @param endptr If not NULL, pointer to the first invalid character
     1297 *               is stored here.
     1298 * @param base   Zero or number between 2 and 36 inclusive.
     1299 * @param strict Do not allow any trailing characters.
     1300 * @param result Result of the conversion.
     1301 *
     1302 * @return EOK if conversion was successful.
     1303 *
     1304 */
     1305int str_uint8_t(const char *nptr, char **endptr, unsigned int base,
     1306    bool strict, uint8_t *result)
     1307{
     1308        assert(result != NULL);
     1309       
     1310        bool neg;
     1311        char *lendptr;
     1312        uint64_t res;
     1313        int ret = str_uint(nptr, &lendptr, base, &neg, &res);
     1314       
     1315        if (endptr != NULL)
     1316                *endptr = (char *) lendptr;
     1317       
     1318        if (ret != EOK)
     1319                return ret;
     1320       
     1321        /* Do not allow negative values */
     1322        if (neg)
     1323                return EINVAL;
     1324       
     1325        /* Check whether we are at the end of
     1326           the string in strict mode */
     1327        if ((strict) && (*lendptr != 0))
     1328                return EINVAL;
     1329       
     1330        /* Check for overflow */
     1331        uint8_t _res = (uint8_t) res;
     1332        if (_res != res)
     1333                return EOVERFLOW;
     1334       
     1335        *result = _res;
     1336       
     1337        return EOK;
     1338}
     1339
     1340/** Convert string to uint16_t.
     1341 *
     1342 * @param nptr   Pointer to string.
     1343 * @param endptr If not NULL, pointer to the first invalid character
     1344 *               is stored here.
     1345 * @param base   Zero or number between 2 and 36 inclusive.
     1346 * @param strict Do not allow any trailing characters.
     1347 * @param result Result of the conversion.
     1348 *
     1349 * @return EOK if conversion was successful.
     1350 *
     1351 */
     1352int str_uint16_t(const char *nptr, char **endptr, unsigned int base,
     1353    bool strict, uint16_t *result)
     1354{
     1355        assert(result != NULL);
     1356       
     1357        bool neg;
     1358        char *lendptr;
     1359        uint64_t res;
     1360        int ret = str_uint(nptr, &lendptr, base, &neg, &res);
     1361       
     1362        if (endptr != NULL)
     1363                *endptr = (char *) lendptr;
     1364       
     1365        if (ret != EOK)
     1366                return ret;
     1367       
     1368        /* Do not allow negative values */
     1369        if (neg)
     1370                return EINVAL;
     1371       
     1372        /* Check whether we are at the end of
     1373           the string in strict mode */
     1374        if ((strict) && (*lendptr != 0))
     1375                return EINVAL;
     1376       
     1377        /* Check for overflow */
     1378        uint16_t _res = (uint16_t) res;
     1379        if (_res != res)
     1380                return EOVERFLOW;
     1381       
     1382        *result = _res;
     1383       
     1384        return EOK;
     1385}
     1386
     1387/** Convert string to uint32_t.
     1388 *
     1389 * @param nptr   Pointer to string.
     1390 * @param endptr If not NULL, pointer to the first invalid character
     1391 *               is stored here.
     1392 * @param base   Zero or number between 2 and 36 inclusive.
     1393 * @param strict Do not allow any trailing characters.
     1394 * @param result Result of the conversion.
     1395 *
     1396 * @return EOK if conversion was successful.
     1397 *
     1398 */
     1399int str_uint32_t(const char *nptr, char **endptr, unsigned int base,
     1400    bool strict, uint32_t *result)
     1401{
     1402        assert(result != NULL);
     1403       
     1404        bool neg;
     1405        char *lendptr;
     1406        uint64_t res;
     1407        int ret = str_uint(nptr, &lendptr, base, &neg, &res);
     1408       
     1409        if (endptr != NULL)
     1410                *endptr = (char *) lendptr;
     1411       
     1412        if (ret != EOK)
     1413                return ret;
     1414       
     1415        /* Do not allow negative values */
     1416        if (neg)
     1417                return EINVAL;
     1418       
     1419        /* Check whether we are at the end of
     1420           the string in strict mode */
     1421        if ((strict) && (*lendptr != 0))
     1422                return EINVAL;
     1423       
     1424        /* Check for overflow */
     1425        uint32_t _res = (uint32_t) res;
     1426        if (_res != res)
     1427                return EOVERFLOW;
     1428       
     1429        *result = _res;
     1430       
     1431        return EOK;
     1432}
     1433
    11951434/** Convert string to uint64_t.
    11961435 *
  • uspace/lib/c/generic/sysinfo.c

    r867e2555 r925a21e  
    4747 *
    4848 */
    49 sysinfo_item_tag_t sysinfo_get_tag(const char *path)
     49sysinfo_item_val_type_t sysinfo_get_val_type(const char *path)
    5050{
    51         return (sysinfo_item_tag_t) __SYSCALL2(SYS_SYSINFO_GET_TAG,
     51        return (sysinfo_item_val_type_t) __SYSCALL2(SYS_SYSINFO_GET_VAL_TYPE,
    5252            (sysarg_t) path, (sysarg_t) str_size(path));
    5353}
  • uspace/lib/c/generic/task.c

    r867e2555 r925a21e  
    4646#include <libc.h>
    4747#include "private/ns.h"
     48#include <vfs/vfs.h>
    4849
    4950task_id_t task_get_id(void)
     
    102103{
    103104        /* Send default files */
    104         fdi_node_t *files[4];
    105         fdi_node_t stdin_node;
    106         fdi_node_t stdout_node;
    107         fdi_node_t stderr_node;
    108        
    109         if ((stdin != NULL) && (fnode(stdin, &stdin_node) == EOK))
    110                 files[0] = &stdin_node;
     105        int *files[4];
     106        int fd_stdin;
     107        int fd_stdout;
     108        int fd_stderr;
     109       
     110        if ((stdin != NULL) && (fhandle(stdin, &fd_stdin) == EOK))
     111                files[0] = &fd_stdin;
    111112        else
    112113                files[0] = NULL;
    113114       
    114         if ((stdout != NULL) && (fnode(stdout, &stdout_node) == EOK))
    115                 files[1] = &stdout_node;
     115        if ((stdout != NULL) && (fhandle(stdout, &fd_stdout) == EOK))
     116                files[1] = &fd_stdout;
    116117        else
    117118                files[1] = NULL;
    118119       
    119         if ((stderr != NULL) && (fnode(stderr, &stderr_node) == EOK))
    120                 files[2] = &stderr_node;
     120        if ((stderr != NULL) && (fhandle(stderr, &fd_stderr) == EOK))
     121                files[2] = &fd_stderr;
    121122        else
    122123                files[2] = NULL;
     
    142143 */
    143144int task_spawnvf(task_id_t *id, const char *path, const char *const args[],
    144     fdi_node_t *const files[])
     145    int *const files[])
    145146{
    146147        /* Connect to a program loader. */
  • uspace/lib/c/generic/thread.c

    r867e2555 r925a21e  
    3737#include <stdlib.h>
    3838#include <libarch/faddr.h>
    39 #include <kernel/proc/uarg.h>
     39#include <abi/proc/uarg.h>
    4040#include <fibril.h>
    4141#include <str.h>
  • uspace/lib/c/generic/time.c

    r867e2555 r925a21e  
    3636#include <time.h>
    3737#include <bool.h>
    38 #include <arch/barrier.h>
     38#include <libarch/barrier.h>
    3939#include <macros.h>
    4040#include <errno.h>
  • uspace/lib/c/generic/udebug.c

    r867e2555 r925a21e  
    3535#include <udebug.h>
    3636#include <sys/types.h>
    37 #include <kernel/ipc/ipc_methods.h>
     37#include <abi/ipc/methods.h>
    3838#include <async.h>
    3939
  • uspace/lib/c/generic/vfs/vfs.c

    r867e2555 r925a21e  
    5151#include <assert.h>
    5252#include <str.h>
    53 #include <devmap.h>
     53#include <loc.h>
    5454#include <ipc/vfs.h>
    55 #include <ipc/devmap.h>
     55#include <ipc/loc.h>
    5656
    5757static FIBRIL_MUTEX_INITIALIZE(vfs_mutex);
     
    6969 *
    7070 */
    71 static async_exch_t *vfs_exchange_begin(void)
     71async_exch_t *vfs_exchange_begin(void)
    7272{
    7373        fibril_mutex_lock(&vfs_mutex);
     
    8787 *
    8888 */
    89 static void vfs_exchange_end(async_exch_t *exch)
     89void vfs_exchange_end(async_exch_t *exch)
    9090{
    9191        async_exchange_end(exch);
     
    142142}
    143143
    144 int mount(const char *fs_name, const char *mp, const char *fqdn,
    145     const char *opts, unsigned int flags)
     144int mount(const char *fs_name, const char *mp, const char *fqsn,
     145    const char *opts, unsigned int flags, unsigned int instance)
    146146{
    147147        int null_id = -1;
    148         char null[DEVMAP_NAME_MAXLEN];
    149        
    150         if (str_cmp(fqdn, "") == 0) {
     148        char null[LOC_NAME_MAXLEN];
     149       
     150        if (str_cmp(fqsn, "") == 0) {
    151151                /* No device specified, create a fresh
    152152                   null/%d device instead */
    153                 null_id = devmap_null_create();
     153                null_id = loc_null_create();
    154154               
    155155                if (null_id == -1)
    156156                        return ENOMEM;
    157157               
    158                 snprintf(null, DEVMAP_NAME_MAXLEN, "null/%d", null_id);
    159                 fqdn = null;
    160         }
    161        
    162         devmap_handle_t devmap_handle;
    163         int res = devmap_device_get_handle(fqdn, &devmap_handle, flags);
     158                snprintf(null, LOC_NAME_MAXLEN, "null/%d", null_id);
     159                fqsn = null;
     160        }
     161       
     162        service_id_t service_id;
     163        int res = loc_service_get_id(fqsn, &service_id, flags);
    164164        if (res != EOK) {
    165165                if (null_id != -1)
    166                         devmap_null_destroy(null_id);
     166                        loc_null_destroy(null_id);
    167167               
    168168                return res;
     
    173173        if (!mpa) {
    174174                if (null_id != -1)
    175                         devmap_null_destroy(null_id);
     175                        loc_null_destroy(null_id);
    176176               
    177177                return ENOMEM;
     
    181181
    182182        sysarg_t rc_orig;
    183         aid_t req = async_send_2(exch, VFS_IN_MOUNT, devmap_handle, flags, NULL);
     183        aid_t req = async_send_3(exch, VFS_IN_MOUNT, service_id, flags,
     184            instance, NULL);
    184185        sysarg_t rc = async_data_write_start(exch, (void *) mpa, mpa_size);
    185186        if (rc != EOK) {
     
    189190               
    190191                if (null_id != -1)
    191                         devmap_null_destroy(null_id);
     192                        loc_null_destroy(null_id);
    192193               
    193194                if (rc_orig == EOK)
     
    204205               
    205206                if (null_id != -1)
    206                         devmap_null_destroy(null_id);
     207                        loc_null_destroy(null_id);
    207208               
    208209                if (rc_orig == EOK)
     
    219220               
    220221                if (null_id != -1)
    221                         devmap_null_destroy(null_id);
     222                        loc_null_destroy(null_id);
    222223               
    223224                if (rc_orig == EOK)
     
    235236               
    236237                if (null_id != -1)
    237                         devmap_null_destroy(null_id);
     238                        loc_null_destroy(null_id);
    238239               
    239240                if (rc_orig == EOK)
     
    248249       
    249250        if ((rc != EOK) && (null_id != -1))
    250                 devmap_null_destroy(null_id);
     251                loc_null_destroy(null_id);
    251252       
    252253        return (int) rc;
     
    327328       
    328329        return ret;
    329 }
    330 
    331 int open_node(fdi_node_t *node, int oflag)
    332 {
    333         async_exch_t *exch = vfs_exchange_begin();
    334        
    335         ipc_call_t answer;
    336         aid_t req = async_send_4(exch, VFS_IN_OPEN_NODE, node->fs_handle,
    337             node->devmap_handle, node->index, oflag, &answer);
    338        
    339         vfs_exchange_end(exch);
    340 
    341         sysarg_t rc;
    342         async_wait_for(req, &rc);
    343        
    344         if (rc != EOK)
    345                 return (int) rc;
    346        
    347         return (int) IPC_GET_ARG1(answer);
    348330}
    349331
     
    673655        async_exch_t *exch = vfs_exchange_begin();
    674656       
    675         req = async_send_0(exch, VFS_IN_UNLINK, NULL);
     657        req = async_send_1(exch, VFS_IN_UNLINK, lflag, NULL);
    676658        rc = async_data_write_start(exch, pa, pa_size);
    677659        if (rc != EOK) {
     
    811793        }
    812794       
    813         if (!stat.device) {
     795        if (!stat.service) {
    814796                errno = ENOENT;
    815797                return NULL;
    816798        }
    817799       
    818         return devmap_device_connect(mgmt, stat.device, 0);
    819 }
    820 
    821 int fd_node(int fildes, fdi_node_t *node)
    822 {
    823         struct stat stat;
    824         int rc = fstat(fildes, &stat);
    825        
    826         if (rc == EOK) {
    827                 node->fs_handle = stat.fs_handle;
    828                 node->devmap_handle = stat.devmap_handle;
    829                 node->index = stat.index;
    830         }
    831        
    832         return rc;
     800        return loc_service_connect(mgmt, stat.service, 0);
    833801}
    834802
     
    848816}
    849817
     818int fd_wait(void)
     819{
     820        async_exch_t *exch = vfs_exchange_begin();
     821       
     822        sysarg_t ret;
     823        sysarg_t rc = async_req_0_1(exch, VFS_IN_WAIT_HANDLE, &ret);
     824       
     825        vfs_exchange_end(exch);
     826       
     827        if (rc == EOK)
     828                return (int) ret;
     829       
     830        return (int) rc;
     831}
     832
    850833/** @}
    851834 */
  • uspace/lib/c/include/adt/list.h

    r867e2555 r925a21e  
    7272
    7373#define assert_link_not_used(link) \
    74         assert((link)->prev == NULL && (link)->next == NULL)
     74        assert(((link)->prev == NULL) && ((link)->next == NULL))
    7575
    7676/** Initialize doubly-linked circular list link
     
    158158static inline void list_remove(link_t *link)
    159159{
    160         link->next->prev = link->prev;
    161         link->prev->next = link->next;
     160        if ((link->prev != NULL) && (link->next != NULL)) {
     161                link->next->prev = link->prev;
     162                link->prev->next = link->next;
     163        }
     164       
    162165        link_initialize(link);
    163166}
     
    170173 *
    171174 */
    172 static inline int list_empty(list_t *list)
     175static inline int list_empty(const list_t *list)
    173176{
    174177        return (list->head.next == &list->head);
     
    183186 *
    184187 */
    185 static inline link_t *list_first(list_t *list)
     188static inline link_t *list_first(const list_t *list)
    186189{
    187190        return ((list->head.next == &list->head) ? NULL : list->head.next);
  • uspace/lib/c/include/as.h

    r867e2555 r925a21e  
    3737
    3838#include <sys/types.h>
     39#include <abi/mm/as.h>
    3940#include <task.h>
    40 #include <kernel/mm/as.h>
    4141#include <libarch/config.h>
    4242
     
    6060extern void *set_maxheapsize(size_t);
    6161extern void *as_get_mappable_page(size_t);
    62 extern int as_get_physical_mapping(void *, uintptr_t *);
     62extern int as_get_physical_mapping(const void *, uintptr_t *);
    6363
    6464#endif
  • uspace/lib/c/include/async.h

    r867e2555 r925a21e  
    4242#include <ipc/common.h>
    4343#include <fibril.h>
    44 #include <fibril_synch.h>
    4544#include <sys/time.h>
    4645#include <atomic.h>
     
    9695} exch_mgmt_t;
    9796
    98 /** Session data */
    99 typedef struct {
    100         /** List of inactive exchanges */
    101         list_t exch_list;
    102        
    103         /** Exchange management style */
    104         exch_mgmt_t mgmt;
    105        
    106         /** Session identification */
    107         int phone;
    108        
    109         /** First clone connection argument */
    110         sysarg_t arg1;
    111        
    112         /** Second clone connection argument */
    113         sysarg_t arg2;
    114        
    115         /** Third clone connection argument */
    116         sysarg_t arg3;
    117        
    118         /** Exchange mutex */
    119         fibril_mutex_t mutex;
    120        
    121         /** Number of opened exchanges */
    122         atomic_t refcnt;
    123 } async_sess_t;
    124 
    125 /** Exchange data */
    126 typedef struct {
    127         /** Link into list of inactive exchanges */
    128         link_t sess_link;
    129        
    130         /** Link into global list of inactive exchanges */
    131         link_t global_link;
    132        
    133         /** Session pointer */
    134         async_sess_t *sess;
    135        
    136         /** Exchange identification */
    137         int phone;
    138 } async_exch_t;
     97/** Forward declarations */
     98struct async_exch;
     99struct async_sess;
     100
     101typedef struct async_sess async_sess_t;
     102typedef struct async_exch async_exch_t;
    139103
    140104extern atomic_t threads_in_ipc_wait;
     
    176140extern int async_wait_timeout(aid_t, sysarg_t *, suseconds_t);
    177141
    178 extern fid_t async_new_connection(sysarg_t, sysarg_t, ipc_callid_t,
     142extern fid_t async_new_connection(task_id_t, sysarg_t, ipc_callid_t,
    179143    ipc_call_t *, async_client_conn_t, void *);
    180144
     
    186150extern void async_set_client_data_destructor(async_client_data_dtor_t);
    187151extern void *async_get_client_data(void);
     152extern void *async_get_client_data_by_id(task_id_t);
     153extern void async_put_client_data_by_id(task_id_t);
    188154
    189155extern void async_set_client_connection(async_client_conn_t);
     
    371337
    372338/*
     339 * FIXME These functions just work around problems with parallel exchange
     340 * management. Proper solution needs to be implemented.
     341 */
     342void async_sess_args_set(async_sess_t *sess, sysarg_t, sysarg_t, sysarg_t);
     343
     344/*
    373345 * User-friendly wrappers for async_share_in_start().
    374346 */
     
    477449extern async_sess_t *async_callback_receive_start(exch_mgmt_t, ipc_call_t *);
    478450
     451extern int async_state_change_start(async_exch_t *, sysarg_t, sysarg_t,
     452    sysarg_t, async_exch_t *);
     453extern bool async_state_change_receive(ipc_callid_t *, sysarg_t *, sysarg_t *,
     454    sysarg_t *);
     455extern int async_state_change_finalize(ipc_callid_t, async_exch_t *);
     456
     457extern void *async_remote_state_acquire(async_sess_t *);
     458extern void async_remote_state_update(async_sess_t *, void *);
     459extern void async_remote_state_release(async_sess_t *);
     460extern void async_remote_state_release_exchange(async_exch_t *);
     461
    479462#endif
    480463
  • uspace/lib/c/include/bool.h

    r867e2555 r925a21e  
    3737
    3838#include <libarch/types.h>
     39#include <abi/bool.h>
    3940
    4041#define false  0
    4142#define true   1
    42 
    43 typedef uint8_t bool;
    4443
    4544#endif
  • uspace/lib/c/include/ddi.h

    r867e2555 r925a21e  
    3737
    3838#include <sys/types.h>
    39 #include <kernel/ddi/irq.h>
     39#include <abi/ddi/irq.h>
    4040#include <task.h>
    4141
  • uspace/lib/c/include/devman.h

    r867e2555 r925a21e  
    3838
    3939#include <ipc/devman.h>
     40#include <ipc/loc.h>
    4041#include <async.h>
    4142#include <bool.h>
     
    4849extern int devman_add_function(const char *, fun_type_t, match_id_list_t *,
    4950    devman_handle_t, devman_handle_t *);
     51extern int devman_remove_function(devman_handle_t);
     52extern int devman_drv_fun_online(devman_handle_t);
     53extern int devman_drv_fun_offline(devman_handle_t);
    5054
    5155extern async_sess_t *devman_device_connect(exch_mgmt_t, devman_handle_t,
     
    5458    unsigned int);
    5559
    56 extern int devman_device_get_handle(const char *, devman_handle_t *,
     60extern int devman_fun_get_handle(const char *, devman_handle_t *,
    5761    unsigned int);
    58 extern int devman_device_get_handle_by_class(const char *, const char *,
    59     devman_handle_t *, unsigned int);
    60 extern int devman_get_device_path(devman_handle_t, char *, size_t);
     62extern int devman_fun_get_child(devman_handle_t, devman_handle_t *);
     63extern int devman_dev_get_functions(devman_handle_t, devman_handle_t **,
     64    size_t *);
     65extern int devman_fun_get_name(devman_handle_t, char *, size_t);
     66extern int devman_fun_get_path(devman_handle_t, char *, size_t);
     67extern int devman_fun_online(devman_handle_t);
     68extern int devman_fun_offline(devman_handle_t);
    6169
    62 extern int devman_add_device_to_class(devman_handle_t, const char *);
     70extern int devman_add_device_to_category(devman_handle_t, const char *);
     71extern int devman_fun_sid_to_handle(service_id_t, devman_handle_t *);
    6372
    6473#endif
  • uspace/lib/c/include/elf/elf.h

    r867e2555 r925a21e  
    3636#define LIBC_ELF_H_
    3737
    38 #include <kernel/lib/elf.h>
     38#include <sys/types.h>
     39#include <abi/elf.h>
     40#include <libarch/elf.h>
    3941
    4042#endif
  • uspace/lib/c/include/elf/elf_load.h

    r867e2555 r925a21e  
    3838#define ELF_LOAD_H_
    3939
    40 #include <arch/elf.h>
    4140#include <elf/elf.h>
    4241#include <sys/types.h>
     
    4847#define EE_OK                   0       /* No error */
    4948#define EE_INVALID              1       /* Invalid ELF image */
    50 #define EE_MEMORY               2       /* Cannot allocate address space */
     49#define EE_MEMORY               2       /* Cannot allocate address space */
    5150#define EE_INCOMPATIBLE         3       /* ELF image is not compatible with current architecture */
    5251#define EE_UNSUPPORTED          4       /* Non-supported ELF (e.g. dynamic ELFs) */
  • uspace/lib/c/include/errno.h

    r867e2555 r925a21e  
    3636#define LIBC_ERRNO_H_
    3737
    38 #include <kernel/errno.h>
     38#include <abi/errno.h>
    3939#include <fibril.h>
    4040
     
    5555#define EIO           (-265)
    5656#define EMLINK        (-266)
     57#define ENXIO         (-267)
    5758
    5859/** Bad checksum. */
  • uspace/lib/c/include/event.h

    r867e2555 r925a21e  
    3636#define LIBC_EVENT_H_
    3737
    38 #include <kernel/ipc/event_types.h>
     38#include <abi/ipc/event.h>
     39#include <libarch/types.h>
    3940
    4041extern int event_subscribe(event_type_t, sysarg_t);
     42extern int event_task_subscribe(event_task_type_t, sysarg_t);
    4143extern int event_unmask(event_type_t);
     44extern int event_task_unmask(event_task_type_t);
    4245
    4346#endif
  • uspace/lib/c/include/io/color.h

    r867e2555 r925a21e  
    4444        COLOR_MAGENTA = 5,
    4545        COLOR_YELLOW  = 6,
    46         COLOR_WHITE   = 7,
    47        
    48         CATTR_BRIGHT  = 8,
    49         CATTR_BLINK   = 8
     46        COLOR_WHITE   = 7
    5047} console_color_t;
     48
     49typedef enum {
     50        CATTR_NORMAL = 0,
     51        CATTR_BRIGHT = 8,
     52        CATTR_BLINK  = 16
     53} console_color_attr_t;
    5154
    5255#endif
  • uspace/lib/c/include/io/console.h

    r867e2555 r925a21e  
    3737
    3838#include <sys/time.h>
     39#include <io/keycode.h>
    3940#include <async.h>
    4041#include <bool.h>
     
    4243
    4344typedef enum {
    44         CONSOLE_CCAP_NONE = 0,
    45         CONSOLE_CCAP_STYLE,
    46         CONSOLE_CCAP_INDEXED,
    47         CONSOLE_CCAP_RGB
     45        CONSOLE_CAP_NONE = 0,
     46        CONSOLE_CAP_STYLE = 1,
     47        CONSOLE_CAP_INDEXED = 2,
     48        CONSOLE_CAP_RGB = 4
    4849} console_caps_t;
    4950
     
    7677/** Console event structure. */
    7778typedef struct {
     79        /** List handle */
     80        link_t link;
     81       
    7882        /** Press or release event. */
    7983        kbd_event_type_t type;
    8084       
    8185        /** Keycode of the key that was pressed or released. */
    82         unsigned int key;
     86        keycode_t key;
    8387       
    8488        /** Bitmask of modifiers held. */
    85         unsigned int mods;
     89        keymod_t mods;
    8690       
    8791        /** The character that was generated or '\0' for none. */
  • uspace/lib/c/include/ipc/bd.h

    r867e2555 r925a21e  
    4242        BD_GET_NUM_BLOCKS,
    4343        BD_READ_BLOCKS,
    44         BD_WRITE_BLOCKS
     44        BD_WRITE_BLOCKS,
     45        BD_READ_TOC
    4546} bd_request_t;
    4647
  • uspace/lib/c/include/ipc/common.h

    r867e2555 r925a21e  
    3737
    3838#include <sys/types.h>
     39#include <abi/ipc/ipc.h>
    3940#include <atomic.h>
    40 #include <kernel/ipc/ipc.h>
     41#include <task.h>
    4142
    4243#define IPC_FLAG_BLOCKING  0x01
     
    4445typedef struct {
    4546        sysarg_t args[IPC_CALL_LEN];
    46         sysarg_t in_task_hash;
     47        task_id_t in_task_id;
    4748        sysarg_t in_phone_hash;
    4849} ipc_call_t;
  • uspace/lib/c/include/ipc/devman.h

    r867e2555 r925a21e  
    130130        DEVMAN_CLIENT,
    131131        DEVMAN_CONNECT_TO_DEVICE,
    132         DEVMAN_CONNECT_FROM_DEVMAP,
     132        DEVMAN_CONNECT_FROM_LOC,
    133133        DEVMAN_CONNECT_TO_PARENTS_DEVICE
    134134} devman_interface_t;
     
    138138        DEVMAN_ADD_FUNCTION,
    139139        DEVMAN_ADD_MATCH_ID,
    140         DEVMAN_ADD_DEVICE_TO_CLASS
    141 
     140        DEVMAN_ADD_DEVICE_TO_CATEGORY,
     141        DEVMAN_DRV_FUN_ONLINE,
     142        DEVMAN_DRV_FUN_OFFLINE,
     143        DEVMAN_REMOVE_FUNCTION
    142144} driver_to_devman_t;
    143145
    144146typedef enum {
    145         DRIVER_ADD_DEVICE = IPC_FIRST_USER_METHOD
    146 
     147        DRIVER_DEV_ADD = IPC_FIRST_USER_METHOD,
     148        DRIVER_DEV_REMOVE,
     149        DRIVER_DEV_GONE,
     150        DRIVER_FUN_ONLINE,
     151        DRIVER_FUN_OFFLINE,
    147152} devman_to_driver_t;
    148153
    149154typedef enum {
    150155        DEVMAN_DEVICE_GET_HANDLE = IPC_FIRST_USER_METHOD,
    151         DEVMAN_DEVICE_GET_HANDLE_BY_CLASS,
    152         DEVMAN_DEVICE_GET_DEVICE_PATH
     156        DEVMAN_DEV_GET_FUNCTIONS,
     157        DEVMAN_FUN_GET_CHILD,
     158        DEVMAN_FUN_GET_NAME,
     159        DEVMAN_FUN_ONLINE,
     160        DEVMAN_FUN_OFFLINE,
     161        DEVMAN_FUN_GET_PATH,
     162        DEVMAN_FUN_SID_TO_HANDLE
    153163} client_to_devman_t;
    154164
  • uspace/lib/c/include/ipc/ipc.h

    r867e2555 r925a21e  
    4242#include <sys/types.h>
    4343#include <ipc/common.h>
    44 #include <kernel/ipc/ipc_methods.h>
    45 #include <kernel/synch/synch.h>
     44#include <abi/ipc/methods.h>
     45#include <abi/synch.h>
    4646#include <task.h>
    4747
     
    254254    sysarg_t, sysarg_t, void *, ipc_async_callback_t, bool);
    255255
    256 extern int ipc_connect_to_me(int, sysarg_t, sysarg_t, sysarg_t, sysarg_t *,
     256extern int ipc_connect_to_me(int, sysarg_t, sysarg_t, sysarg_t, task_id_t *,
    257257    sysarg_t *);
    258258extern int ipc_connect_me(int);
  • uspace/lib/c/include/ipc/loc.h

    r867e2555 r925a21e  
    11/*
    22 * Copyright (c) 2007 Josef Cejka
     3 * Copyright (c) 2011 Jiri Svoboda
    34 * All rights reserved.
    45 *
     
    2728 */
    2829
    29 /** @addtogroup devmap
     30/** @addtogroup loc
    3031 * @{
    3132 */
    3233
    33 #ifndef LIBC_IPC_DEVMAP_H_
    34 #define LIBC_IPC_DEVMAP_H_
     34#ifndef LIBC_IPC_LOC_H_
     35#define LIBC_IPC_LOC_H_
    3536
    3637#include <ipc/common.h>
    3738
    38 #define DEVMAP_NAME_MAXLEN  255
     39#define LOC_NAME_MAXLEN  255
    3940
    40 typedef sysarg_t devmap_handle_t;
     41typedef sysarg_t service_id_t;
     42typedef sysarg_t category_id_t;
    4143
    4244typedef enum {
    43         DEV_HANDLE_NONE,
    44         DEV_HANDLE_NAMESPACE,
    45         DEV_HANDLE_DEVICE
    46 } devmap_handle_type_t;
     45        LOC_OBJECT_NONE,
     46        LOC_OBJECT_NAMESPACE,
     47        LOC_OBJECT_SERVICE
     48} loc_object_type_t;
    4749
    4850typedef enum {
    49         DEVMAP_DRIVER_REGISTER = IPC_FIRST_USER_METHOD,
    50         DEVMAP_DRIVER_UNREGISTER,
    51         DEVMAP_DEVICE_REGISTER,
    52         DEVMAP_DEVICE_UNREGISTER,
    53         DEVMAP_DEVICE_GET_HANDLE,
    54         DEVMAP_NAMESPACE_GET_HANDLE,
    55         DEVMAP_HANDLE_PROBE,
    56         DEVMAP_NULL_CREATE,
    57         DEVMAP_NULL_DESTROY,
    58         DEVMAP_GET_NAMESPACE_COUNT,
    59         DEVMAP_GET_DEVICE_COUNT,
    60         DEVMAP_GET_NAMESPACES,
    61         DEVMAP_GET_DEVICES
    62 } devmap_request_t;
     51        LOC_SERVER_REGISTER = IPC_FIRST_USER_METHOD,
     52        LOC_SERVER_UNREGISTER,
     53        LOC_SERVICE_ADD_TO_CAT,
     54        LOC_SERVICE_REGISTER,
     55        LOC_SERVICE_UNREGISTER,
     56        LOC_SERVICE_GET_ID,
     57        LOC_SERVICE_GET_NAME,
     58        LOC_NAMESPACE_GET_ID,
     59        LOC_CALLBACK_CREATE,
     60        LOC_CATEGORY_GET_ID,
     61        LOC_CATEGORY_GET_NAME,
     62        LOC_CATEGORY_GET_SVCS,
     63        LOC_ID_PROBE,
     64        LOC_NULL_CREATE,
     65        LOC_NULL_DESTROY,
     66        LOC_GET_NAMESPACE_COUNT,
     67        LOC_GET_SERVICE_COUNT,
     68        LOC_GET_CATEGORIES,
     69        LOC_GET_NAMESPACES,
     70        LOC_GET_SERVICES
     71} loc_request_t;
    6372
    64 /** Interface provided by devmap.
     73typedef enum {
     74        LOC_EVENT_CAT_CHANGE = IPC_FIRST_USER_METHOD
     75} loc_event_t;
     76
     77/** Ports provided by location service.
    6578 *
    66  * Every process that connects to devmap must ask one of following
    67  * interfaces otherwise connection will be refused.
     79 * Every process that connects to loc must ask one of following
     80 * ports, otherwise connection will be refused.
    6881 *
    6982 */
    7083typedef enum {
    71         /** Connect as device driver */
    72         DEVMAP_DRIVER = 1,
    73         /** Connect as client */
    74         DEVMAP_CLIENT,
     84        /** Service supplier (server) port */
     85        LOC_PORT_SUPPLIER = 1,
     86        /** Service consumer (client) port */
     87        LOC_PORT_CONSUMER,
    7588        /** Create new connection to instance of device that
    7689            is specified by second argument of call. */
    77         DEVMAP_CONNECT_TO_DEVICE
    78 } devmap_interface_t;
     90        LOC_CONNECT_TO_SERVICE
     91} loc_interface_t;
    7992
    8093typedef struct {
    81         devmap_handle_t handle;
    82         char name[DEVMAP_NAME_MAXLEN + 1];
    83 } dev_desc_t;
     94        service_id_t id;
     95        char name[LOC_NAME_MAXLEN + 1];
     96} loc_sdesc_t;
    8497
    8598#endif
     99
     100/** @}
     101 */
  • uspace/lib/c/include/ipc/services.h

    r867e2555 r925a21e  
    4343        SERVICE_NONE       = 0,
    4444        SERVICE_LOAD       = FOURCC('l', 'o', 'a', 'd'),
    45         SERVICE_VIDEO      = FOURCC('v', 'i', 'd', ' '),
    4645        SERVICE_VFS        = FOURCC('v', 'f', 's', ' '),
    47         SERVICE_DEVMAP     = FOURCC('d', 'e', 'v', 'p'),
     46        SERVICE_LOC        = FOURCC('l', 'o', 'c', ' '),
    4847        SERVICE_DEVMAN     = FOURCC('d', 'e', 'v', 'n'),
    4948        SERVICE_IRC        = FOURCC('i', 'r', 'c', ' '),
  • uspace/lib/c/include/ipc/vfs.h

    r867e2555 r925a21e  
    5656        /** Unique identifier of the fs. */
    5757        char name[FS_NAME_MAXLEN + 1];
     58        unsigned int instance;
    5859        bool concurrent_read_write;
    5960        bool write_retains_size;
     
    6263typedef enum {
    6364        VFS_IN_OPEN = IPC_FIRST_USER_METHOD,
    64         VFS_IN_OPEN_NODE,
    6565        VFS_IN_READ,
    6666        VFS_IN_WRITE,
     
    7878        VFS_IN_RENAME,
    7979        VFS_IN_STAT,
    80         VFS_IN_DUP
     80        VFS_IN_DUP,
     81        VFS_IN_WAIT_HANDLE,
    8182} vfs_in_request_t;
    8283
  • uspace/lib/c/include/libc.h

    r867e2555 r925a21e  
    3737
    3838#include <sys/types.h>
    39 #include <kernel/syscall/syscall.h>
     39#include <abi/syscall.h>
    4040#include <libarch/syscall.h>
    4141
  • uspace/lib/c/include/loader/loader.h

    r867e2555 r925a21e  
    3838
    3939#include <task.h>
    40 #include <vfs/vfs.h>
    4140
    4241/** Forward declararion */
     
    5049extern int loader_set_pathname(loader_t *, const char *);
    5150extern int loader_set_args(loader_t *, const char *const[]);
    52 extern int loader_set_files(loader_t *, fdi_node_t *const[]);
     51extern int loader_set_files(loader_t *, int *const[]);
    5352extern int loader_load_program(loader_t *);
    5453extern int loader_run(loader_t *);
  • uspace/lib/c/include/loader/pcb.h

    r867e2555 r925a21e  
    3838
    3939#include <sys/types.h>
    40 #include <vfs/vfs.h>
    4140
    4241typedef void (*entry_point_t)(void);
     
    6261       
    6362        /** Number of preset files. */
    64         int filc;
    65         /** Preset files. */
    66         fdi_node_t **filv;
     63        unsigned int filc;
    6764       
    6865        /*
  • uspace/lib/c/include/rtld/elf_dyn.h

    r867e2555 r925a21e  
    3636#define LIBC_RTLD_ELF_DYN_H_
    3737
    38 #include <arch/elf.h>
    3938#include <sys/types.h>
    40 
    4139#include <elf/elf.h>
    4240#include <libarch/rtld/elf_dyn.h>
  • uspace/lib/c/include/stats.h

    r867e2555 r925a21e  
    4040#include <stdint.h>
    4141#include <bool.h>
    42 #include <kernel/sysinfo/abi.h>
     42#include <sys/types.h>
     43#include <abi/sysinfo.h>
    4344
    4445extern stats_cpu_t *stats_get_cpus(size_t *);
  • uspace/lib/c/include/str.h

    r867e2555 r925a21e  
    11/*
    22 * Copyright (c) 2005 Martin Decky
     3 * Copyright (c) 2011 Oleg Romanenko
    34 * All rights reserved.
    45 *
     
    8384extern char *wstr_to_astr(const wchar_t *src);
    8485extern void str_to_wstr(wchar_t *dest, size_t dlen, const char *src);
     86extern wchar_t *str_to_awstr(const char *src);
     87extern int utf16_to_str(char *dest, size_t size, const uint16_t *src);
     88extern int str_to_utf16(uint16_t *dest, size_t size, const char *src);
    8589
    8690extern char *str_chr(const char *str, wchar_t ch);
     
    9397extern char *str_ndup(const char *, size_t max_size);
    9498
     99extern int str_uint8_t(const char *, char **, unsigned int, bool, uint8_t *);
     100extern int str_uint16_t(const char *, char **, unsigned int, bool, uint16_t *);
     101extern int str_uint32_t(const char *, char **, unsigned int, bool, uint32_t *);
    95102extern int str_uint64(const char *, char **, unsigned int, bool, uint64_t *);
    96103extern int str_size_t(const char *, char **, unsigned int, bool, size_t *);
  • uspace/lib/c/include/sys/stat.h

    r867e2555 r925a21e  
    3939#include <bool.h>
    4040#include <ipc/vfs.h>
    41 #include <ipc/devmap.h>
     41#include <ipc/loc.h>
    4242
    4343struct stat {
    4444        fs_handle_t fs_handle;
    45         devmap_handle_t devmap_handle;
     45        service_id_t service_id;
    4646        fs_index_t index;
    4747        unsigned int lnkcnt;
     
    4949        bool is_directory;
    5050        aoff64_t size;
    51         devmap_handle_t device;
     51        service_id_t service;
    5252};
    5353
  • uspace/lib/c/include/syscall.h

    r867e2555 r925a21e  
    4545
    4646#include <sys/types.h>
    47 #include <kernel/syscall/syscall.h>
     47#include <abi/syscall.h>
    4848
    4949#define __syscall0  __syscall
  • uspace/lib/c/include/sysinfo.h

    r867e2555 r925a21e  
    3636#define LIBC_SYSINFO_H_
    3737
    38 #include <libc.h>
     38#include <sys/types.h>
     39#include <bool.h>
     40#include <abi/sysinfo.h>
    3941
    40 /** Sysinfo value types
    41  *
    42  */
    43 typedef enum {
    44         SYSINFO_VAL_UNDEFINED = 0,
    45         SYSINFO_VAL_VAL = 1,
    46         SYSINFO_VAL_DATA = 2
    47 } sysinfo_item_tag_t;
    48 
    49 extern sysinfo_item_tag_t sysinfo_get_tag(const char *);
     42extern sysinfo_item_val_type_t sysinfo_get_val_type(const char *);
    5043extern int sysinfo_get_value(const char *, sysarg_t *);
    5144extern void *sysinfo_get_data(const char *, size_t *);
  • uspace/lib/c/include/task.h

    r867e2555 r925a21e  
    3737
    3838#include <sys/types.h>
    39 #include <vfs/vfs.h>
    40 
    41 typedef uint64_t task_id_t;
     39#include <abi/proc/task.h>
    4240
    4341typedef enum {
     
    5351extern int task_spawnv(task_id_t *, const char *path, const char *const []);
    5452extern int task_spawnvf(task_id_t *, const char *path, const char *const [],
    55     fdi_node_t *const []);
     53    int *const []);
    5654extern int task_spawnl(task_id_t *, const char *path, ...);
    5755
  • uspace/lib/c/include/thread.h

    r867e2555 r925a21e  
    3838#include <libarch/thread.h>
    3939#include <sys/types.h>
    40 
    41 typedef uint64_t thread_id_t;
     40#include <abi/proc/thread.h>
    4241
    4342extern int thread_create(void (*)(void *), void *, const char *, thread_id_t *);
  • uspace/lib/c/include/udebug.h

    r867e2555 r925a21e  
    3636#define LIBC_UDEBUG_H_
    3737
    38 #include <kernel/udebug/udebug.h>
     38#include <abi/udebug.h>
    3939#include <sys/types.h>
    4040#include <async.h>
  • uspace/lib/c/include/vfs/vfs.h

    r867e2555 r925a21e  
    3838#include <sys/types.h>
    3939#include <ipc/vfs.h>
    40 #include <ipc/devmap.h>
     40#include <ipc/loc.h>
    4141#include <stdio.h>
     42#include <async.h>
    4243
    43 /** Libc version of the VFS triplet.
    44  *
    45  * Unique identification of a file system node
    46  * within a file system instance.
    47  *
    48  */
    49 typedef struct {
    50         fs_handle_t fs_handle;
    51         devmap_handle_t devmap_handle;
    52         fs_index_t index;
    53 } fdi_node_t;
     44enum vfs_change_state_type {
     45        VFS_PASS_HANDLE
     46};
    5447
    5548extern char *absolutize(const char *, size_t *);
    5649
    5750extern int mount(const char *, const char *, const char *, const char *,
    58     unsigned int);
     51    unsigned int, unsigned int);
    5952extern int unmount(const char *);
    6053
    61 extern int open_node(fdi_node_t *, int);
    62 extern int fd_node(int, fdi_node_t *);
     54extern int fhandle(FILE *, int *);
    6355
    64 extern FILE *fopen_node(fdi_node_t *, const char *);
    65 extern int fnode(FILE *, fdi_node_t *);
     56extern int fd_wait(void);
     57
     58extern async_exch_t *vfs_exchange_begin(void);
     59extern void vfs_exchange_end(async_exch_t *);
    6660
    6761#endif
Note: See TracChangeset for help on using the changeset viewer.