mirror of
https://review.haiku-os.org/haiku
synced 2025-01-19 04:58:51 +01:00
d1c3213a6d
Change-Id: I751d78eb458da16098d236f3829d0c26540fbc17 Reviewed-on: https://review.haiku-os.org/c/haiku/+/5264 Reviewed-by: Adrien Destugues <pulkomandy@gmail.com> Reviewed-by: waddlesplash <waddlesplash@gmail.com> Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
57 lines
1.2 KiB
C
57 lines
1.2 KiB
C
/*
|
|
* Copyright 2018, Jaroslaw Pelczar <jarek@jpelczar.com>
|
|
* Distributed under the terms of the MIT License.
|
|
*/
|
|
#ifndef _KERNEL_ARCH_ARM64_ARCH_INT_H_
|
|
#define _KERNEL_ARCH_ARM64_ARCH_INT_H_
|
|
|
|
|
|
#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, #0xf" : : : "memory");
|
|
}
|
|
|
|
|
|
static inline int
|
|
arch_int_disable_interrupts_inline(void)
|
|
{
|
|
uint32 flags;
|
|
|
|
asm volatile("mrs %0, daif\n" "msr daifset, #0xf" : "=r"(flags) : : "memory");
|
|
|
|
return flags;
|
|
}
|
|
|
|
|
|
static inline void
|
|
arch_int_restore_interrupts_inline(int oldState)
|
|
{
|
|
asm volatile("msr daif, %0" : : "r"(oldState) : "memory");
|
|
}
|
|
|
|
|
|
static inline bool
|
|
arch_int_are_interrupts_enabled_inline(void)
|
|
{
|
|
return (READ_SPECIALREG(DAIF) & 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_ */
|