mirror of
https://github.com/Cesarus85/ringfall-mjolnir-vr.git
synced 2026-10-17 20:00:25 +02:00
Recover the least-recently-allocated cache primitive from the January
object: 0x3c-byte lra_cache ('lrac' signature, name, size,
base_address, malloced flag, last_block, update/delete procs) and
0x10-byte in-buffer lra_block headers ('Ablh' signature with locked
and deleted flag bits, user address pointer, size, forward chain).
Seven of fourteen functions are proven exact: lra_full, lra_new,
lra_dispose, lra_flush, the default update/delete callbacks and the
block-invalidate helper code_0010ba10 with its ESI/ECX register
convention. The remaining seven are byte-complete reconstructions
blocked on a single interlocked register-allocation choice (cache in
EBX versus EDI) shared by the verify helpers and their callers, plus
one callee-saved-count difference in lra_allocate.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
93 lines
1.5 KiB
C
93 lines
1.5 KiB
C
/*
|
|
LRA_CACHE.H
|
|
|
|
header included in hcex build.
|
|
*/
|
|
|
|
#ifndef __LRA_CACHE_H
|
|
#define __LRA_CACHE_H
|
|
#pragma once
|
|
|
|
/* ---------- constants */
|
|
|
|
enum
|
|
{
|
|
LRA_CACHE_SIGNATURE = 'lrac',
|
|
LRA_BLOCK_SIGNATURE = 'Ablh',
|
|
|
|
MAXIMUM_LRA_CACHE_NAME_LENGTH = 31,
|
|
};
|
|
|
|
enum
|
|
{
|
|
_lra_block_locked_bit,
|
|
_lra_block_deleted_bit,
|
|
};
|
|
|
|
/* ---------- macros */
|
|
|
|
/* ---------- types */
|
|
|
|
typedef void (*lra_update_proc)(
|
|
long *address,
|
|
long new_address);
|
|
|
|
typedef void (*lra_delete_proc)(
|
|
long *address);
|
|
|
|
/* ---------- structures */
|
|
|
|
struct lra_block
|
|
{
|
|
long *address;
|
|
unsigned long signature;
|
|
long size;
|
|
struct lra_block *next;
|
|
};
|
|
|
|
struct lra_cache
|
|
{
|
|
char name[MAXIMUM_LRA_CACHE_NAME_LENGTH+1];
|
|
long size;
|
|
void *base_address;
|
|
boolean malloced;
|
|
struct lra_block *last_block;
|
|
lra_update_proc update_proc;
|
|
lra_delete_proc delete_proc;
|
|
unsigned long signature;
|
|
};
|
|
|
|
/* ---------- prototypes/LRA_CACHE.C */
|
|
|
|
long lra_full(
|
|
struct lra_cache *cache);
|
|
struct lra_cache *lra_new(
|
|
char const *name,
|
|
long size,
|
|
lra_update_proc update_proc,
|
|
lra_delete_proc delete_proc,
|
|
void *base_address);
|
|
void lra_dispose(
|
|
struct lra_cache *cache);
|
|
void lra_flush(
|
|
struct lra_cache *cache);
|
|
void lra_free(
|
|
struct lra_cache *cache,
|
|
void *pointer);
|
|
void lra_lock(
|
|
struct lra_cache *cache,
|
|
void *pointer);
|
|
void lra_unlock(
|
|
struct lra_cache *cache,
|
|
void *pointer);
|
|
void *lra_allocate(
|
|
struct lra_cache *cache,
|
|
long size,
|
|
long *address);
|
|
|
|
/* ---------- globals */
|
|
|
|
/* ---------- public code */
|
|
|
|
#endif // __LRA_CACHE_H
|