From 437b84fa478c659d58dd3ef436f2bc248afc5d10 Mon Sep 17 00:00:00 2001 From: Jacob Bramley Date: Wed, 8 May 2024 15:57:49 +0100 Subject: [PATCH] fixup! C64-Secure ABI demo. Clarify `what_next` comment. --- morello-c64-secure/c64-secure.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/morello-c64-secure/c64-secure.c b/morello-c64-secure/c64-secure.c index 4420f2d..3301ca8 100644 --- a/morello-c64-secure/c64-secure.c +++ b/morello-c64-secure/c64-secure.c @@ -421,13 +421,20 @@ bool maybe_print_abi_desc(enum ABI from, enum ABI to) // From a given context, ask the user what to call next. // -// This should be called from each demo function in a loop. The demo function -// should either call the resulting function, or return (exiting its loop) if -// it's NULL. +// This is the interactive logic of the example, responsible for presenting +// available options, asking the user what to do next, and then passing that +// information back to the demo itself (A, B, C, ...). The actual ABI logic is +// in the demo functions. // -// `can_call()` says that the example ABIs can't call 'Z' (C code), but actually -// they'll all work well enough to call this helper. TODO: This might fail if -// the user requests a large number of locals. +// `what_next` should be called by each demo function (A, B, C, ...) in a loop. +// Each time it is called, `what_next` will prompt the user, and return another +// demo function to call (with a given number of stacked locals), or NULL if the +// calling demo function should return. +// +// Note: Since this is implemented in C, it uses AAPCS64-cap, which we +// respresent as 'Z'. `can_call()` says that the example ABIs can't call 'Z', +// but in practice they'll all work well enough to call this helper. +// TODO: This might fail if the user requests a large number of locals. struct Next what_next(uintptr_t cfp, uintptr_t csp, size_t pc) { clear();