blob: 4ab22a672328b2200a9fc650c30be61569338078 [file] [log] [blame]
rjw1f884582022-01-06 17:20:42 +08001/*
2 * Copyright (c) 2018 MediaTek Inc.
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining
5 * a copy of this software and associated documentation files
6 * (the "Software"), to deal in the Software without restriction,
7 * including without limitation the rights to use, copy, modify, merge,
8 * publish, distribute, sublicense, and/or sell copies of the Software,
9 * and to permit persons to whom the Software is furnished to do so,
10 * subject to the following conditions:
11 *
12 * The above copyright notice and this permission notice shall be
13 * included in all copies or substantial portions of the Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
18 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
19 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
20 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
21 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 */
23
24#if !defined(__MRDUMP_ELF64_H__)
25#define __MRDUMP_ELF64_H__
26
27#include <stdint.h>
28#include "mrdump_elf_common.h"
29
30#define ELF_ARM64_NGREGS 34
31typedef uint64_t elf_arm64_gregset_t[ELF_ARM64_NGREGS];
32
33typedef struct elf64_hdr {
34 unsigned char e_ident[EI_NIDENT];
35 Elf64_Half e_type;
36 Elf64_Half e_machine;
37 Elf64_Word e_version;
38 Elf64_Addr e_entry;
39 Elf64_Off e_phoff;
40 Elf64_Off e_shoff;
41 Elf64_Word e_flags;
42 Elf64_Half e_ehsize;
43 Elf64_Half e_phentsize;
44 Elf64_Half e_phnum;
45 Elf64_Half e_shentsize;
46 Elf64_Half e_shnum;
47 Elf64_Half e_shstrndx;
48} Elf64_ehdr;
49
50typedef struct elf64_phdr {
51 Elf64_Word p_type;
52 Elf64_Word p_flags;
53 Elf64_Off p_offset;
54 Elf64_Addr p_vaddr;
55 Elf64_Addr p_paddr;
56 Elf64_Xword p_filesz;
57 Elf64_Xword p_memsz;
58 Elf64_Xword p_align;
59} Elf64_phdr;
60
61typedef struct elf64_note {
62 Elf64_Word n_namesz; /* Name size */
63 Elf64_Word n_descsz; /* Content size */
64 Elf64_Word n_type; /* Content type */
65} Elf64_nhdr;
66
67struct elf_timeval64 {
68 int64_t tv_sec;
69 int64_t tv_usec;
70};
71
72struct elf_siginfo {
73 int64_t si_signo;
74 int64_t si_code;
75 int64_t si_errno;
76};
77
78struct elf_arm64_prstatus64 {
79 struct elf_siginfo pr_info;
80 short pr_cursig;
81 uint64_t pr_sigpend;
82 uint64_t pr_sighold;
83
84 int32_t pr_pid;
85 int32_t pr_ppid;
86 int32_t pr_pgrp;
87
88 int32_t pr_sid;
89 struct elf_timeval64 pr_utime;
90 struct elf_timeval64 pr_stime;
91 struct elf_timeval64 pr_cutime;
92 struct elf_timeval64 pr_cstime;
93
94 elf_arm64_gregset_t pr_reg;
95
96 int64_t pr_fpvalid;
97};
98
99struct elf_prpsinfo64 {
100 char pr_state;
101 char pr_sname;
102 char pr_zomb;
103 char pr_nice;
104 uint64_t pr_flag;
105
106 uint32_t pr_uid;
107 uint32_t pr_gid;
108
109 int32_t pr_pid;
110 int32_t pr_ppid;
111 int32_t pr_pgrp;
112 int32_t pr_sid;
113
114 char pr_fname[16];
115 char pr_psargs[ELF_PRARGSZ];
116};
117
118#endif /* __MRDUMP_ELF64_H__ */