// Environment (GNO shell-variable table) round-trip regression. // GNO has no Unix environ[]; the "environment" is the kernel SHELL- // VARIABLE table reached via GS/OS Shell calls (SetGS $0146 / // ReadVariableGS $014B) dispatched through the same inline $E100A8 // mechanism as the file calls -- zero new asm. This probe sets a // variable, reads it straight back, and asserts the value survives. // // Deterministic: the variable name/value are literals, no pids or // addresses, so the round-trip is identical on every boot. // // Bank-2 absolute markers (DBR-independent), per gnoHeapProbe convention: // 0x025000 C0DE reached end (no hang in the shell-call path) // 0x025002 0001 getenv("LLVMTEST") == "42" (round-trip OK), else DEAD // 0x025012 0001 setenv("LLVMTEST","42",1) == 0 (call succeeded), else DEAD #include #include #define M(a) (*(volatile uint16_t *)(a)) int main(void) { int sr; char *v; uint16_t match; M(0x025000UL) = 0x0000; sr = setenv("LLVMTEST", "42", 1); M(0x025012UL) = (sr == 0) ? 0x0001 : 0xDEAD; v = getenv("LLVMTEST"); match = 0xDEAD; if (v != 0 && v[0] == '4' && v[1] == '2' && v[2] == 0) { match = 0x0001; } M(0x025002UL) = match; M(0x025000UL) = 0xC0DE; // reached end for (volatile unsigned long j = 0; j < 300000UL; j++) { } return 0; }