#if !defined(__ELF__)
#define sys_getaoutheader(dst,nr) sys_getinfo(GET_AOUTHEADER, dst, 0,0,nr)
#endif
+#define sys_getregs(dst,nr) sys_getinfo(GET_REGS, dst, 0,0, nr)
_PROTOTYPE(int sys_getinfo, (int request, void *val_ptr, int val_len,
void *val_ptr2, int val_len2) );
_PROTOTYPE(int sys_whoami, (endpoint_t *ep, char *name, int namelen,
#include <machine/elf.h>
#include "param.h"
-#include <machine/archtypes.h>
-#include "../../kernel/const.h"
-#include "../../kernel/config.h"
-#include "../../kernel/type.h"
-#include "../../kernel/proc.h"
-
/* Include ELF headers */
#include <sys/elf_core.h>
#include <sys/procfs.h>
FORWARD _PROTOTYPE( void dump_elf_header, (Elf32_Ehdr elf_header) );
FORWARD _PROTOTYPE( void dump_notes, (Elf32_Nhdr nhdrs[], int csig,
char *exe_name) );
+FORWARD _PROTOTYPE( void dump_program_headers, (Elf_Phdr phdrs[],
+ int phnum) );
FORWARD _PROTOTYPE( void dump_segments, (Elf32_Phdr phdrs[], int phnum) );
/*===========================================================================*
minix_elfcore_info_t mei;
int mei_len = sizeof(minix_elfcore_info_t);
int gregs_len = sizeof(gregset_t);
- struct proc p;
+ struct stackframe_s regs;
char proc_name[PROC_NAME_LEN];
/* Get process's name */
if (sys_datacopy(PM_PROC_NR, (vir_bytes) exe_name,
VFS_PROC_NR, (vir_bytes) proc_name, PROC_NAME_LEN) != OK)
- printf("VFS: Cannot get porcess's name\n");
+ printf("VFS: Cannot get process's name\n");
/* Dump first note entry */
mei.mei_version = MINIX_ELFCORE_VERSION;
write_buf((char *)&mei, mei_len);
write_buf(pad, PAD_LEN(mei_len) - mei_len);
- /* XXX: Other way to read registries ? */
/* Get registers */
- if (sys_getproc(&p, fp->fp_endpoint) != OK)
+ if (sys_getregs(®s, fp->fp_endpoint) != OK)
printf("VFS: Could not read registers\n");
+ if (sizeof(regs) != gregs_len)
+ printf("VFS: Wrong core register structure size\n");
+
/* Dump second note entry - the general registers */
write_buf((char *)&nhdrs[1], sizeof(Elf_Nhdr));
write_buf(note_name, nhdrs[1].n_namesz);
write_buf(pad, PAD_LEN(nhdrs[1].n_namesz) - nhdrs[1].n_namesz);
- write_buf((char *)&(p.p_reg), gregs_len);
+ write_buf((char *)®s, gregs_len);
write_buf(pad, PAD_LEN(gregs_len) - gregs_len);
}