diff options
| author | Alastair Reid | 2018-06-26 15:46:57 +0100 |
|---|---|---|
| committer | Alastair Reid | 2018-06-26 15:50:19 +0100 |
| commit | 68703bf244a10e5281625b0cb1d620d78d6c5cbb (patch) | |
| tree | a55530063bea7fca5ea85e94eeabe55411498c39 /lib/rts.c | |
| parent | 23f4e803332f4cbbab356f580f09beb4fb8be656 (diff) | |
RTS: implement sleep primitives
Note that an alternative implementation choice is just to implement
them as SAIL functions manipulating a global variable.
Not sure which is better.
Diffstat (limited to 'lib/rts.c')
| -rw-r--r-- | lib/rts.c | 18 |
1 files changed, 16 insertions, 2 deletions
@@ -25,12 +25,27 @@ unit sail_exit(unit u) return UNIT; } +bool g_sleeping = false; + unit sleep_request(const unit u) { - fprintf(stderr, "Sail model going to sleep\n"); + fprintf(stderr, "Sail CPU model going to sleep\n"); + g_sleeping = true; + return UNIT; +} + +unit wakeup_request(const unit u) +{ + fprintf(stderr, "Sail CPU model waking up\n"); + g_sleeping = false; return UNIT; } +bool sleeping(const unit u) +{ + return g_sleeping; +} + /* ***** Sail memory builtins ***** */ /* @@ -448,7 +463,6 @@ int process_arguments(int argc, char *argv[]) g_elf_entry = elf_entry; } - fprintf(stderr, "Parsed all command line options\n"); return 0; } |
