libdragon
Loading...
Searching...
No Matches
cop1.h
Go to the documentation of this file.
1
16#ifndef __LIBDRAGON_COP1_H
17#define __LIBDRAGON_COP1_H
18
19/* COP1 Control/Status bits definition. Please refer to MIPS R4300 manual. */
20#define C1_FLAG_INEXACT_OP 0x00000004
21#define C1_FLAG_UNDERFLOW 0x00000008
22#define C1_FLAG_OVERFLOW 0x00000010
23#define C1_FLAG_DIV_BY_0 0x00000020
24#define C1_FLAG_INVALID_OP 0x00000040
25
26#define C1_ENABLE_INEXACT_OP 0x00000080
27#define C1_ENABLE_UNDERFLOW 0x00000100
28#define C1_ENABLE_OVERFLOW 0x00000200
29#define C1_ENABLE_DIV_BY_0 0x00000400
30#define C1_ENABLE_INVALID_OP 0x00000800
31#define C1_ENABLE_MASK 0x00000F80
32
33#define C1_CAUSE_INEXACT_OP 0x00001000
34#define C1_CAUSE_UNDERFLOW 0x00002000
35#define C1_CAUSE_OVERFLOW 0x00004000
36#define C1_CAUSE_DIV_BY_0 0x00008000
37#define C1_CAUSE_INVALID_OP 0x00010000
38#define C1_CAUSE_NOT_IMPLEMENTED 0x00020000
39#define C1_CAUSE_MASK 0x0003F000
40
41#define C1_FCR31_FS (1<<24)
42
48#define C1_FCR31() ({ \
49 uint32_t x; \
50 asm volatile("cfc1 %0,$f31":"=r"(x)); \
51 x; \
52})
53
55#define C1_WRITE_FCR31(x) ({ \
56 asm volatile("ctc1 %0,$f31"::"r"(x)); \
57})
58
61#endif