aboutsummaryrefslogtreecommitdiff
path: root/example/main.c
diff options
context:
space:
mode:
authorKimplul <kimi.h.kuparinen@gmail.com>2023-08-26 18:38:30 +0300
committerKimplul <kimi.h.kuparinen@gmail.com>2023-08-26 18:38:30 +0300
commit458a1e662ad80cbef56487ebe75ee02358047944 (patch)
tree58cbe19ecb9b466fc8b340aaf6980d8836bd2c96 /example/main.c
parentaa51670b4f4fe411207c7c0719fddb64478b4dc0 (diff)
downloadbcgen-458a1e662ad80cbef56487ebe75ee02358047944.tar.gz
bcgen-458a1e662ad80cbef56487ebe75ee02358047944.zip
allow specifying registers to run
Diffstat (limited to 'example/main.c')
-rw-r--r--example/main.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/example/main.c b/example/main.c
index dccec66..e9ab0a9 100644
--- a/example/main.c
+++ b/example/main.c
@@ -20,6 +20,14 @@ int main()
patch(&cs, r, 0, l);
- printf("%llu\n", (unsigned long long)run(&cs));
+ /* specify register state to run, note that seven is taken from
+ * r = 7 in rules.py, should probably provide a macro for it? */
+ ubcval_t ri[7] = {0};
+
+ /* since we don't use floating point registers, we can pass in a NULL */
+ run(&cs, ri, NULL);
+
+ /* our 'ABI' specifies that the return register is 0 */
+ printf("%llu\n", (unsigned long long)ri[0]);
destroy(&cs);
}