OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [newlib/] [libgloss/] [sparc/] [sparclite.h] - Diff between revs 56 and 57

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

Rev 56 Rev 57
/* SPARClite defs
/* SPARClite defs
 *
 *
 * Copyright (c) 1995 Cygnus Support
 * Copyright (c) 1995 Cygnus Support
 *
 *
 * The authors hereby grant permission to use, copy, modify, distribute,
 * The authors hereby grant permission to use, copy, modify, distribute,
 * and license this software and its documentation for any purpose, provided
 * and license this software and its documentation for any purpose, provided
 * that existing copyright notices are retained in all copies and that this
 * that existing copyright notices are retained in all copies and that this
 * notice is included verbatim in any distributions. No written agreement,
 * notice is included verbatim in any distributions. No written agreement,
 * license, or royalty fee is required for any of the authorized uses.
 * license, or royalty fee is required for any of the authorized uses.
 * Modifications to this software may be copyrighted by their authors
 * Modifications to this software may be copyrighted by their authors
 * and need not follow the licensing terms described here, provided that
 * and need not follow the licensing terms described here, provided that
 * the new terms are clearly indicated on the first page of each file where
 * the new terms are clearly indicated on the first page of each file where
 * they apply.
 * they apply.
 */
 */
 
 
/* Macros for reading and writing to arbitrary address spaces.  Note that ASI
/* Macros for reading and writing to arbitrary address spaces.  Note that ASI
   must be a constant (sorry, but the SPARC can only specify ASIs as part of an
   must be a constant (sorry, but the SPARC can only specify ASIs as part of an
   instruction.  */
   instruction.  */
 
 
#define read_asi(ASI, LOC)                                              \
#define read_asi(ASI, LOC)                                              \
  ({                                                                    \
  ({                                                                    \
    unsigned int val;                                                   \
    unsigned int val;                                                   \
    __asm__ volatile ("lda [%r1]%2,%0" : "=r" (val) : "rJ" (LOC), "I" (ASI)); \
    __asm__ volatile ("lda [%r1]%2,%0" : "=r" (val) : "rJ" (LOC), "I" (ASI)); \
    val;                                                                \
    val;                                                                \
  })
  })
 
 
#define write_asi(ASI, LOC, VAL) \
#define write_asi(ASI, LOC, VAL) \
  __asm__ volatile ("sta %0,[%r1]%2" : : "r" (VAL), "rJ" (LOC), "I" (ASI))
  __asm__ volatile ("sta %0,[%r1]%2" : : "r" (VAL), "rJ" (LOC), "I" (ASI))
 
 
/* Use this when modifying registers that cause memory to be modified.  This
/* Use this when modifying registers that cause memory to be modified.  This
   will cause GCC to reload all values after this point.  */
   will cause GCC to reload all values after this point.  */
 
 
#define write_asi_volatile(ASI, LOC, VAL) \
#define write_asi_volatile(ASI, LOC, VAL) \
  __asm__ volatile ("sta %0,[%r1]%2" : : "r" (VAL), "rJ" (LOC), "I" (ASI) \
  __asm__ volatile ("sta %0,[%r1]%2" : : "r" (VAL), "rJ" (LOC), "I" (ASI) \
                    : "memory")
                    : "memory")
 
 
/* Read the PSR (processor state register). */
/* Read the PSR (processor state register). */
 
 
#define read_psr()                                                      \
#define read_psr()                                                      \
  ({                                                                    \
  ({                                                                    \
    unsigned int psr;                                                   \
    unsigned int psr;                                                   \
    __asm__ ("mov %%psr, %0" : "=r" (psr));                             \
    __asm__ ("mov %%psr, %0" : "=r" (psr));                             \
    psr;                                                                \
    psr;                                                                \
  })
  })
 
 
/* Write the PSR. */
/* Write the PSR. */
 
 
#define write_psr(VAL)                                                  \
#define write_psr(VAL)                                                  \
  __asm__ ("mov %0, %%psr \n nop \n nop \n nop" : : "r" (VAL))
  __asm__ ("mov %0, %%psr \n nop \n nop \n nop" : : "r" (VAL))
 
 
/* Read the specified Ancillary State Register. */
/* Read the specified Ancillary State Register. */
 
 
#define read_asr(REG) read_asr1(REG)
#define read_asr(REG) read_asr1(REG)
#define read_asr1(REG)                                                  \
#define read_asr1(REG)                                                  \
  ({                                                                    \
  ({                                                                    \
    unsigned int val;                                                   \
    unsigned int val;                                                   \
    __asm__ ("rd %%asr" #REG ",%0" : "=r" (val));                       \
    __asm__ ("rd %%asr" #REG ",%0" : "=r" (val));                       \
    val;                                                                \
    val;                                                                \
  })
  })
 
 
/* Write the specified Ancillary State Register. */
/* Write the specified Ancillary State Register. */
 
 
#define write_asr(REG, VAL) write_asr1(REG, VAL)
#define write_asr(REG, VAL) write_asr1(REG, VAL)
#define write_asr1(REG, VAL)                                            \
#define write_asr1(REG, VAL)                                            \
    __asm__ ("wr %0, 0, %%asr" #REG : : "r" (VAL))
    __asm__ ("wr %0, 0, %%asr" #REG : : "r" (VAL))
 
 
/* Set window size for window overflow and underflow trap handlers.  Better to
/* Set window size for window overflow and underflow trap handlers.  Better to
   do this at at compile time than to calculate them at compile time each time
   do this at at compile time than to calculate them at compile time each time
   we get a window overflow/underflow trap.  */
   we get a window overflow/underflow trap.  */
 
 
#ifdef SL933
#ifdef SL933
        asm ("__WINSIZE=6");
        asm ("__WINSIZE=6");
#else
#else
        asm ("__WINSIZE=8");
        asm ("__WINSIZE=8");
#endif
#endif
 
 
#define PSR_INIT   0x10c0       /* Disable traps, set s and ps */
#define PSR_INIT   0x10c0       /* Disable traps, set s and ps */
#define TBR_INIT   0
#define TBR_INIT   0
#define WIM_INIT   2
#define WIM_INIT   2
#define STACK_SIZE 16 * 1024
#define STACK_SIZE 16 * 1024
 
 
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.