// 2nd program for gnoExecProbe (punch-list #5 + #7 exec-into test).
// Proves exec* transferred control: GNO exec replaces the process image in
// place, so this runs in the SAME process after gnoExecProbe's execvp.  It
// sets its exec-into marker plus the shared reached-end word, then spins so
// the harness can sample bank-2 memory.
//
// Deployed to /bin as "gnoexeced" via GNO_PROG2 (runInGno.sh copies it to
// /GNO.BOOT/bin), which is how gnoExecProbe's execvp("gnoexeced") resolves
// it through the default $PATH ("/bin /usr/bin").
#include <stdint.h>

#define M(a) (*(volatile uint16_t *)(a))


int main(void) {
    M(0x025010UL) = 0xE0EC;              // exec-into transferred control here
    M(0x025000UL) = 0xC0DE;              // reached end (via exec'd program)
    for (volatile unsigned long j = 0; j < 300000UL; j++) {
    }
    return 0;
}
