Files
psxrecomp/runtime/include/card_read_summary.h
T
Matthew Stanley 6f7fcdc89b Remove all psxrecomp-v4 naming — rename to psxrecomp throughout
The "v4" suffix was a holdover from iterative project restarts.
There is now one psxrecomp; all identifiers, include guards, cmake
variables, function names, log strings, schema tags, and tool paths
drop the v4 suffix.

Changes:
- PSXRECOMP_V4_ROOT → PSXRECOMP_ROOT (cmake)
- PSXRECOMP_V4_RUNTIME_SOURCES/_INCLUDE_DIRS/_BIOS_GENERATED → no V4
- psxrecomp_v4_add_runtime_target → psxrecomp_add_runtime_target
- PSXRECOMP_V4_*_H include guards → PSXRECOMP_*_H
- "psxrecomp-v4" log/window strings → "psxrecomp"
- Schema version strings in recompiler JSON output
- Tool script hardcoded absolute paths updated

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
2026-05-29 21:14:30 -07:00

62 lines
2.3 KiB
C

/*
* card_read_summary.h — non-evicting evidence ring for the first 32
* completed memory-card reads.
*
* The card-txn ring (256 entries, evicting) covers recent activity
* but the long history is gone by the time we audit. This ring is
* fixed-size and STOPS recording after 32 entries, so the FIRST 32
* successful reads post-CROSS are preserved indefinitely.
*
* Each entry captures the SIO-layer evidence at the MC_READ_END
* transition: slot/cmd/sector/checksum/first 16 bytes/cycle counts/
* caller function. The destination RAM pointer is filled in later
* by the chain-handler trace (Phase 3).
*/
#ifndef PSXRECOMP_CARD_READ_SUMMARY_H
#define PSXRECOMP_CARD_READ_SUMMARY_H
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
#define CARD_READ_SUMMARY_CAP 32
#define CARD_READ_SUMMARY_PEEK 16 /* bytes captured from start of buffer */
typedef struct {
uint64_t seq; /* monotonic; first record = 0 */
uint64_t psx_cycle_count; /* guest cycle clock at completion */
uint32_t current_func; /* g_debug_current_func_addr at MC_READ_END */
uint32_t last_store_pc; /* g_debug_last_store_pc at MC_READ_END */
uint16_t sector;
uint8_t slot;
uint8_t cmd; /* mc_cmd at completion (e.g. 0x52) */
uint8_t checksum_card; /* simulated card's computed checksum */
uint8_t data_idx_at_end; /* should be 128 for clean READ_END */
uint8_t pad0;
uint8_t pad1;
uint32_t dest_ram_addr; /* filled by chain-handler trace; 0 if unknown */
uint8_t data_peek[CARD_READ_SUMMARY_PEEK];
} CardReadSummary;
void card_read_summary_record(uint8_t slot, uint8_t cmd, uint16_t sector,
uint8_t checksum, uint8_t data_idx,
const uint8_t *data128);
/* Read access for debug_server. Returns count of recorded entries. */
uint32_t card_read_summary_get(const CardReadSummary **buf_out);
/* Reset the ring (for clean audit re-runs). */
void card_read_summary_reset(void);
/* Late-fill the destination RAM pointer for the most recent record.
* Called by chain-handler trace once the BIOS commits the byte to RAM. */
void card_read_summary_set_dest(uint32_t dest_addr);
#ifdef __cplusplus
}
#endif
#endif /* PSXRECOMP_CARD_READ_SUMMARY_H */