allow cpu_regs.h to be included in .S files

Signed-off-by: Sven Peter <sven@svenpeter.dev>
This commit is contained in:
Sven Peter 2021-05-08 14:54:07 +02:00 committed by Hector Martin
parent 813e40f4ca
commit 36efdd2ac3
5 changed files with 9 additions and 4 deletions

View file

@ -1,6 +1,6 @@
/* SPDX-License-Identifier: MIT */ /* SPDX-License-Identifier: MIT */
#include "utils.h" #include "types.h"
#define SYS_CNTHCTL_EL2 sys_reg(3, 4, 14, 1, 0) #define SYS_CNTHCTL_EL2 sys_reg(3, 4, 14, 1, 0)
// HCR_EL2.E2H == 1 // HCR_EL2.E2H == 1

View file

@ -1,7 +1,7 @@
/* SPDX-License-Identifier: MIT */ /* SPDX-License-Identifier: MIT */
#include "arm_cpu_regs.h" #include "arm_cpu_regs.h"
#include "utils.h" #include "types.h"
/* HID registers */ /* HID registers */
#define SYS_IMP_APL_HID0 sys_reg(3, 0, 15, 0, 0) #define SYS_IMP_APL_HID0 sys_reg(3, 0, 15, 0, 0)

View file

@ -3,6 +3,7 @@
#include "hv.h" #include "hv.h"
#include "assert.h" #include "assert.h"
#include "cpu_regs.h" #include "cpu_regs.h"
#include "utils.h"
void hv_enter_guest(u64 x0, u64 x1, u64 x2, u64 x3, void *entry); void hv_enter_guest(u64 x0, u64 x1, u64 x2, u64 x3, void *entry);

View file

@ -3,6 +3,8 @@
#ifndef TYPES_H #ifndef TYPES_H
#define TYPES_H #define TYPES_H
#ifndef __ASSEMBLER__
#include <limits.h> #include <limits.h>
#include <stdbool.h> #include <stdbool.h>
#include <stddef.h> #include <stddef.h>
@ -23,6 +25,8 @@ typedef s64 ptrdiff_t;
typedef s64 ssize_t; typedef s64 ssize_t;
#endif
#define UNUSED(x) (void)(x) #define UNUSED(x) (void)(x)
#define ALIGNED(x) __attribute__((aligned(x))) #define ALIGNED(x) __attribute__((aligned(x)))
#define PACKED __attribute__((packed)) #define PACKED __attribute__((packed))
@ -43,4 +47,6 @@ typedef s64 ssize_t;
#define SZ_16K (1 << 14) #define SZ_16K (1 << 14)
#define SZ_1M (1 << 20) #define SZ_1M (1 << 20)
#define sys_reg(op0, op1, CRn, CRm, op2) s##op0##_##op1##_c##CRn##_c##CRm##_##op2
#endif #endif

View file

@ -242,8 +242,6 @@ static inline u8 writeread8(u64 addr, u8 data)
return read8(addr); return read8(addr);
} }
#define sys_reg(op0, op1, CRn, CRm, op2) s##op0##_##op1##_c##CRn##_c##CRm##_##op2
#define _mrs(reg) \ #define _mrs(reg) \
({ \ ({ \
u64 val; \ u64 val; \