Changeset c621f4aa in mainline for uspace/lib/c/arch/ia32/include


Ignore:
Timestamp:
2010-07-25T10:11:13Z (15 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
377cce8
Parents:
24a2517 (diff), a2da43c (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 with mainline.

Location:
uspace/lib/c/arch/ia32/include
Files:
12 moved

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/arch/ia32/include/atomic.h

    r24a2517 rc621f4aa  
    4040#include <atomicdflt.h>
    4141
    42 static inline void atomic_inc(atomic_t *val) {
    43         asm volatile ("lock incl %0\n" : "+m" (val->count));
     42static inline void atomic_inc(atomic_t *val)
     43{
     44        asm volatile (
     45                "lock incl %[count]\n"
     46                : [count] "+m" (val->count)
     47        );
    4448}
    4549
    46 static inline void atomic_dec(atomic_t *val) {
    47         asm volatile ("lock decl %0\n" : "+m" (val->count));
     50static inline void atomic_dec(atomic_t *val)
     51{
     52        asm volatile (
     53                "lock decl %[count]\n"
     54                : [count] "+m" (val->count)
     55        );
    4856}
    4957
    50 static inline long atomic_postinc(atomic_t *val)
     58static inline atomic_count_t atomic_postinc(atomic_t *val)
    5159{
    52         long r;
    53 
    54         asm volatile (
    55                 "movl $1, %0\n"
    56                 "lock xaddl %0, %1\n"
    57                 : "=r" (r), "+m" (val->count)
    58         );
    59 
    60         return r;
    61 }
    62 
    63 static inline long atomic_postdec(atomic_t *val)
    64 {
    65         long r;
     60        atomic_count_t r = 1;
    6661       
    6762        asm volatile (
    68                 "movl $-1, %0\n"
    69                 "lock xaddl %0, %1\n"
    70                 : "=r" (r), "+m" (val->count)
     63                "lock xaddl %[r], %[count]\n"
     64                : [count] "+m" (val->count),
     65                  [r] "+r" (r)
    7166        );
    7267       
     
    7469}
    7570
    76 #define atomic_preinc(val) (atomic_postinc(val) + 1)
    77 #define atomic_predec(val) (atomic_postdec(val) - 1)
     71static inline atomic_count_t atomic_postdec(atomic_t *val)
     72{
     73        atomic_count_t r = -1;
     74       
     75        asm volatile (
     76                "lock xaddl %[r], %[count]\n"
     77                : [count] "+m" (val->count),
     78                  [r] "+r" (r)
     79        );
     80       
     81        return r;
     82}
     83
     84#define atomic_preinc(val)  (atomic_postinc(val) + 1)
     85#define atomic_predec(val)  (atomic_postdec(val) - 1)
    7886
    7987#endif
  • uspace/lib/c/arch/ia32/include/syscall.h

    r24a2517 rc621f4aa  
    4040#include <kernel/syscall/syscall.h>
    4141
    42 #define __syscall0      __syscall_fast_func
    43 #define __syscall1      __syscall_fast_func
    44 #define __syscall2      __syscall_fast_func
    45 #define __syscall3      __syscall_fast_func
    46 #define __syscall4      __syscall_fast_func
    47 #define __syscall5      __syscall_slow
    48 #define __syscall6      __syscall_slow
     42#define __syscall0  __syscall_fast_func
     43#define __syscall1  __syscall_fast_func
     44#define __syscall2  __syscall_fast_func
     45#define __syscall3  __syscall_fast_func
     46#define __syscall4  __syscall_fast_func
     47#define __syscall5  __syscall_slow
     48#define __syscall6  __syscall_slow
    4949
    50 extern sysarg_t
    51 (* __syscall_fast_func)(const sysarg_t, const sysarg_t, const sysarg_t,
     50extern sysarg_t (* __syscall_fast_func)(const sysarg_t, const sysarg_t,
     51    const sysarg_t, const sysarg_t, const sysarg_t, const sysarg_t,
     52    const syscall_t);
     53
     54extern sysarg_t __syscall_slow(const sysarg_t, const sysarg_t, const sysarg_t,
    5255    const sysarg_t, const sysarg_t, const sysarg_t, const syscall_t);
    53 
    54 extern sysarg_t
    55 __syscall_slow(const sysarg_t, const sysarg_t, const sysarg_t, const sysarg_t,
    56     const sysarg_t, const sysarg_t, const syscall_t);
    5756
    5857#endif
  • uspace/lib/c/arch/ia32/include/tls.h

    r24a2517 rc621f4aa  
    5353{
    5454        void *retval;
    55 
    56         asm ("movl %%gs:0, %0" : "=r"(retval));
     55       
     56        asm (
     57                "movl %%gs:0, %0"
     58                : "=r" (retval)
     59        );
     60       
    5761        return retval;
    5862}
  • uspace/lib/c/arch/ia32/include/types.h

    r24a2517 rc621f4aa  
    3838#define __32_BITS__
    3939
    40 typedef unsigned int sysarg_t;
     40#include <libarch/common.h>
    4141
    42 typedef char int8_t;
    43 typedef short int int16_t;
    44 typedef int int32_t;
    45 typedef long long int int64_t;
     42#define SIZE_MIN  UINT32_MIN
     43#define SIZE_MAX  UINT32_MAX
    4644
    47 typedef unsigned char uint8_t;
    48 typedef unsigned short int uint16_t;
    49 typedef unsigned int uint32_t;
    50 typedef unsigned long long int uint64_t;
     45#define SSIZE_MIN  INT32_MIN
     46#define SSIZE_MAX  INT32_MAX
     47
     48typedef uint32_t sysarg_t;
    5149
    5250typedef int32_t ssize_t;
     
    5452
    5553typedef uint32_t uintptr_t;
     54typedef uint32_t atomic_count_t;
     55typedef int32_t atomic_signed_t;
    5656
    5757#endif
Note: See TracChangeset for help on using the changeset viewer.