1269128Smarcel/* $FreeBSD: releng/11.0/usr.bin/gcore/elf32core.c 281266 2015-04-08 16:30:45Z jhb $ */ 2269128Smarcel#ifndef __LP64__ 3269128Smarcel#error "this file must be compiled for LP64." 4269128Smarcel#endif 5269128Smarcel 6269128Smarcel#define __ELF_WORD_SIZE 32 7269128Smarcel#define _MACHINE_ELF_WANT_32BIT 8269128Smarcel 9269128Smarcel#include <sys/procfs.h> 10269128Smarcel 11269128Smarcel#define ELFCORE_COMPAT_32 1 12269128Smarcel#include "elfcore.c" 13269128Smarcel 14269128Smarcelstatic void 15269128Smarcelelf_convert_gregset(elfcore_gregset_t *rd, struct reg *rs) 16269128Smarcel{ 17269128Smarcel#ifdef __amd64__ 18269128Smarcel rd->r_gs = rs->r_gs; 19269128Smarcel rd->r_fs = rs->r_fs; 20269128Smarcel rd->r_es = rs->r_es; 21269128Smarcel rd->r_ds = rs->r_ds; 22269128Smarcel rd->r_edi = rs->r_rdi; 23269128Smarcel rd->r_esi = rs->r_rsi; 24269128Smarcel rd->r_ebp = rs->r_rbp; 25269128Smarcel rd->r_ebx = rs->r_rbx; 26269128Smarcel rd->r_edx = rs->r_rdx; 27269128Smarcel rd->r_ecx = rs->r_rcx; 28269128Smarcel rd->r_eax = rs->r_rax; 29269128Smarcel rd->r_eip = rs->r_rip; 30269128Smarcel rd->r_cs = rs->r_cs; 31269128Smarcel rd->r_eflags = rs->r_rflags; 32269128Smarcel rd->r_esp = rs->r_rsp; 33269128Smarcel rd->r_ss = rs->r_ss; 34269128Smarcel#else 35269128Smarcel#error Unsupported architecture 36269128Smarcel#endif 37269128Smarcel} 38269128Smarcel 39269128Smarcelstatic void 40269128Smarcelelf_convert_fpregset(elfcore_fpregset_t *rd, struct fpreg *rs) 41269128Smarcel{ 42269128Smarcel#ifdef __amd64__ 43269128Smarcel /* XXX this is wrong... */ 44269128Smarcel memcpy(rd, rs, sizeof(*rd)); 45269128Smarcel#else 46269128Smarcel#error Unsupported architecture 47269128Smarcel#endif 48269128Smarcel} 49