kernel: riscv64 patches

Change-Id: I8ebcbaa395cbccb50af08fd2f1b049b5cbb949c7
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3883
Reviewed-by: Fredrik Holmqvist <[email protected]>
Reviewed-by: Adrien Destugues <[email protected]>
Reviewed-by: X512 <[email protected]>
This commit is contained in:
X512
2021-06-07 07:14:23 +00:00
committed by Adrien Destugues
parent b126a077f8
commit d407b17b18
8 changed files with 62 additions and 80 deletions
@@ -13,4 +13,44 @@
#define NUM_IO_VECTORS 256
static inline void
arch_int_enable_interrupts_inline(void)
{
// TODO: implement
}
static inline int
arch_int_disable_interrupts_inline(void)
{
// TODO: implement
return 0;
}
static inline void
arch_int_restore_interrupts_inline(int oldState)
{
// TODO: implement
}
static inline bool
arch_int_are_interrupts_enabled_inline(void)
{
// TODO: implement
return false;
}
// 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_RISCV64_INT_H */
@@ -5,9 +5,13 @@
#ifndef _KERNEL_ARCH_RISCV64_KERNEL_H
#define _KERNEL_ARCH_RISCV64_KERNEL_H
#include <arch/cpu.h>
#warning Review arch_kernel.h
#ifndef _ASSEMBLER
#ifdef __cplusplus
# include <arch/cpu.h>
#endif
#endif
// memory layout
#define KERNEL_LOAD_BASE 0x80000000
@@ -17,25 +21,22 @@
#if defined(__riscv64__)
// Base of the kernel address space.
#define KERNEL_BASE 0xffffff0000000000
#define KERNEL_SIZE 0x10000000000
#define KERNEL_TOP (KERNEL_BASE + (KERNEL_SIZE - 1))
#define KERNEL_BASE (0x0000000000000000 + 0x1000)
#define KERNEL_TOP (0x0000004000000000 - 1)
#define KERNEL_SIZE ((KERNEL_TOP - KERNEL_BASE) + 1)
// Kernel physical memory map area.
#define KERNEL_PMAP_BASE 0xffffff0000000000
#define KERNEL_PMAP_SIZE 0x8000000000
#define KERNEL_PMAP_BASE 0x0000003000000000
#define KERNEL_PMAP_SIZE 0x1000000000
// Userspace address space layout.
// There is a 2MB hole just before the end of the bottom half of the address
// space. This means that if userland passes in a buffer that crosses into the
// uncanonical address region, it will be caught through a page fault.
#define USER_BASE 0x100000
#define USER_BASE 0xffffffc000000000
#define USER_BASE_ANY USER_BASE
#define USER_SIZE (0x800000000000 - (0x200000 + USER_BASE))
#define USER_SIZE 0x0000004000000000
#define USER_TOP (USER_BASE + (USER_SIZE - 1))
#define KERNEL_USER_DATA_BASE 0x7f0000000000
#define USER_STACK_REGION 0x7f0000000000
#define KERNEL_USER_DATA_BASE (USER_BASE + 0x3000000000)
#define USER_STACK_REGION (USER_BASE + 0x3000000000)
#define USER_STACK_REGION_SIZE ((USER_TOP - USER_STACK_REGION) + 1)
#else /* ! __riscv64__ */
@@ -20,19 +20,13 @@
// kernel args
typedef struct {
// architecture specific
uint64 phys_pgdir;
uint64 vir_pgdir;
uint64 next_pagetable;
uint64 virtual_end;
// The virtual ranges we want to keep in the kernel.
uint32 num_virtual_ranges_to_keep;
addr_range virtual_ranges_to_keep[MAX_VIRTUAL_RANGES_TO_KEEP];
// needed for UEFI, otherwise kernel acpi support can't find ACPI root
FixedWidthPointer<void> acpi_root;
FixedWidthPointer<void> fdt;
} _PACKED arch_kernel_args;
#endif /* KERNEL_ARCH_RISCV64_KERNEL_ARGS_H */
@@ -15,6 +15,8 @@
# include <arch/generic/user_memory.h>
#elif defined(__M68K__)
# include <arch/generic/user_memory.h>
#elif defined(__riscv)
# include <arch/generic/user_memory.h>
#else
extern "C" {