DF-2540 / run.sh
#!/bin/sh # DF-2540 characterization: verify the amdsbwd device is absent (HW-gated) # and confirm the signed-overflow arithmetic by computation. set -e cd "$(dirname "$0")" echo "=== HW-gate check: is amdsbwd present? ===" ls -l /dev/amdsbwd* 2>&1 || echo "ABSENT (expected in QEMU -- no AMD SB chipset)" pciconf -lv 2>/dev/null | grep -i "amd\|ATI" | head || echo "No AMD devices" echo "" echo "=== kern.watchdog.period (root-writable, but no amdsbwd callback) ===" sysctl kern.watchdog.period 2>&1 echo "" echo "=== Arithmetic verification of the overflow ===" echo "period=4294967, ms_per_tick=1000:" echo " 4294967 * 1000 = 4294967000" echo " as int32: -296 (signed overflow)" echo " -296 / 1000 = 0 (C truncation toward zero, |-296| < 1000)" echo " timeout = (unsigned)0 = 0" echo " 0 <= max_ticks(65535) -> NOT clamped" echo " --> hardware watchdog count = 0 -> IMMEDIATE REBOOT on real AMD SB HW" echo "" echo "(Run python3 df2540_arith.py for the full table of period -> count values)" |