.githooks/
riscv/
test/
.clang-format
570 B
.gitignore
5 B
.gitsigners
112 B
AGENTS.md
227 B
LICENSE
1.1 KiB
Makefile
3.5 KiB
README
12.5 KiB
STYLE
781 B
abi_host.c
12.2 KiB
abi_linux.c
3.7 KiB
bitmanip.h
5.8 KiB
color.h
567 B
debug_map.c
5.1 KiB
debug_map.h
1.3 KiB
emulator.c
87.3 KiB
host.h
5.5 KiB
host_posix.c
11.2 KiB
hosted.h
5.7 KiB
image_native.c
4.6 KiB
image_rad0.c
2.7 KiB
image_raw.c
2.6 KiB
io.c
1.1 KiB
io.h
444 B
jit.c
99.2 KiB
jit.h
7.8 KiB
machine.c
4.4 KiB
machine.h
2.1 KiB
machine_cpu.c
13.6 KiB
machine_csr.c
4.6 KiB
machine_devices.c
10.8 KiB
machine_fdt.c
8.7 KiB
machine_internal.h
7.4 KiB
muldiv.h
1.0 KiB
profile.c
17.5 KiB
profile.h
1.4 KiB
riscv.c
755 B
riscv.h
4.3 KiB
types.h
1019 B
vector.c
54.0 KiB
vector.h
1.3 KiB
profile.h
raw
| 1 | #ifndef PROFILE_H |
| 2 | #define PROFILE_H |
| 3 | |
| 4 | #include "types.h" |
| 5 | |
| 6 | struct debug_map; |
| 7 | |
| 8 | /* A range word stores the absolute PC in its low 24 bits and the |
| 9 | * instruction count minus one in its high byte. Hosted text ends below |
| 10 | * 16 MiB. The interpreter uses an escape followed by a full PC for a |
| 11 | * single instruction outside this range. */ |
| 12 | #define PROFILE_PC_BITS 24 |
| 13 | #define PROFILE_PC_MASK ((1u << PROFILE_PC_BITS) - 1) |
| 14 | #define PROFILE_PC_ESCAPE U32_MAX |
| 15 | |
| 16 | /* State of one hosted execution profile. */ |
| 17 | struct profile; |
| 18 | |
| 19 | /* Start an instruction profile. Write folded stacks and PC counts if prefix |
| 20 | * is set. Write ordered PC ranges if trace is set. Report each invocation |
| 21 | * of function if set. The image and debug map stay valid until close. */ |
| 22 | struct profile *profile_open( |
| 23 | const char *program, |
| 24 | const u8 *memory, |
| 25 | u32 base, |
| 26 | u32 bytes, |
| 27 | const struct debug_map *debug, |
| 28 | const char *prefix, |
| 29 | const char *trace, |
| 30 | const char *function |
| 31 | ); |
| 32 | |
| 33 | /* Read ranges in execution order. Keep the last range's transfer pending |
| 34 | * until the next PC is known. */ |
| 35 | void profile_record(struct profile *profile, const u32 *ranges, const u32 *end); |
| 36 | |
| 37 | /* Write reports and free the profile. If the final instruction had a known |
| 38 | * continuation, next_pc is its target, including zero for a hosted return. */ |
| 39 | bool profile_close(struct profile *profile, u32 next_pc, bool continued); |
| 40 | |
| 41 | #endif |