Make yield a regular syscall taking an argument.

Allows "wait for interrupt"/"wait for event" type operation where VM code blocks until the host has something for it.
This commit is contained in:
Toby Jaffey 2025-12-10 10:35:18 +00:00
parent d52baca7b2
commit e07eeab043
14 changed files with 88 additions and 24 deletions

View file

@ -167,10 +167,6 @@ int main(int argc, char *argv[]) {
printf("UVM32_EVT_END\n");
isrunning = false;
break;
case UVM32_EVT_YIELD:
//printf("UVM32_EVT_YIELD\n");
// program has paused, but no syscall
break;
case UVM32_EVT_ERR:
printf("UVM32_EVT_ERR '%s' (%d)\n", evt.data.err.errstr, (int)evt.data.err.errcode);
if (evt.data.err.errcode == UVM32_ERR_HUNG) {
@ -187,6 +183,11 @@ int main(int argc, char *argv[]) {
printf("%02x", *buf.ptr++);
}
} break;
case UVM32_SYSCALL_YIELD: {
// uint32_t yield_typ = uvm32_getval(&vmst, &evt, ARG0);
// printf("YIELD type=%d\n", yield_typ);
// uvm32_setval(&vmst, &evt, RET, 123);
} break;
case UVM32_SYSCALL_PRINT: {
const char *str = uvm32_getcstr(&vmst, &evt, ARG0);
printf("%s", str);