xref: /freebsd/usr.bin/gcore/elf32core.c (revision 640235e2c2ba32947f7c59d168437ffa1280f1e6)
1 /* $FreeBSD$ */
2 #ifndef __LP64__
3 #error "this file must be compiled for LP64."
4 #endif
5 
6 #define __ELF_WORD_SIZE 32
7 #define _MACHINE_ELF_WANT_32BIT
8 
9 #include <sys/procfs.h>
10 
11 #define	ELFCORE_COMPAT_32	1
12 #include "elfcore.c"
13 
14 static void
15 elf_convert_gregset(elfcore_gregset_t *rd, struct reg *rs)
16 {
17 #ifdef __amd64__
18 	rd->r_gs = rs->r_gs;
19 	rd->r_fs = rs->r_fs;
20 	rd->r_es = rs->r_es;
21 	rd->r_ds = rs->r_ds;
22 	rd->r_edi = rs->r_rdi;
23 	rd->r_esi = rs->r_rsi;
24 	rd->r_ebp = rs->r_rbp;
25 	rd->r_ebx = rs->r_rbx;
26 	rd->r_edx = rs->r_rdx;
27 	rd->r_ecx = rs->r_rcx;
28 	rd->r_eax = rs->r_rax;
29 	rd->r_eip = rs->r_rip;
30 	rd->r_cs = rs->r_cs;
31 	rd->r_eflags = rs->r_rflags;
32 	rd->r_esp = rs->r_rsp;
33 	rd->r_ss = rs->r_ss;
34 #else
35 #error Unsupported architecture
36 #endif
37 }
38 
39 static void
40 elf_convert_fpregset(elfcore_fpregset_t *rd, struct fpreg *rs)
41 {
42 #ifdef __amd64__
43 	/* XXX this is wrong... */
44 	memcpy(rd, rs, sizeof(*rd));
45 #else
46 #error Unsupported architecture
47 #endif
48 }
49