| 1 | /* SPDX-License-Identifier: LGPL-2.1-or-later */ |
| 2 | /* |
| 3 | * Copyright (C) 2014-2021 Paul Cercueil <paul@crapouillou.net> |
| 4 | */ |
| 5 | |
| 6 | #ifndef __BLOCKCACHE_H__ |
| 7 | #define __BLOCKCACHE_H__ |
| 8 | |
| 9 | #include "lightrec.h" |
| 10 | |
| 11 | struct blockcache; |
| 12 | |
| 13 | struct block * lightrec_find_block(struct blockcache *cache, u32 pc); |
| 14 | struct block * lightrec_find_block_from_lut(struct blockcache *cache, |
| 15 | u16 lut_entry, u32 addr_in_block); |
| 16 | u16 lightrec_get_lut_entry(const struct block *block); |
| 17 | |
| 18 | void lightrec_register_block(struct blockcache *cache, struct block *block); |
| 19 | void lightrec_unregister_block(struct blockcache *cache, struct block *block); |
| 20 | |
| 21 | struct blockcache * lightrec_blockcache_init(struct lightrec_state *state); |
| 22 | void lightrec_free_block_cache(struct blockcache *cache); |
| 23 | |
| 24 | u32 lightrec_calculate_block_hash(const struct block *block); |
| 25 | _Bool lightrec_block_is_outdated(struct lightrec_state *state, struct block *block); |
| 26 | |
| 27 | void lightrec_remove_outdated_blocks(struct blockcache *cache, |
| 28 | const struct block *except); |
| 29 | |
| 30 | #endif /* __BLOCKCACHE_H__ */ |