1 // SPDX-License-Identifier: GPL-2.0 2 /* 3 * debug_kinfo.h - backup kernel information for bootloader usage 4 * 5 * Copyright 2021 Google LLC 6 */ 7 8 #ifndef DEBUG_KINFO_H 9 #define DEBUG_KINFO_H 10 11 #include <linux/utsname.h> 12 13 #define BUILD_INFO_LEN 256 14 #define DEBUG_KINFO_MAGIC 0xCCEEDDFF 15 16 /* 17 * Header structure must be byte-packed, since the table is provided to 18 * bootloader. 19 */ 20 struct kernel_info { 21 /* For kallsyms */ 22 __u8 enabled_all; 23 __u8 enabled_base_relative; 24 __u8 enabled_absolute_percpu; 25 __u8 enabled_cfi_clang; 26 __u32 num_syms; 27 __u16 name_len; 28 __u16 bit_per_long; 29 __u16 module_name_len; 30 __u16 symbol_len; 31 __u64 _addresses_pa; 32 __u64 _relative_pa; 33 __u64 _stext_pa; 34 __u64 _etext_pa; 35 __u64 _sinittext_pa; 36 __u64 _einittext_pa; 37 __u64 _end_pa; 38 __u64 _offsets_pa; 39 __u64 _names_pa; 40 __u64 _token_table_pa; 41 __u64 _token_index_pa; 42 __u64 _markers_pa; 43 44 /* For frame pointer */ 45 __u32 thread_size; 46 47 /* For virt_to_phys */ 48 __u64 swapper_pg_dir_pa; 49 50 /* For linux banner */ 51 __u8 last_uts_release[__NEW_UTS_LEN]; 52 53 /* Info of running build */ 54 __u8 build_info[BUILD_INFO_LEN]; 55 56 /* For module kallsyms */ 57 __u32 enabled_modules_tree_lookup; 58 __u32 mod_core_layout_offset; 59 __u32 mod_init_layout_offset; 60 __u32 mod_kallsyms_offset; 61 __u64 module_start_va; 62 __u64 module_end_va; 63 } __packed; 64 65 struct kernel_all_info { 66 __u32 magic_number; 67 __u32 combined_checksum; 68 struct kernel_info info; 69 } __packed; 70 71 #endif // DEBUG_KINFO_H 72