[haiku-commits] haiku: hrev53480 - headers/private/kernel/arch/arm64

  • From: waddlesplash <waddlesplash@xxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Fri, 13 Sep 2019 19:07:05 -0400 (EDT)

hrev53480 adds 1 changeset to branch 'master'
old head: a041f1b49c1ac001a15c4119f59c974d3d029d2b
new head: b3a12553f88eee076182bbe4b7479bd3b918fdd9
overview: 
https://git.haiku-os.org/haiku/log/?qt=range&q=b3a12553f88e+%5Ea041f1b49c1a

----------------------------------------------------------------------------

b3a12553f88e: arm64: Implement IRQ masking for kernel
  
  Signed-off-by: Jaroslaw Pelczar <jarek@xxxxxxxxxxxx>
  Change-Id: I05e41f8cd28834e4bcc9f02b4694a640f460cd17
  Reviewed-on: https://review.haiku-os.org/c/haiku/+/1856
  Reviewed-by: waddlesplash <waddlesplash@xxxxxxxxx>

                                   [ Jaroslaw Pelczar <jarek@xxxxxxxxxxxx> ]

----------------------------------------------------------------------------

Revision:    hrev53480
Commit:      b3a12553f88eee076182bbe4b7479bd3b918fdd9
URL:         https://git.haiku-os.org/haiku/commit/?id=b3a12553f88e
Author:      Jaroslaw Pelczar <jarek@xxxxxxxxxxxx>
Date:        Tue Sep  3 16:19:19 2019 UTC
Committer:   waddlesplash <waddlesplash@xxxxxxxxx>
Commit-Date: Fri Sep 13 23:07:02 2019 UTC

----------------------------------------------------------------------------

1 file changed, 48 insertions(+)
headers/private/kernel/arch/arm64/arch_int.h | 48 ++++++++++++++++++++++++

----------------------------------------------------------------------------

diff --git a/headers/private/kernel/arch/arm64/arch_int.h 
b/headers/private/kernel/arch/arm64/arch_int.h
index 55e1afafd6..a1c292d67e 100644
--- a/headers/private/kernel/arch/arm64/arch_int.h
+++ b/headers/private/kernel/arch/arm64/arch_int.h
@@ -7,9 +7,57 @@
 
 
 #include <SupportDefs.h>
+#include <kernel/arch/arm64/arm_registers.h>
 
 
 #define NUM_IO_VECTORS                 1024
 
+static inline void
+arch_int_enable_interrupts_inline(void)
+{
+       __asm__ __volatile__("msr daifclr, #2");
+}
+
+
+static inline int
+arch_int_disable_interrupts_inline(void)
+{
+       uint32 flags;
+
+       __asm__ __volatile__(
+                       "mrs %0, daif\n\t"
+                       "msr daifset, #2\n\t"
+                       : "=&r"(flags));
+
+       return flags;
+}
+
+
+static inline void
+arch_int_restore_interrupts_inline(int oldState)
+{
+       WRITE_SPECIALREG(daif, oldState);
+}
+
+
+static inline bool
+arch_int_are_interrupts_enabled_inline(void)
+{
+       uint32 flags;
+
+       __asm__ __volatile__(
+                       "mrs %0, daif\n\t"
+                       : "=&r"(flags));
+
+       return (flags & PSR_I) == 0;
+}
+
+// map the functions to the inline versions
+#define arch_int_enable_interrupts()   arch_int_enable_interrupts_inline()
+#define arch_int_disable_interrupts()  arch_int_disable_interrupts_inline()
+#define arch_int_restore_interrupts(status)    \
+       arch_int_restore_interrupts_inline(status)
+#define arch_int_are_interrupts_enabled()      \
+       arch_int_are_interrupts_enabled_inline()
 
 #endif /* _KERNEL_ARCH_ARM64_ARCH_INT_H_ */


Other related posts:

  • » [haiku-commits] haiku: hrev53480 - headers/private/kernel/arch/arm64 - waddlesplash