haiku/headers/private/kernel/arch/riscv64/arch_cpu.h
Augustin Cavalier 6f88de113d kernel: Rename set/clear_ac to arch_cpu_enable/disable_user_access.
These are architecture-specific routines, so they deserve proper
architecture-specific naming. The user memory access routines are
already under arch_cpu (arch_cpu_user_memcpy, etc.), and the methods
usually change a CPU flag, so it makes sense to put these there too.

RISC-V had get_ac but nothing else defined or used it, so it's removed.

No functional change intended.

Change-Id: Id4715214e32f73d4a93bc7ba8249411a0878d174
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8106
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Reviewed-by: X512 X512 <danger_mail@list.ru>
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
2024-08-26 19:39:28 +00:00

66 lines
965 B
C

/*
* Copyright 2003-2004, Axel Dörfler, axeld@pinc-software.de.
* Copyright 2019, Adrien Destugues, pulkomandy@pulkomandy.tk.
* Distributed under the terms of the MIT License.
*/
#ifndef _KERNEL_ARCH_RISCV64_CPU_H
#define _KERNEL_ARCH_RISCV64_CPU_H
#include <arch/riscv64/arch_thread_types.h>
#include <arch_cpu_defs.h>
#include <kernel.h>
#define CPU_MAX_CACHE_LEVEL 8
#define CACHE_LINE_SIZE 64
static inline void
arch_cpu_enable_user_access()
{
SetBitsSstatus(SstatusReg{.sum = 1}.val);
}
static inline void
arch_cpu_disable_user_access()
{
ClearBitsSstatus(SstatusReg{.sum = 1}.val);
}
typedef struct arch_cpu_info {
uint64 hartId;
} arch_cpu_info;
#ifdef __cplusplus
extern "C" {
#endif
void __riscv64_setup_system_time(uint64 conversionFactor);
static inline void
arch_cpu_pause(void)
{
// TODO: CPU pause
}
static inline void
arch_cpu_idle(void)
{
Wfi();
}
#ifdef __cplusplus
}
#endif
#endif /* _KERNEL_ARCH_RISCV64_CPU_H */