summaryrefslogtreecommitdiff
path: root/aarch64/mono/demo
diff options
context:
space:
mode:
authorThomas Bauereiss2018-05-18 11:18:39 +0100
committerThomas Bauereiss2018-05-18 20:11:24 +0100
commit6889366c61144d6dd0f9c37a0eb7a6c9f8ab2258 (patch)
treef364a6689c902c4923d856fbf2b7ea3f7c9e8319 /aarch64/mono/demo
parent5e363d23bc54b3970a9e1f6fbea77bbb8459df6f (diff)
Clean up aarch64_extras.lem
Diffstat (limited to 'aarch64/mono/demo')
-rw-r--r--aarch64/mono/demo/aarch64_no_vector/main.sail22
1 files changed, 14 insertions, 8 deletions
diff --git a/aarch64/mono/demo/aarch64_no_vector/main.sail b/aarch64/mono/demo/aarch64_no_vector/main.sail
index 1e44f531..e9e2f84f 100644
--- a/aarch64/mono/demo/aarch64_no_vector/main.sail
+++ b/aarch64/mono/demo/aarch64_no_vector/main.sail
@@ -1,18 +1,24 @@
-val fetch_and_execute : unit -> unit effect {escape, undef, wreg, rreg, rmem, wmem}
+$include <elf.sail>
-function fetch_and_execute () = while true do {
- let instr = aget_Mem(_PC, 4, AccType_IFETCH);
- decode(instr);
- if __BranchTaken then __BranchTaken = false else _PC = _PC + 4
-}
+// Simple top level fetch and execute loop.
+val fetch_and_execute : unit -> unit effect {escape, undef, wreg, rreg, rmem, wmem}
-val elf_entry = "Elf_loader.elf_entry" : unit -> int
+function fetch_and_execute () =
+ while true do {
+ try {
+ let instr = aget_Mem(_PC, 4, AccType_IFETCH);
+ decode(instr);
+ } catch {
+ Error_See("HINT") => (),
+ _ => exit(())
+ };
+ if __BranchTaken then __BranchTaken = false else _PC = _PC + 4
+ }
val main : unit -> unit effect {escape, undef, wreg, rreg, rmem, wmem}
function main () = {
_PC = __GetSlice_int(64, elf_entry(), 0);
- print(BitStr(_PC));
SP_EL0 = ZeroExtend(0x3C00, 64);
PSTATE.D = 0b1;
PSTATE.A = 0b1;