1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * jitdump.h: jitted code info encapsulation file format
5 * Adapted from OProfile GPLv2 support jidump.h:
6 * Copyright 2007 OProfile authors
9 * Copyright IBM Corporation 2007
19 #define JITHEADER_MAGIC 0x4A695444
20 #define JITHEADER_MAGIC_SW 0x4454694A
22 #define PADDING_8ALIGNED(x) ((((x) + 7) & 7) ^ 7)
23 #define ALIGN_8(x) (((x) + 7) & (~7))
25 #define JITHEADER_VERSION 1
27 enum jitdump_flags_bits
{
28 JITDUMP_FLAGS_ARCH_TIMESTAMP_BIT
,
29 JITDUMP_FLAGS_MAX_BIT
,
32 #define JITDUMP_FLAGS_ARCH_TIMESTAMP (1ULL << JITDUMP_FLAGS_ARCH_TIMESTAMP_BIT)
34 #define JITDUMP_FLAGS_RESERVED (JITDUMP_FLAGS_MAX_BIT < 64 ? \
35 (~((1ULL << JITDUMP_FLAGS_MAX_BIT) - 1)) : 0)
38 uint32_t magic
; /* characters "jItD" */
39 uint32_t version
; /* header version */
40 uint32_t total_size
; /* total size of header */
41 uint32_t elf_mach
; /* elf mach target */
42 uint32_t pad1
; /* reserved */
43 uint32_t pid
; /* JIT process id */
44 uint64_t timestamp
; /* timestamp */
45 uint64_t flags
; /* flags */
48 enum jit_record_type
{
51 JIT_CODE_DEBUG_INFO
= 2,
53 JIT_CODE_UNWINDING_INFO
= 4,
58 /* record prefix (mandatory in each record) */
76 struct jr_code_close
{
86 uint64_t old_code_addr
;
87 uint64_t new_code_addr
;
94 int lineno
; /* source line number starting at 1 */
95 int discrim
; /* column discriminator, 0 is default */
96 const char name
[]; /* null terminated filename, \xff\0 if same as previous entry */
99 struct jr_code_debug_info
{
104 struct debug_entry entries
[];
107 struct jr_code_unwinding_info
{
110 uint64_t unwinding_size
;
111 uint64_t eh_frame_hdr_size
;
112 uint64_t mapped_size
;
113 const char unwinding_data
[];
117 struct jr_code_debug_info info
;
118 struct jr_code_close close
;
119 struct jr_code_load load
;
120 struct jr_code_move move
;
121 struct jr_prefix prefix
;
122 struct jr_code_unwinding_info unwinding
;
125 static inline struct debug_entry
*
126 debug_entry_next(struct debug_entry
*ent
)
129 size_t l
= strlen(ent
->name
) + 1;
134 debug_entry_file(struct debug_entry
*ent
)
140 #endif /* !JITDUMP_H */