Split arch cpu.c into hypervisor and shared parts.
Change-Id: I502a2ac44a6f0b66c51f54c102bd6696e7a8f336
diff --git a/src/arch/aarch64/BUILD.gn b/src/arch/aarch64/BUILD.gn
index f9cbc5a..93569ac 100644
--- a/src/arch/aarch64/BUILD.gn
+++ b/src/arch/aarch64/BUILD.gn
@@ -19,7 +19,7 @@
# Implementation of the arch interface for aarch64.
source_set("arch") {
sources = [
- "cpu.c",
+ "irq.c",
"mm.c",
"timer.c",
]
diff --git a/src/arch/aarch64/hypervisor/BUILD.gn b/src/arch/aarch64/hypervisor/BUILD.gn
index 0972dde..db2cca5 100644
--- a/src/arch/aarch64/hypervisor/BUILD.gn
+++ b/src/arch/aarch64/hypervisor/BUILD.gn
@@ -31,6 +31,7 @@
]
sources += [
+ "cpu.c",
"debug_el1.c",
"handler.c",
"perfmon.c",
diff --git a/src/arch/aarch64/cpu.c b/src/arch/aarch64/hypervisor/cpu.c
similarity index 94%
rename from src/arch/aarch64/cpu.c
rename to src/arch/aarch64/hypervisor/cpu.c
index a8ff2bc..c0886fe 100644
--- a/src/arch/aarch64/cpu.c
+++ b/src/arch/aarch64/hypervisor/cpu.c
@@ -24,25 +24,15 @@
#include "hf/spci.h"
#include "hf/std.h"
-#include "hypervisor/perfmon.h"
-#include "hypervisor/sysregs.h"
#include "msr.h"
+#include "perfmon.h"
+#include "sysregs.h"
/**
* The LO field indicates whether LORegions are supported.
*/
#define ID_AA64MMFR1_EL1_LO (UINT64_C(1) << 16)
-void arch_irq_disable(void)
-{
- __asm__ volatile("msr DAIFSet, #0xf");
-}
-
-void arch_irq_enable(void)
-{
- __asm__ volatile("msr DAIFClr, #0xf");
-}
-
static void lor_disable(void)
{
/*
diff --git a/src/arch/aarch64/irq.c b/src/arch/aarch64/irq.c
new file mode 100644
index 0000000..4114d76
--- /dev/null
+++ b/src/arch/aarch64/irq.c
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2018 The Hafnium Authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "hf/arch/irq.h"
+
+#include "msr.h"
+
+void arch_irq_disable(void)
+{
+ __asm__ volatile("msr DAIFSet, #0xf");
+}
+
+void arch_irq_enable(void)
+{
+ __asm__ volatile("msr DAIFClr, #0xf");
+}