Files
chimera-gfx-Public/samples/capability_probe/main.c
T
Chimera GFX release export a6037502d7
phase0-ci / build-and-audit (push) Successful in 2m14s
Publish Chimera GFX source
2026-09-03 03:27:14 +02:00

45 lines
1.5 KiB
C

/* SPDX-License-Identifier: GPL-3.0-or-later */
#include "firmware_gate.h"
#include "probe_platform.h"
#include <stdio.h>
#include <string.h>
#ifndef CHIMERA_GFX_PS5_ALLOWED_FIRMWARE
#define CHIMERA_GFX_PS5_ALLOWED_FIRMWARE "NONE"
#endif
static void write_log(void *userdata, const char *line) {
FILE *stream = (FILE *)userdata;
(void)fprintf(stream, "%s\n", line);
}
int main(int argc, char **argv) {
chimera_gfx_ps5_loader loader;
chimera_gfx_probe_ops ops;
chimera_gfx_probe_report report;
chimera_gfx_status status;
if (argc != 4 || strcmp(argv[1], "--firmware") != 0 ||
strcmp(argv[3], "--acknowledge-read-only-probe") != 0) {
(void)fprintf(
stderr, "refusing: exact firmware and acknowledgement required\n");
return 64;
}
if (!chimera_gfx_firmware_gate_allows(CHIMERA_GFX_PS5_ALLOWED_FIRMWARE,
argv[2])) {
(void)fprintf(stderr, "refusing: firmware is not allowlisted\n");
return 77;
}
chimera_gfx_ps5_make_loader_ops(&loader, write_log, stdout, &ops);
status = chimera_gfx_ps5_probe_symbols(&ops, &report);
(void)fprintf(stdout,
"{\"event\":\"summary\",\"resolved\":%lu,"
"\"total\":%lu,\"status\":\"%s\"}\n",
(unsigned long)report.resolved_count,
(unsigned long)report.symbol_count,
chimera_gfx_status_string(status));
return status == CHIMERA_GFX_STATUS_OK ? 0 : 1;
}