aboutsummaryrefslogtreecommitdiff
path: root/sys/sys
diff options
context:
space:
mode:
authorEdward Tomasz Napierala <trasz@FreeBSD.org>2021-06-29 07:49:04 +0000
committerEdward Tomasz Napierala <trasz@FreeBSD.org>2021-06-29 07:49:12 +0000
commit435754a59ee203c3369f47ff9103f269c81581b7 (patch)
tree30f750128028c70ad9024b6f3362f7b38828fd83 /sys/sys
parentd26ef5c7ac830812f07a02787f25fed5d6f8609e (diff)
downloadsrc-435754a59ee203c3369f47ff9103f269c81581b7.tar.gz
src-435754a59ee203c3369f47ff9103f269c81581b7.zip
Add infrastructure required for Linux coredump support
This adds `sv_elf_core_osabi`, `sv_elf_core_abi_vendor`, and `sv_elf_core_prepare_notes` fields to `struct sysentvec`, and modifies imgact_elf.c to make use of them instead of hardcoding FreeBSD-specific values. It also updates all of the ABI definitions to preserve current behaviour. This makes it possible to implement non-native ELF coredump support without unnecessary code duplication. It will be used for Linux coredumps. Reviewed By: kib Sponsored By: EPSRC Differential Revision: https://reviews.freebsd.org/D30921
Diffstat (limited to 'sys/sys')
-rw-r--r--sys/sys/imgact_elf.h11
-rw-r--r--sys/sys/sysent.h5
2 files changed, 15 insertions, 1 deletions
diff --git a/sys/sys/imgact_elf.h b/sys/sys/imgact_elf.h
index f0c112b2bcdc..44a860359a75 100644
--- a/sys/sys/imgact_elf.h
+++ b/sys/sys/imgact_elf.h
@@ -50,6 +50,8 @@
struct image_params;
struct thread;
struct vnode;
+struct note_info_list;
+struct sbuf;
/*
* Structure used to pass information from the loader to the
@@ -98,7 +100,10 @@ typedef struct {
__ElfType(Auxargs);
__ElfType(Brandinfo);
-#define MAX_BRANDS 8
+#define MAX_BRANDS 8
+#define FREEBSD_ABI_VENDOR "FreeBSD"
+
+typedef void (*outfunc_t)(void *, struct sbuf *, size_t *);
/* Closure for __elfN(size_segments)(). */
struct sseg_closure {
@@ -115,7 +120,11 @@ size_t __elfN(populate_note)(int, void *, void *, size_t, void **);
void __elfN(stackgap)(struct image_params *, uintptr_t *);
int __elfN(freebsd_copyout_auxargs)(struct image_params *, uintptr_t);
void __elfN(puthdr)(struct thread *, void *, size_t, int, size_t, int);
+void __elfN(prepare_notes)(struct thread *, struct note_info_list *,
+ size_t *);
void __elfN(size_segments)(struct thread *, struct sseg_closure *, int);
+size_t __elfN(register_note)(struct thread *, struct note_info_list *,
+ int, outfunc_t, void *);
/* Machine specific function to dump per-thread information. */
void __elfN(dump_thread)(struct thread *, void *, size_t *);
diff --git a/sys/sys/sysent.h b/sys/sys/sysent.h
index 8b0903f7dcc0..e0e5e351ae20 100644
--- a/sys/sys/sysent.h
+++ b/sys/sys/sysent.h
@@ -98,6 +98,7 @@ struct proc;
struct __sigset;
struct trapframe;
struct vnode;
+struct note_info_list;
struct sysentvec {
int sv_size; /* number of entries */
@@ -113,6 +114,10 @@ struct sysentvec {
char *sv_name; /* name of binary type */
int (*sv_coredump)(struct thread *, struct vnode *, off_t, int);
/* function to dump core, or NULL */
+ int sv_elf_core_osabi;
+ const char *sv_elf_core_abi_vendor;
+ void (*sv_elf_core_prepare_notes)(struct thread *,
+ struct note_info_list *, size_t *);
int (*sv_imgact_try)(struct image_params *);
void (*sv_stackgap)(struct image_params *, uintptr_t *);
int (*sv_copyout_auxargs)(struct image_params *,