From 7d7494fad2d108a600c506fe4e65e69e4d19db34 Mon Sep 17 00:00:00 2001 From: Tinic Uro Date: Sat, 26 Sep 2026 02:32:23 +0000 Subject: [PATCH] InstallNetProbe: card.resource stubs list every scratch register the call may destroy installnetprobe.c's three card.resource stubs (OwnCard, ReleaseCard, CopyTuple) passed their argument registers as asm inputs only. The library ABI lets every LVO destroy d0/d1/a0/a1. This was REAL at main 66e0bf53. probe_own_card loads a1 = &handle (0x968) for OwnCard (jsr -6 at 0x96e). On the owned path, the first CopyTuple(0x20) (jsr -72 at 0x98e) was issued without reloading a1, so it used whatever OwnCard left there. After the change, 0x986 is `lea 0x18,a1` before the CopyTuple, which reloads the handle. The other two stubs were latent. Each argument register is now a "+r" operand; unused scratch registers remain clobbers. The #70 scanner no longer flags installnetprobe.c. With #71 and #72 this closes the 16 shipped sites in #70. Part of #70 (shipped sites, PR C of 3). Co-Authored-By: Claude Opus 5.5 (1M context) --- CHANGELOG.md | 1 + src/tools/installnetprobe.c | 16 ++++++++-------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6c5869c3..edb2ee3f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ version at the top when it merges. ## Unreleased +- `InstallNetProbe` reads a PC Card's manufacturer ID with the card handle it just claimed. - `anxnet.device` on a PC Card slot records the correct I/O mode in its diagnostic record. - The installer can set the clock from an Internet time server at boot; the answer defaults to no. - `SO_REUSEPORT` on a UDP socket now shares the port instead of being ignored, diff --git a/src/tools/installnetprobe.c b/src/tools/installnetprobe.c index 2bb3ae56..a7153f6f 100644 --- a/src/tools/installnetprobe.c +++ b/src/tools/installnetprobe.c @@ -49,7 +49,8 @@ struct Library *CardResource; /* card.resource's proto headers are not portable across the two supported Amiga GCC layouts. These three LVOs are the same small stubs the driver - uses: OwnCard -6, ReleaseCard -12, CopyTuple -72. */ + uses: OwnCard -6, ReleaseCard -12, CopyTuple -72. Each may destroy + d0/d1/a0/a1, so an argument register is a "+r" operand (#70). */ static struct CardHandle *probe_own_card(struct CardHandle *handle) { register struct Library *_a6 __asm("a6") = CardResource; @@ -57,8 +58,8 @@ static struct CardHandle *probe_own_card(struct CardHandle *handle) register struct CardHandle *result __asm("d0"); __asm __volatile ("jsr a6@(-0x6)" - : "=r" (result) - : "r" (_a6), "r" (_a1) + : "=r" (result), "+r" (_a1) + : "r" (_a6) : "d1", "a0", "cc", "memory"); return result; } @@ -70,8 +71,8 @@ static VOID probe_release_card(struct CardHandle *handle, ULONG flags) register ULONG _d0 __asm("d0") = flags; __asm __volatile ("jsr a6@(-0xc)" - : "+r" (_d0) - : "r" (_a6), "r" (_a1) + : "+r" (_d0), "+r" (_a1) + : "r" (_a6) : "d1", "a0", "cc", "memory"); } @@ -86,9 +87,8 @@ static BOOL probe_copy_tuple(struct CardHandle *handle, UBYTE *buffer, register LONG result __asm("d0"); __asm __volatile ("jsr a6@(-0x48)" - : "=r" (result) - : "r" (_a6), "r" (_a1), "r" (_a0), "r" (_d1), - "0" (_d0) + : "=r" (result), "+r" (_a1), "+r" (_a0), "+r" (_d1) + : "r" (_a6), "0" (_d0) : "cc", "memory"); return (BOOL)(result != 0); }