Subversion Repositories HelenOS

Rev

Rev 2927 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2927 Rev 4345
Line 24... Line 24...
24
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
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
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.
26
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
 */
27
 */
28
 
28
 
29
/** @addtogroup arm32  
29
/** @addtogroup arm32
30
 * @{
30
 * @{
31
 */
31
 */
32
/**
32
/**
33
 * @file
33
 * @file
34
 * @brief Utilities for convenient manipulation with ARM registers.
34
 * @brief Utilities for convenient manipulation with ARM registers.
Line 55... Line 55...
55
/* [CS]PRS manipulation macros */
55
/* [CS]PRS manipulation macros */
56
#define GEN_STATUS_READ(nm,reg) \
56
#define GEN_STATUS_READ(nm,reg) \
57
static inline uint32_t nm## _status_reg_read(void) \
57
static inline uint32_t nm## _status_reg_read(void) \
58
{ \
58
{ \
59
    uint32_t retval; \
59
    uint32_t retval; \
-
 
60
    asm volatile( \
-
 
61
        "mrs %[retval], " #reg \
60
    asm volatile("mrs %0, " #reg : "=r" (retval)); \
62
        : [retval] "=r" (retval) \
-
 
63
    ); \
61
    return retval; \
64
    return retval; \
62
}
65
}
63
 
66
 
64
#define GEN_STATUS_WRITE(nm,reg,fieldname, field) \
67
#define GEN_STATUS_WRITE(nm,reg,fieldname, field) \
65
static inline void nm## _status_reg_ ##fieldname## _write(uint32_t value) \
68
static inline void nm## _status_reg_ ##fieldname## _write(uint32_t value) \
66
{ \
69
{ \
-
 
70
    asm volatile( \
67
    asm volatile("msr " #reg "_" #field ", %0" : : "r" (value)); \
71
        "msr " #reg "_" #field ", %[value]" \
-
 
72
        :: [value] "r" (value) \
-
 
73
    ); \
68
}
74
}
69
 
75
 
70
 
76
 
71
/** Returns the value of CPSR (Current Program Status Register). */
77
/** Returns the value of CPSR (Current Program Status Register). */
72
GEN_STATUS_READ(current, cpsr)
78
GEN_STATUS_READ(current, cpsr)