~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/linux/vmcore_info.h

Version: ~ [ linux-6.11-rc3 ] ~ [ linux-6.10.4 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.45 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.104 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.164 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.223 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.281 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.319 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0 */
  2 #ifndef LINUX_VMCORE_INFO_H
  3 #define LINUX_VMCORE_INFO_H
  4 
  5 #include <linux/linkage.h>
  6 #include <linux/elfcore.h>
  7 #include <linux/elf.h>
  8 
  9 #define CRASH_CORE_NOTE_NAME       "CORE"
 10 #define CRASH_CORE_NOTE_HEAD_BYTES ALIGN(sizeof(struct elf_note), 4)
 11 #define CRASH_CORE_NOTE_NAME_BYTES ALIGN(sizeof(CRASH_CORE_NOTE_NAME), 4)
 12 #define CRASH_CORE_NOTE_DESC_BYTES ALIGN(sizeof(struct elf_prstatus), 4)
 13 
 14 /*
 15  * The per-cpu notes area is a list of notes terminated by a "NULL"
 16  * note header.  For kdump, the code in vmcore.c runs in the context
 17  * of the second kernel to combine them into one note.
 18  */
 19 #define CRASH_CORE_NOTE_BYTES      ((CRASH_CORE_NOTE_HEAD_BYTES * 2) +  \
 20                                      CRASH_CORE_NOTE_NAME_BYTES +       \
 21                                      CRASH_CORE_NOTE_DESC_BYTES)
 22 
 23 #define VMCOREINFO_BYTES           PAGE_SIZE
 24 #define VMCOREINFO_NOTE_NAME       "VMCOREINFO"
 25 #define VMCOREINFO_NOTE_NAME_BYTES ALIGN(sizeof(VMCOREINFO_NOTE_NAME), 4)
 26 #define VMCOREINFO_NOTE_SIZE       ((CRASH_CORE_NOTE_HEAD_BYTES * 2) +  \
 27                                      VMCOREINFO_NOTE_NAME_BYTES +       \
 28                                      VMCOREINFO_BYTES)
 29 
 30 typedef u32 note_buf_t[CRASH_CORE_NOTE_BYTES/4];
 31 /* Per cpu memory for storing cpu states in case of system crash. */
 32 extern note_buf_t __percpu *crash_notes;
 33 
 34 void crash_update_vmcoreinfo_safecopy(void *ptr);
 35 void crash_save_vmcoreinfo(void);
 36 void arch_crash_save_vmcoreinfo(void);
 37 __printf(1, 2)
 38 void vmcoreinfo_append_str(const char *fmt, ...);
 39 phys_addr_t paddr_vmcoreinfo_note(void);
 40 
 41 #define VMCOREINFO_OSRELEASE(value) \
 42         vmcoreinfo_append_str("OSRELEASE=%s\n", value)
 43 #define VMCOREINFO_BUILD_ID()                                           \
 44         ({                                                              \
 45                 static_assert(sizeof(vmlinux_build_id) == 20);          \
 46                 vmcoreinfo_append_str("BUILD-ID=%20phN\n", vmlinux_build_id); \
 47         })
 48 
 49 #define VMCOREINFO_PAGESIZE(value) \
 50         vmcoreinfo_append_str("PAGESIZE=%ld\n", value)
 51 #define VMCOREINFO_SYMBOL(name) \
 52         vmcoreinfo_append_str("SYMBOL(%s)=%lx\n", #name, (unsigned long)&name)
 53 #define VMCOREINFO_SYMBOL_ARRAY(name) \
 54         vmcoreinfo_append_str("SYMBOL(%s)=%lx\n", #name, (unsigned long)name)
 55 #define VMCOREINFO_SIZE(name) \
 56         vmcoreinfo_append_str("SIZE(%s)=%lu\n", #name, \
 57                               (unsigned long)sizeof(name))
 58 #define VMCOREINFO_STRUCT_SIZE(name) \
 59         vmcoreinfo_append_str("SIZE(%s)=%lu\n", #name, \
 60                               (unsigned long)sizeof(struct name))
 61 #define VMCOREINFO_OFFSET(name, field) \
 62         vmcoreinfo_append_str("OFFSET(%s.%s)=%lu\n", #name, #field, \
 63                               (unsigned long)offsetof(struct name, field))
 64 #define VMCOREINFO_TYPE_OFFSET(name, field) \
 65         vmcoreinfo_append_str("OFFSET(%s.%s)=%lu\n", #name, #field, \
 66                               (unsigned long)offsetof(name, field))
 67 #define VMCOREINFO_LENGTH(name, value) \
 68         vmcoreinfo_append_str("LENGTH(%s)=%lu\n", #name, (unsigned long)value)
 69 #define VMCOREINFO_NUMBER(name) \
 70         vmcoreinfo_append_str("NUMBER(%s)=%ld\n", #name, (long)name)
 71 #define VMCOREINFO_CONFIG(name) \
 72         vmcoreinfo_append_str("CONFIG_%s=y\n", #name)
 73 
 74 extern unsigned char *vmcoreinfo_data;
 75 extern size_t vmcoreinfo_size;
 76 extern u32 *vmcoreinfo_note;
 77 
 78 Elf_Word *append_elf_note(Elf_Word *buf, char *name, unsigned int type,
 79                           void *data, size_t data_len);
 80 void final_note(Elf_Word *buf);
 81 #endif /* LINUX_VMCORE_INFO_H */
 82 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php