Changeset 8fb1bf82 in mainline for uspace/lib/c/arch


Ignore:
Timestamp:
2010-11-25T13:42:50Z (15 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
8df8415
Parents:
a93d79a (diff), eb667613 (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/arch
Files:
27 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/arch/abs32le/include/fibril.h

    ra93d79a r8fb1bf82  
    4444                (ctx)->pc = (uintptr_t) (_pc); \
    4545                (ctx)->sp = ((uintptr_t) (stack)) + (size) - SP_DELTA; \
     46                (ctx)->fp = 0; \
    4647                (ctx)->tls = ((uintptr_t) (ptls)) + sizeof(tcb_t); \
    4748        } while (0)
     
    5354typedef struct {
    5455        uintptr_t sp;
     56        uintptr_t fp;
    5557        uintptr_t pc;
    5658        uintptr_t tls;
    5759} context_t;
     60
     61static inline uintptr_t context_get_fp(context_t *ctx)
     62{
     63        /* On real hardware, this function returns the frame pointer. */
     64        return ctx->fp;
     65}
    5866
    5967#endif
  • uspace/lib/c/arch/abs32le/include/inttypes.h

    ra93d79a r8fb1bf82  
    3434#define LIBC_abs32le_INTTYPES_H_
    3535
    36 #define PRId8 "d"
    37 #define PRId16 "d"
    38 #define PRId32 "d"
    39 #define PRId64 "lld"
    40 #define PRIdPTR "d"
    41 
    42 #define PRIo8 "o"
    43 #define PRIo16 "o"
    44 #define PRIo32 "o"
    45 #define PRIo64 "llo"
    46 #define PRIoPTR "o"
    47 
    48 #define PRIu8 "u"
    49 #define PRIu16 "u"
    50 #define PRIu32 "u"
    51 #define PRIu64 "llu"
    52 #define PRIuPTR "u"
    53 
    54 #define PRIx8 "x"
    55 #define PRIx16 "x"
    56 #define PRIx32 "x"
    57 #define PRIx64 "llx"
    58 #define PRIxPTR "x"
    59 
    60 #define PRIX8 "X"
    61 #define PRIX16 "X"
    62 #define PRIX32 "X"
    63 #define PRIX64 "llX"
    64 #define PRIXPTR "X"
     36#define PRIdPTR  PRId32
     37#define PRIoPTR  PRIo32
     38#define PRIuPTR  PRIu32
     39#define PRIxPTR  PRIx32
     40#define PRIXPTR  PRIX32
    6541
    6642#endif
  • uspace/lib/c/arch/abs32le/include/istate.h

    ra93d79a r8fb1bf82  
    3636#define LIBC_abs32le__ISTATE_H_
    3737
    38 #include <sys/types.h>
    39 
    40 /** Interrupt context.
    41  *
    42  * On real hardware this stores the registers which
    43  * need to be preserved during interupts.
    44  */
    45 typedef struct istate {
    46         uintptr_t ip;
    47         uintptr_t fp;
    48         uint32_t stack[];
    49 } istate_t;
    50 
    51 static inline uintptr_t istate_get_pc(istate_t *istate)
    52 {
    53         return istate->ip;
    54 }
    55 
    56 static inline uintptr_t istate_get_fp(istate_t *istate)
    57 {
    58         return istate->fp;
    59 }
     38#include <arch/istate.h>
    6039
    6140#endif
  • uspace/lib/c/arch/abs32le/src/stacktrace.c

    ra93d79a r8fb1bf82  
    5656uintptr_t stacktrace_fp_get(void)
    5757{
    58         return NULL;
     58        return (uintptr_t) NULL;
    5959}
    6060
    6161uintptr_t stacktrace_pc_get(void)
    6262{
    63         return NULL;
     63        return (uintptr_t) NULL;
    6464}
    6565
  • uspace/lib/c/arch/abs32le/src/tls.c

    ra93d79a r8fb1bf82  
    4646uintptr_t __aeabi_read_tp(void)
    4747{
    48         return NULL;
     48        return (uintptr_t) NULL;
    4949}
    5050
  • uspace/lib/c/arch/amd64/include/fibril.h

    ra93d79a r8fb1bf82  
    5656 */
    5757typedef struct {
    58     uint64_t sp;
    59     uint64_t pc;
    60    
    61     uint64_t rbx;
    62     uint64_t rbp;
     58        uint64_t sp;
     59        uint64_t pc;
    6360
    64     uint64_t r12;
    65     uint64_t r13;
    66     uint64_t r14;
    67     uint64_t r15;
     61        uint64_t rbx;
     62        uint64_t rbp;
    6863
    69     uint64_t tls;
     64        uint64_t r12;
     65        uint64_t r13;
     66        uint64_t r14;
     67        uint64_t r15;
     68
     69        uint64_t tls;
    7070} context_t;
     71
     72static inline uintptr_t context_get_fp(context_t *ctx)
     73{
     74        return ctx->rbp;
     75}
    7176
    7277#endif
  • uspace/lib/c/arch/amd64/include/inttypes.h

    ra93d79a r8fb1bf82  
    4141#define LIBC_amd64_INTTYPES_H_
    4242
    43 #define PRId8 "d"
    44 #define PRId16 "d"
    45 #define PRId32 "d"
    46 #define PRId64 "lld"
    47 #define PRIdPTR "lld"
    48 
    49 #define PRIo8 "o"
    50 #define PRIo16 "o"
    51 #define PRIo32 "o"
    52 #define PRIo64 "llo"
    53 #define PRIoPTR "llo"
    54 
    55 #define PRIu8 "u"
    56 #define PRIu16 "u"
    57 #define PRIu32 "u"
    58 #define PRIu64 "llu"
    59 #define PRIuPTR "llu"
    60 
    61 #define PRIx8 "x"
    62 #define PRIx16 "x"
    63 #define PRIx32 "x"
    64 #define PRIx64 "llx"
    65 #define PRIxPTR "llx"
    66 
    67 #define PRIX8 "X"
    68 #define PRIX16 "X"
    69 #define PRIX32 "X"
    70 #define PRIX64 "llX"
    71 #define PRIXPTR "llX"
     43#define PRIdPTR  PRId64
     44#define PRIoPTR  PRIo64
     45#define PRIuPTR  PRIu64
     46#define PRIxPTR  PRIx64
     47#define PRIXPTR  PRIX64
    7248
    7349#endif
  • uspace/lib/c/arch/amd64/include/istate.h

    ra93d79a r8fb1bf82  
    3636#define LIBC_amd64_ISTATE_H_
    3737
    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         uint64_t rax;
    46         uint64_t rcx;
    47         uint64_t rdx;
    48         uint64_t rsi;
    49         uint64_t rdi;
    50         uint64_t r8;
    51         uint64_t r9;
    52         uint64_t r10;
    53         uint64_t r11;
    54         uint64_t rbp;
    55         uint64_t error_word;
    56         uint64_t rip;
    57         uint64_t cs;
    58         uint64_t rflags;
    59         uint64_t stack[]; /* Additional data on stack */
    60 } istate_t;
    61 
    62 static inline uintptr_t istate_get_pc(istate_t *istate)
    63 {
    64         return istate->rip;
    65 }
    66 
    67 static inline uintptr_t istate_get_fp(istate_t *istate)
    68 {
    69         return istate->rbp;
    70 }
     38#include <arch/istate.h>
    7139
    7240#endif
  • uspace/lib/c/arch/amd64/src/entry.s

    ra93d79a r8fb1bf82  
    4242        #
    4343        pushq $0
    44         mov %rsp, %rbp
     44        movq %rsp, %rbp
    4545       
    4646        # %rdi was deliberately chosen as the first argument is also in %rdi
  • uspace/lib/c/arch/amd64/src/fibril.S

    ra93d79a r8fb1bf82  
    4949        movq %rax, OFFSET_TLS(%rdi)
    5050               
    51         xorq %rax,%rax          # context_save returns 1
    52         incq %rax
     51        xorl %eax, %eax         # context_save returns 1
     52        incl %eax
    5353        ret
    5454
     
    6767        # Set thread local storage
    6868        movq OFFSET_TLS(%rdi), %rdi   # Set arg1 to TLS addr
    69         movq $1, %rax           # SYS_TLS_SET
     69        movl $1, %eax           # SYS_TLS_SET
    7070        syscall
    7171
    72         xorq %rax,%rax          # context_restore returns 0
     72        xorl %eax, %eax         # context_restore returns 0
    7373        ret
  • uspace/lib/c/arch/arm32/include/fibril.h

    ra93d79a r8fb1bf82  
    8686} context_t;
    8787
     88static inline uintptr_t context_get_fp(context_t *ctx)
     89{
     90        return ctx->fp;
     91}
     92
    8893
    8994#endif
  • uspace/lib/c/arch/arm32/include/inttypes.h

    ra93d79a r8fb1bf82  
    4141#define LIBC_arm32_INTTYPES_H_
    4242
    43 #define PRId8 "d"
    44 #define PRId16 "d"
    45 #define PRId32 "d"
    46 #define PRId64 "lld"
    47 #define PRIdPTR "d"
    48 
    49 #define PRIo8 "o"
    50 #define PRIo16 "o"
    51 #define PRIo32 "o"
    52 #define PRIo64 "llo"
    53 #define PRIoPTR "o"
    54 
    55 #define PRIu8 "u"
    56 #define PRIu16 "u"
    57 #define PRIu32 "u"
    58 #define PRIu64 "llu"
    59 #define PRIuPTR "u"
    60 
    61 #define PRIx8 "x"
    62 #define PRIx16 "x"
    63 #define PRIx32 "x"
    64 #define PRIx64 "llx"
    65 #define PRIxPTR "x"
    66 
    67 #define PRIX8 "X"
    68 #define PRIX16 "X"
    69 #define PRIX32 "X"
    70 #define PRIX64 "llX"
    71 #define PRIXPTR "X"
     43#define PRIdPTR  PRId32
     44#define PRIoPTR  PRIo32
     45#define PRIuPTR  PRIu32
     46#define PRIxPTR  PRIx32
     47#define PRIXPTR  PRIX32
    7248
    7349#endif
  • uspace/lib/c/arch/arm32/include/istate.h

    ra93d79a r8fb1bf82  
    3636#define LIBC_arm32__ISTATE_H_
    3737
    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 spsr;
    46         uint32_t sp;
    47         uint32_t lr;
    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 fp;
    61         uint32_t r12;
    62 
    63         uint32_t pc;
    64 } istate_t;
    65 
    66 static inline uintptr_t istate_get_pc(istate_t *istate)
    67 {
    68         return istate->pc;
    69 }
    70 
    71 static inline uintptr_t istate_get_fp(istate_t *istate)
    72 {
    73         return istate->fp;
    74 }
     38#include <arch/istate.h>
    7539
    7640#endif
  • uspace/lib/c/arch/ia32/include/fibril.h

    ra93d79a r8fb1bf82  
    6767} context_t;
    6868
     69static inline uintptr_t context_get_fp(context_t *ctx)
     70{
     71        return ctx->ebp;
     72}
     73
    6974#endif
    7075
  • uspace/lib/c/arch/ia32/include/inttypes.h

    ra93d79a r8fb1bf82  
    4141#define LIBC_ia32_INTTYPES_H_
    4242
    43 #define PRId8 "d"
    44 #define PRId16 "d"
    45 #define PRId32 "d"
    46 #define PRId64 "lld"
    47 #define PRIdPTR "d"
    48 
    49 #define PRIo8 "o"
    50 #define PRIo16 "o"
    51 #define PRIo32 "o"
    52 #define PRIo64 "llo"
    53 #define PRIoPTR "o"
    54 
    55 #define PRIu8 "u"
    56 #define PRIu16 "u"
    57 #define PRIu32 "u"
    58 #define PRIu64 "llu"
    59 #define PRIuPTR "u"
    60 
    61 #define PRIx8 "x"
    62 #define PRIx16 "x"
    63 #define PRIx32 "x"
    64 #define PRIx64 "llx"
    65 #define PRIxPTR "x"
    66 
    67 #define PRIX8 "X"
    68 #define PRIX16 "X"
    69 #define PRIX32 "X"
    70 #define PRIX64 "llX"
    71 #define PRIXPTR "X"
     43#define PRIdPTR  PRId32
     44#define PRIoPTR  PRIo32
     45#define PRIuPTR  PRIu32
     46#define PRIxPTR  PRIx32
     47#define PRIXPTR  PRIX32
    7248
    7349#endif
  • uspace/lib/c/arch/ia32/include/istate.h

    ra93d79a r8fb1bf82  
    3636#define LIBC_ia32__ISTATE_H_
    3737
    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 eax;
    46         uint32_t ecx;
    47         uint32_t edx;
    48         uint32_t ebp;
    49 
    50         uint32_t gs;
    51         uint32_t fs;
    52         uint32_t es;
    53         uint32_t ds;
    54 
    55         uint32_t error_word;
    56         uint32_t eip;
    57         uint32_t cs;
    58         uint32_t eflags;
    59         uint32_t stack[];
    60 } istate_t;
    61 
    62 static inline uintptr_t istate_get_pc(istate_t *istate)
    63 {
    64         return istate->eip;
    65 }
    66 
    67 static inline uintptr_t istate_get_fp(istate_t *istate)
    68 {
    69         return istate->ebp;
    70 }
     38#include <arch/istate.h>
    7139
    7240#endif
  • uspace/lib/c/arch/ia64/include/fibril.h

    ra93d79a r8fb1bf82  
    130130} context_t;
    131131
     132static inline uintptr_t context_get_fp(context_t *ctx)
     133{
     134        return 0;       /* FIXME */
     135}
     136
    132137#endif
    133138
  • uspace/lib/c/arch/ia64/include/inttypes.h

    ra93d79a r8fb1bf82  
    4141#define LIBC_ia64_INTTYPES_H_
    4242
    43 #define PRId8 "d"
    44 #define PRId16 "d"
    45 #define PRId32 "d"
    46 #define PRId64 "ld"
    47 #define PRIdPTR "ld"
    48 
    49 #define PRIo8 "o"
    50 #define PRIo16 "o"
    51 #define PRIo32 "o"
    52 #define PRIo64 "lo"
    53 #define PRIoPTR "lo"
    54 
    55 #define PRIu8 "u"
    56 #define PRIu16 "u"
    57 #define PRIu32 "u"
    58 #define PRIu64 "lu"
    59 #define PRIuPTR "lu"
    60 
    61 #define PRIx8 "x"
    62 #define PRIx16 "x"
    63 #define PRIx32 "x"
    64 #define PRIx64 "lx"
    65 #define PRIxPTR "lx"
    66 
    67 #define PRIX8 "X"
    68 #define PRIX16 "X"
    69 #define PRIX32 "X"
    70 #define PRIX64 "lX"
    71 #define PRIXPTR "lX"
     43#define PRIdPTR  PRId64
     44#define PRIoPTR  PRIo64
     45#define PRIuPTR  PRIu64
     46#define PRIxPTR  PRIx64
     47#define PRIXPTR  PRIX64
    7248
    7349#endif
  • uspace/lib/c/arch/ia64/include/istate.h

    ra93d79a r8fb1bf82  
    3636#define LIBC_ia64_ISTATE_H_
    3737
    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         /* TODO */
    46 } istate_t;
    47 
    48 static inline uintptr_t istate_get_pc(istate_t *istate)
    49 {
    50         /* TODO */
    51         return 0;
    52 }
    53 
    54 static inline uintptr_t istate_get_fp(istate_t *istate)
    55 {
    56         /* TODO */
    57         return 0;
    58 }
     38#include <arch/istate.h>
    5939
    6040#endif
  • uspace/lib/c/arch/mips32/include/fibril.h

    ra93d79a r8fb1bf82  
    8585} context_t;
    8686
     87static inline uintptr_t context_get_fp(context_t *ctx)
     88{
     89        return ctx->sp;
     90}
     91
    8792#endif
    8893
  • uspace/lib/c/arch/mips32/include/inttypes.h

    ra93d79a r8fb1bf82  
    4141#define LIBC_mips32_INTTYPES_H_
    4242
    43 #define PRId8 "d"
    44 #define PRId16 "d"
    45 #define PRId32 "d"
    46 #define PRId64 "lld"
    47 #define PRIdPTR "d"
    48 
    49 #define PRIo8 "o"
    50 #define PRIo16 "o"
    51 #define PRIo32 "o"
    52 #define PRIo64 "llo"
    53 #define PRIoPTR "o"
    54 
    55 #define PRIu8 "u"
    56 #define PRIu16 "u"
    57 #define PRIu32 "u"
    58 #define PRIu64 "llu"
    59 #define PRIuPTR "u"
    60 
    61 #define PRIx8 "x"
    62 #define PRIx16 "x"
    63 #define PRIx32 "x"
    64 #define PRIx64 "llx"
    65 #define PRIxPTR "x"
    66 
    67 #define PRIX8 "X"
    68 #define PRIX16 "X"
    69 #define PRIX32 "X"
    70 #define PRIX64 "llX"
    71 #define PRIXPTR "x"
     43#define PRIdPTR  PRId32
     44#define PRIoPTR  PRIo32
     45#define PRIuPTR  PRIu32
     46#define PRIxPTR  PRIx32
     47#define PRIXPTR  PRIX32
    7248
    7349#endif
  • uspace/lib/c/arch/mips32/include/istate.h

    ra93d79a r8fb1bf82  
    3636#define LIBC_mips32__ISTATE_H_
    3737
    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 at;
    46         uint32_t v0;
    47         uint32_t v1;
    48         uint32_t a0;
    49         uint32_t a1;
    50         uint32_t a2;
    51         uint32_t a3;
    52         uint32_t t0;
    53         uint32_t t1;
    54         uint32_t t2;
    55         uint32_t t3;
    56         uint32_t t4;
    57         uint32_t t5;
    58         uint32_t t6;
    59         uint32_t t7;
    60         uint32_t t8;
    61         uint32_t t9;
    62         uint32_t gp;
    63         uint32_t sp;
    64         uint32_t ra;
    65 
    66         uint32_t lo;
    67         uint32_t hi;
    68 
    69         uint32_t status; /* cp0_status */
    70         uint32_t epc; /* cp0_epc */
    71         uint32_t k1; /* We use it as thread-local pointer */
    72 } istate_t;
    73 
    74 static inline uintptr_t istate_get_pc(istate_t *istate)
    75 {
    76         return istate->epc;
    77 }
    78 
    79 static inline uintptr_t istate_get_fp(istate_t *istate)
    80 {
    81         /* TODO */
    82         return 0;
    83 }
     38#include <arch/istate.h>
    8439
    8540#endif
  • uspace/lib/c/arch/ppc32/include/fibril.h

    ra93d79a r8fb1bf82  
    7878} __attribute__ ((packed)) context_t;
    7979
     80static inline uintptr_t context_get_fp(context_t *ctx)
     81{
     82        return ctx->sp;
     83}
     84
    8085#endif
    8186
  • uspace/lib/c/arch/ppc32/include/inttypes.h

    ra93d79a r8fb1bf82  
    4141#define LIBC_ppc32_INTTYPES_H_
    4242
    43 #define PRId8 "d"
    44 #define PRId16 "d"
    45 #define PRId32 "d"
    46 #define PRId64 "lld"
    47 #define PRIdPTR "d"
    48 
    49 #define PRIo8 "o"
    50 #define PRIo16 "o"
    51 #define PRIo32 "o"
    52 #define PRIo64 "llo"
    53 #define PRIoPTR "o"
    54 
    55 #define PRIu8 "u"
    56 #define PRIu16 "u"
    57 #define PRIu32 "u"
    58 #define PRIu64 "llu"
    59 #define PRIuPTR "u"
    60 
    61 #define PRIx8 "x"
    62 #define PRIx16 "x"
    63 #define PRIx32 "x"
    64 #define PRIx64 "llx"
    65 #define PRIxPTR "x"
    66 
    67 #define PRIX8 "X"
    68 #define PRIX16 "X"
    69 #define PRIX32 "X"
    70 #define PRIX64 "llX"
    71 #define PRIXPTR "X"
     43#define PRIdPTR  PRId32
     44#define PRIoPTR  PRIo32
     45#define PRIuPTR  PRIu32
     46#define PRIxPTR  PRIx32
     47#define PRIXPTR  PRIX32
    7248
    7349#endif
  • uspace/lib/c/arch/sparc64/include/fibril.h

    ra93d79a r8fb1bf82  
    7777} context_t;
    7878
     79static inline uintptr_t context_get_fp(context_t *ctx)
     80{
     81        return ctx->sp + STACK_BIAS;
     82}
     83
    7984#endif
    8085
  • uspace/lib/c/arch/sparc64/include/inttypes.h

    ra93d79a r8fb1bf82  
    4141#define LIBC_sparc64_INTTYPES_H_
    4242
    43 #define PRId8 "d"
    44 #define PRId16 "d"
    45 #define PRId32 "d"
    46 #define PRId64 "lld"
    47 #define PRIdPTR "lld"
    48 
    49 #define PRIo8 "o"
    50 #define PRIo16 "o"
    51 #define PRIo32 "o"
    52 #define PRIo64 "llo"
    53 #define PRIoPTR "llo"
    54 
    55 #define PRIu8 "u"
    56 #define PRIu16 "u"
    57 #define PRIu32 "u"
    58 #define PRIu64 "llu"
    59 #define PRIuPTR "llu"
    60 
    61 #define PRIx8 "x"
    62 #define PRIx16 "x"
    63 #define PRIx32 "x"
    64 #define PRIx64 "llx"
    65 #define PRIxPTR "llx"
    66 
    67 #define PRIX8 "X"
    68 #define PRIX16 "X"
    69 #define PRIX32 "X"
    70 #define PRIX64 "llX"
    71 #define PRIXPTR "llX"
     43#define PRIdPTR  PRId64
     44#define PRIoPTR  PRIo64
     45#define PRIuPTR  PRIu64
     46#define PRIxPTR  PRIx64
     47#define PRIXPTR  PRIX64
    7248
    7349#endif
  • uspace/lib/c/arch/sparc64/include/istate.h

    ra93d79a r8fb1bf82  
    3636#define LIBC_sparc64_ISTATE_H_
    3737
    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         /* TODO */
    46 } istate_t;
    47 
    48 static inline uintptr_t istate_get_pc(istate_t *istate)
    49 {
    50         /* TODO */
    51         return 0;
    52 }
    53 
    54 static inline uintptr_t istate_get_fp(istate_t *istate)
    55 {
    56         /* TODO */
    57         return 0;
    58 }
     38#include <arch/istate.h>
    5939
    6040#endif
Note: See TracChangeset for help on using the changeset viewer.