forked from NienfengYao/armv8-bare-metal
-
Notifications
You must be signed in to change notification settings - Fork 0
/
psw.h
39 lines (30 loc) · 1.2 KB
/
psw.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/**********************************************************************/
/* OS kernel sample */
/* Copyright 2014 Takeharu KATO */
/* */
/* Processor Status Word */
/* */
/**********************************************************************/
#if !defined(_PSW_H)
#define _PSW_H
#include "aarch64.h"
typedef uint64_t psw_t; /* Processor status word */
/* Allow interrupt to CPU unconditionally */
#define psw_enable_interrupt() enable_irq()
/* Unconditionally prohibit interrupt to CPU */
#define psw_disable_interrupt() disable_irq()
/** Save the PSW
@ param [in] psw PSW storage variable
*/
#define __save_psw(psw) do{ \
psw = raw_read_daif(); \
}while(0)
/** Restore PSW
@ param [in] psw PSW storage variable
*/
#define __restore_psw(psw) do{ \
raw_write_daif(psw); \
}while(0)
void psw_disable_and_save_interrupt(psw_t *);
void psw_restore_interrupt(psw_t *);
#endif /* _PSW_H */