feat: add implementation of `memcpy_trapped`
Add implementation of `memcpy_trapped` which is capable of returning
error in case any of the memory accesses from source and destination
result in a data abort.
The `sync_current_exception` was refactored such that it can infer a
GPF, and in the exact str/ldr locations of the `memcpy_trapped`.
Prepare the `sync_current_exception` handler to process the GPF.
It shall be able to change the `ELR_EL2`, and return false
signaling that `ELR_EL2` shall not be restored from stack.
Signed-off-by: J-Alves <joao.alves@arm.com>
Change-Id: Id268140441a16b346b06a4891f97e69c0d1b8e6e
diff --git a/inc/hf/arch/memcpy_trapped.h b/inc/hf/arch/memcpy_trapped.h
new file mode 100644
index 0000000..b15f27f
--- /dev/null
+++ b/inc/hf/arch/memcpy_trapped.h
@@ -0,0 +1,15 @@
+/*
+ * Copyright 2024 The Hafnium Authors.
+ *
+ * Use of this source code is governed by a BSD-style
+ * license that can be found in the LICENSE file or at
+ * https://opensource.org/licenses/BSD-3-Clause.
+ */
+
+#pragma once
+
+void memcpy_trapped_aborted(void);
+bool memcpy_trapped(void *dest, uint64_t dest_size, const void *src,
+ uint64_t src_size);
+void memcpy_trapped_read(void);
+void memcpy_trapped_write(void);