Index: kernel/generic/include/lib/elf.h
===================================================================
--- kernel/generic/include/lib/elf.h	(revision f5d51de74cf5ceb308bf3defa9fe55855681e4ec)
+++ kernel/generic/include/lib/elf.h	(revision 74e6b1fc662aac7baccba209e10b859ffaabde8c)
@@ -327,8 +327,15 @@
 	elf_word type;
 };
+/*
+ * NOTE: namesz, descsz and type should be 64-bits wide (elf_xword)
+ * per the 64-bit ELF spec. The Linux kernel however screws up and
+ * defines them as Elf64_Word, which is 32-bits wide(!). We are trying
+ * to make our core files compatible with Linux GDB target so we copy
+ * the blunder here.
+ */
 struct elf64_note {
-	elf_xword namesz;
-	elf_xword descsz;
-	elf_xword type;
+	elf_word namesz;
+	elf_word descsz;
+	elf_word type;
 };
 
Index: uspace/app/taskdump/elf_core.c
===================================================================
--- uspace/app/taskdump/elf_core.c	(revision f5d51de74cf5ceb308bf3defa9fe55855681e4ec)
+++ uspace/app/taskdump/elf_core.c	(revision 74e6b1fc662aac7baccba209e10b859ffaabde8c)
@@ -106,5 +106,10 @@
 #endif
 #ifdef __64_BITS__
-	word_size = 8;
+	/*
+	 * This should be 8 per the 64-bit ELF spec, but the Linux kernel
+	 * screws up and uses 4 anyway (and screws up elf_note_t as well)
+	 * and we are trying to be compatible with Linux GDB target. Sigh.
+	 */
+	word_size = 4;
 #endif
 	memset(&pr_status, 0, sizeof(pr_status));
Index: uspace/lib/c/arch/amd64/include/elf_linux.h
===================================================================
--- uspace/lib/c/arch/amd64/include/elf_linux.h	(revision f5d51de74cf5ceb308bf3defa9fe55855681e4ec)
+++ uspace/lib/c/arch/amd64/include/elf_linux.h	(revision 74e6b1fc662aac7baccba209e10b859ffaabde8c)
@@ -30,5 +30,5 @@
  * @{
  */
-/** @file
+/** @file Definitions needed to write core files in Linux-ELF format.
  */
 
@@ -39,13 +39,56 @@
 #include <sys/types.h>
 
+/** Linux kernel struct pt_regs structure.
+ *
+ * We need this to save register state to a core file in Linux format
+ * (readable by GDB configured for Linux target).
+ */
 typedef struct {
-	/* TODO */
-	uint64_t pad[16];
+	uint64_t r15;
+	uint64_t r14;
+	uint64_t r13;
+	uint64_t r12;
+	uint64_t rbp;
+	uint64_t rbx;
+	uint64_t r11;
+	uint64_t r10;
+	uint64_t r9;
+	uint64_t r8;
+	uint64_t rax;
+	uint64_t rcx;
+	uint64_t rdx;
+	uint64_t rsi;
+	uint64_t rdi;
+	uint64_t old_rax;
+	uint64_t rip;
+	uint64_t cs;
+	uint64_t rflags;
+	uint64_t rsp;
+	uint64_t ss;
 } elf_regs_t;
 
+/** Convert istate_t to elf_regs_t. */
 static inline void istate_to_elf_regs(istate_t *istate, elf_regs_t *elf_regs)
 {
-	/* TODO */
-	(void) istate; (void) elf_regs;
+	elf_regs->r15 = istate->r15;
+	elf_regs->r14 = istate->r14;
+	elf_regs->r13 = istate->r13;
+	elf_regs->r12 = istate->r12;
+	elf_regs->rbp = istate->rbp;
+	elf_regs->rbx = istate->rbx;
+	elf_regs->r11 = istate->r11;
+	elf_regs->r10 = istate->r10;
+	elf_regs->r9 = istate->r9;
+	elf_regs->r8 = istate->r8;
+	elf_regs->rax = istate->rax;
+	elf_regs->rcx = istate->rcx;
+	elf_regs->rdx = istate->rdx;
+	elf_regs->rsi = istate->rsi;
+	elf_regs->rdi = istate->rdi;
+	elf_regs->rip = istate->rip;
+	elf_regs->cs = istate->cs;
+	elf_regs->rflags = istate->rflags;
+	elf_regs->rsp = istate->rsp;
+	elf_regs->ss = istate->ss;
 }
 
Index: uspace/lib/c/arch/ia32/include/elf_linux.h
===================================================================
--- uspace/lib/c/arch/ia32/include/elf_linux.h	(revision f5d51de74cf5ceb308bf3defa9fe55855681e4ec)
+++ uspace/lib/c/arch/ia32/include/elf_linux.h	(revision 74e6b1fc662aac7baccba209e10b859ffaabde8c)
@@ -30,5 +30,5 @@
  * @{
  */
-/** @file
+/** @file Definitions needed to write core files in Linux-ELF format.
  */
 
@@ -39,4 +39,9 @@
 #include <sys/types.h>
 
+/** Linux kernel struct pt_regs structure.
+ *
+ * We need this to save register state to a core file in Linux format
+ * (readable by GDB configured for Linux target).
+ */
 typedef struct {
 	uint32_t ebx;
@@ -59,4 +64,5 @@
 } elf_regs_t;
 
+/** Convert istate_t to elf_regs_t. */
 static inline void istate_to_elf_regs(istate_t *istate, elf_regs_t *elf_regs)
 {
