Changeset 371bd7d in mainline for kernel/arch/arm32/include


Ignore:
Timestamp:
2010-03-27T09:22:17Z (16 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
36a75a2
Parents:
cd82bb1 (diff), eaf22d4 (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:
kernel/arch/arm32/include
Files:
1 added
15 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/arm32/include/asm.h

    rcd82bb1 r371bd7d  
    3838
    3939#include <typedefs.h>
    40 #include <arch/types.h>
    4140#include <arch/stack.h>
    4241#include <config.h>
     
    9695}
    9796
    98 extern void cpu_halt(void);
     97extern void cpu_halt(void) __attribute__((noreturn));
    9998extern void asm_delay_loop(uint32_t t);
    10099extern void userspace_asm(uintptr_t ustack, uintptr_t uspace_uarg,
  • kernel/arch/arm32/include/atomic.h

    rcd82bb1 r371bd7d  
    3737#define KERN_arm32_ATOMIC_H_
    3838
     39#include <arch/asm.h>
     40
    3941/** Atomic addition.
    4042 *
     
    4547 *
    4648 */
    47 static inline long atomic_add(atomic_t *val, int i)
     49static inline atomic_count_t atomic_add(atomic_t *val, atomic_count_t i)
    4850{
    49         int ret;
    50         volatile long *mem = &(val->count);
    51        
    52         asm volatile (
    53                 "1:\n"
    54                         "ldr r2, [%[mem]]\n"
    55                         "add r3, r2, %[i]\n"
    56                         "str r3, %[ret]\n"
    57                         "swp r3, r3, [%[mem]]\n"
    58                         "cmp r3, r2\n"
    59                         "bne 1b\n"
    60                 : [ret] "=m" (ret)
    61                 : [mem] "r" (mem), [i] "r" (i)
    62                 : "r3", "r2"
    63         );
     51        /*
     52         * This implementation is for UP pre-ARMv6 systems where we do not have
     53         * the LDREX and STREX instructions.
     54         */
     55        ipl_t ipl = interrupts_disable();
     56        val->count += i;
     57        atomic_count_t ret = val->count;
     58        interrupts_restore(ipl);
    6459       
    6560        return ret;
     
    6964 *
    7065 * @param val Variable to be incremented.
     66 *
    7167 */
    7268static inline void atomic_inc(atomic_t *val)
     
    7874 *
    7975 * @param val Variable to be decremented.
     76 *
    8077 */
    8178static inline void atomic_dec(atomic_t *val) {
     
    8784 * @param val Variable to be incremented.
    8885 * @return    Value after incrementation.
     86 *
    8987 */
    90 static inline long atomic_preinc(atomic_t *val)
     88static inline atomic_count_t atomic_preinc(atomic_t *val)
    9189{
    9290        return atomic_add(val, 1);
     
    9795 * @param val Variable to be decremented.
    9896 * @return    Value after decrementation.
     97 *
    9998 */
    100 static inline long atomic_predec(atomic_t *val)
     99static inline atomic_count_t atomic_predec(atomic_t *val)
    101100{
    102101        return atomic_add(val, -1);
     
    107106 * @param val Variable to be incremented.
    108107 * @return    Value before incrementation.
     108 *
    109109 */
    110 static inline long atomic_postinc(atomic_t *val)
     110static inline atomic_count_t atomic_postinc(atomic_t *val)
    111111{
    112112        return atomic_add(val, 1) - 1;
     
    117117 * @param val Variable to be decremented.
    118118 * @return    Value before decrementation.
     119 *
    119120 */
    120 static inline long atomic_postdec(atomic_t *val)
     121static inline atomic_count_t atomic_postdec(atomic_t *val)
    121122{
    122123        return atomic_add(val, -1) + 1;
  • kernel/arch/arm32/include/context.h

    rcd82bb1 r371bd7d  
    4343#define SP_DELTA  (0 + ALIGN_UP(STACK_ITEM_SIZE, STACK_ALIGNMENT))
    4444
     45#define context_set(c, _pc, stack, size) \
     46        do { \
     47                (c)->pc = (uintptr_t) (_pc); \
     48                (c)->sp = ((uintptr_t) (stack)) + (size) - SP_DELTA; \
     49                (c)->fp = 0; \
     50        } while (0)
     51
    4552#ifndef __ASM__
    4653
    47 #include <arch/types.h>
     54#include <typedefs.h>
    4855
    4956/** Thread context containing registers that must be preserved across function
     
    6269        uint32_t r9;
    6370        uint32_t r10;
    64         uint32_t r11;
     71        uint32_t fp;    /* r11 */
    6572       
    6673        ipl_t ipl;
  • kernel/arch/arm32/include/cpu.h

    rcd82bb1 r371bd7d  
    3737#define KERN_arm32_CPU_H_
    3838
    39 #include <arch/types.h>
     39#include <typedefs.h>
    4040#include <arch/asm.h>
    4141
  • kernel/arch/arm32/include/exception.h

    rcd82bb1 r371bd7d  
    3838#define KERN_arm32_EXCEPTION_H_
    3939
    40 #include <arch/types.h>
     40#include <typedefs.h>
    4141#include <arch/regutils.h>
    4242
     
    8686
    8787/** Struct representing CPU state saved when an exception occurs. */
    88 typedef struct {
     88typedef struct istate {
    8989        uint32_t spsr;
    9090        uint32_t sp;
     
    102102        uint32_t r9;
    103103        uint32_t r10;
    104         uint32_t r11;
     104        uint32_t fp;
    105105        uint32_t r12;
    106106
     
    133133}
    134134
     135static inline unative_t istate_get_fp(istate_t *istate)
     136{
     137        return istate->fp;
     138}
     139
    135140
    136141extern void install_exception_handlers(void);
  • kernel/arch/arm32/include/faddr.h

    rcd82bb1 r371bd7d  
    3737#define KERN_arm32_FADDR_H_
    3838
    39 #include <arch/types.h>
     39#include <typedefs.h>
    4040
    4141/** Calculate absolute address of function referenced by fptr pointer.
  • kernel/arch/arm32/include/fpu_context.h

    rcd82bb1 r371bd7d  
    3939#define KERN_arm32_FPU_CONTEXT_H_
    4040
    41 #include <arch/types.h>
     41#include <typedefs.h>
    4242
    4343#define FPU_CONTEXT_ALIGN    0
  • kernel/arch/arm32/include/interrupt.h

    rcd82bb1 r371bd7d  
    3737#define KERN_arm32_INTERRUPT_H_
    3838
    39 #include <arch/types.h>
     39#include <typedefs.h>
    4040#include <arch/exception.h>
    4141
  • kernel/arch/arm32/include/machine_func.h

    rcd82bb1 r371bd7d  
    4343
    4444#include <console/console.h>
    45 #include <arch/types.h>
     45#include <typedefs.h>
    4646#include <arch/exception.h>
    4747
  • kernel/arch/arm32/include/memstr.h

    rcd82bb1 r371bd7d  
    2727 */
    2828
    29 /** @addtogroup arm32   
     29/** @addtogroup arm32
    3030 * @{
    3131 */
     
    3939#define memcpy(dst, src, cnt)  __builtin_memcpy((dst), (src), (cnt))
    4040
    41 extern void memsetw(void *dst, size_t cnt, uint16_t x);
    42 extern void memsetb(void *dst, size_t cnt, uint8_t x);
    43 
    44 extern int memcmp(const void *a, const void *b, size_t cnt);
     41extern void memsetw(void *, size_t, uint16_t);
     42extern void memsetb(void *, size_t, uint8_t);
    4543
    4644#endif
  • kernel/arch/arm32/include/mm/as.h

    rcd82bb1 r371bd7d  
    5454#define as_destructor_arch(as)                  (as != as)
    5555#define as_create_arch(as, flags)               (as != as)
    56 #define as_install_arch(as)
    5756#define as_deinstall_arch(as)
    5857#define as_invalidate_translation_cache(as, page, cnt)
  • kernel/arch/arm32/include/mm/asid.h

    rcd82bb1 r371bd7d  
    3939#define KERN_arm32_ASID_H_
    4040
    41 #include <arch/types.h>
     41#include <typedefs.h>
    4242
    4343#define ASID_MAX_ARCH           3       /* minimal required number */
  • kernel/arch/arm32/include/mm/frame.h

    rcd82bb1 r371bd7d  
    4343#ifndef __ASM__
    4444
    45 #include <arch/types.h>
     45#include <typedefs.h>
    4646
    4747#define BOOT_PAGE_TABLE_SIZE     0x4000
  • kernel/arch/arm32/include/mm/page_fault.h

    rcd82bb1 r371bd7d  
    3737#define KERN_arm32_PAGE_FAULT_H_
    3838
    39 #include <arch/types.h>
     39#include <typedefs.h>
    4040
    4141
  • kernel/arch/arm32/include/types.h

    rcd82bb1 r371bd7d  
    2727 */
    2828
    29 /** @addtogroup arm32   
     29/** @addtogroup arm32
    3030 * @{
    3131 */
     
    3838
    3939#ifndef DOXYGEN
    40 #       define ATTRIBUTE_PACKED __attribute__ ((packed))
     40        #define ATTRIBUTE_PACKED __attribute__((packed))
    4141#else
    42 #       define ATTRIBUTE_PACKED
     42        #define ATTRIBUTE_PACKED
    4343#endif
    44 
    45 typedef signed char int8_t;
    46 typedef signed short int16_t;
    47 typedef signed long int32_t;
    48 typedef signed long long int64_t;
    49 
    50 typedef unsigned char uint8_t;
    51 typedef unsigned short uint16_t;
    52 typedef unsigned long uint32_t;
    53 typedef unsigned long long uint64_t;
    5444
    5545typedef uint32_t size_t;
     
    6252typedef uint32_t unative_t;
    6353typedef int32_t native_t;
     54typedef uint32_t atomic_count_t;
    6455
    6556typedef struct {
    6657} fncptr_t;
    6758
    68 #define PRIp "x"        /**< Format for uintptr_t. */
    69 #define PRIs "u"        /**< Format for size_t. */
     59#define PRIp "x"  /**< Format for uintptr_t. */
     60#define PRIs "u"  /**< Format for size_t. */
    7061
    71 #define PRId8 "d"       /**< Format for int8_t. */
    72 #define PRId16 "d"      /**< Format for int16_t. */
    73 #define PRId32 "d"      /**< Format for int32_t. */
    74 #define PRId64 "lld"    /**< Format for int64_t. */
    75 #define PRIdn "d"       /**< Format for native_t. */
     62#define PRId8 "d"     /**< Format for int8_t. */
     63#define PRId16 "d"    /**< Format for int16_t. */
     64#define PRId32 "d"    /**< Format for int32_t. */
     65#define PRId64 "lld"  /**< Format for int64_t. */
     66#define PRIdn "d"     /**< Format for native_t. */
    7667
    77 #define PRIu8 "u"       /**< Format for uint8_t. */
    78 #define PRIu16 "u"      /**< Format for uint16_t. */
    79 #define PRIu32 "u"      /**< Format for uint32_t. */
    80 #define PRIu64 "llu"    /**< Format for uint64_t. */
    81 #define PRIun "u"       /**< Format for unative_t. */
     68#define PRIu8 "u"     /**< Format for uint8_t. */
     69#define PRIu16 "u"    /**< Format for uint16_t. */
     70#define PRIu32 "u"    /**< Format for uint32_t. */
     71#define PRIu64 "llu"  /**< Format for uint64_t. */
     72#define PRIun "u"     /**< Format for unative_t. */
    8273
    83 #define PRIx8 "x"       /**< Format for hexadecimal (u)int8_t. */
    84 #define PRIx16 "x"      /**< Format for hexadecimal (u)int16_t. */
    85 #define PRIx32 "x"      /**< Format for hexadecimal (u)uint32_t. */
    86 #define PRIx64 "llx"    /**< Format for hexadecimal (u)int64_t. */
    87 #define PRIxn "x"       /**< Format for hexadecimal (u)native_t. */
     74#define PRIx8 "x"     /**< Format for hexadecimal (u)int8_t. */
     75#define PRIx16 "x"    /**< Format for hexadecimal (u)int16_t. */
     76#define PRIx32 "x"    /**< Format for hexadecimal (u)uint32_t. */
     77#define PRIx64 "llx"  /**< Format for hexadecimal (u)int64_t. */
     78#define PRIxn "x"     /**< Format for hexadecimal (u)native_t. */
    8879
    8980#endif
Note: See TracChangeset for help on using the changeset viewer.