aboutsummaryrefslogtreecommitdiff
path: root/reginfo.c
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2017-02-24 17:02:25 +0000
committerPeter Maydell <peter.maydell@linaro.org>2017-02-24 17:02:58 +0000
commit31e34835ebbf98beab46e6d2ae832a1dd6e054de (patch)
tree470c9c72351f25c096770f7478cc05ec4daae914 /reginfo.c
parent02998ad7c3b71add9391b04263c95dbe60c13112 (diff)
Move send_register_info() to reginfo.c
send_register_info() is now essentially the same code for all target CPUs, so move it into reginfo.c rather than having duplicated code. Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'reginfo.c')
-rw-r--r--reginfo.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/reginfo.c b/reginfo.c
new file mode 100644
index 0000000..d62a2ed
--- /dev/null
+++ b/reginfo.c
@@ -0,0 +1,43 @@
+/******************************************************************************
+ * Copyright (c) 2017 Linaro Limited
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Peter Maydell (Linaro) - initial implementation
+ *****************************************************************************/
+
+#include <stdio.h>
+
+#include "risu.h"
+
+int send_register_info(int sock, void *uc)
+{
+ struct reginfo ri;
+ int op;
+ reginfo_init(&ri, uc);
+ op = get_risuop(&ri);
+
+ switch (op) {
+ case OP_COMPARE:
+ case OP_TESTEND:
+ default:
+ /* Do a simple register compare on (a) explicit request
+ * (b) end of test (c) a non-risuop UNDEF
+ */
+ return send_data_pkt(sock, &ri, sizeof(ri));
+ case OP_SETMEMBLOCK:
+ memblock = (void *)(uintptr_t)get_reginfo_paramreg(&ri);
+ break;
+ case OP_GETMEMBLOCK:
+ set_ucontext_paramreg(uc,
+ get_reginfo_paramreg(&ri) + (uintptr_t)memblock);
+ break;
+ case OP_COMPAREMEM:
+ return send_data_pkt(sock, memblock, MEMBLOCKLEN);
+ break;
+ }
+ return 0;
+}