[Pdbg] [PATCH v3 11/13] libpdbg/p9chip.c: Loads must be rammed twice

Nicholas Piggin npiggin at gmail.com
Wed May 2 16:28:06 AEST 2018


>From the workbook.

Signed-off-by: Nicholas Piggin <npiggin at gmail.com>
---
 libpdbg/p9chip.c | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/libpdbg/p9chip.c b/libpdbg/p9chip.c
index 2cb87c9..9a83a7c 100644
--- a/libpdbg/p9chip.c
+++ b/libpdbg/p9chip.c
@@ -206,7 +206,9 @@ static int p9_ram_setup(struct thread *thread)
 	return 0;
 }
 
-static int p9_ram_instruction(struct thread *thread, uint64_t opcode, uint64_t *scratch)
+
+
+static int __p9_ram_instruction(struct thread *thread, uint64_t opcode, uint64_t *scratch)
 {
 	uint64_t predecode, value;
 	int rc;
@@ -268,6 +270,21 @@ out:
 	return rc;
 }
 
+static int p9_ram_instruction(struct thread *thread, uint64_t opcode, uint64_t *scratch)
+{
+	if ((opcode & OPCODE_MASK) == LD_OPCODE) {
+		/*
+		 * Loads must be rammed twice, the value of the second used.
+		 * A fault should still be returned though. Unfortunately
+		 * any load fault seems to be a checkstop.
+		 */
+		int rc = __p9_ram_instruction(thread, opcode, scratch);
+		if (rc)
+			return rc;
+	}
+	return __p9_ram_instruction(thread, opcode, scratch);
+}
+
 static int p9_ram_destroy(struct thread *thread)
 {
 	/* Disable ram mode */
-- 
2.17.0



More information about the Pdbg mailing list