On Thu, 2005-10-27 at 14:36 -0400, Dave Anderson wrote:
#ifdef X86_64
#define _64BIT_
#define MACHINE_TYPE "X86_64"
#define USERSPACE_TOP 0x0000008000000000
#define __START_KERNEL_map 0xffffffff80000000
#define PAGE_OFFSET 0x0000010000000000
#define VMALLOC_START 0xffffff0000000000
#define VMALLOC_END 0xffffff7fffffffff
#define MODULES_VADDR 0xffffffffa0000000
#define MODULES_END 0xffffffffafffffff
#define MODULES_LEN (MODULES_END - MODULES_VADDR)
So I believe the place to start would be to make these
values into x86_64-specific variables that get initialized
early on based upon the symbol values gathered during
symtab_init(), which is called by main(). After it
completes, machdep_init(PRE_GDB) is called, i.e. x86_64_init():
/*
* Initialize various subsystems.
*/
fd_init();
buf_init();
cmdline_init();
mem_init();
machdep_init(PRE_SYMTAB);
symtab_init();
machdep_init(PRE_GDB);
kernel_init(PRE_GDB);
verify_version();
datatype_init();
In x86_64_init(PRE_GDB), the former hardwired #defines would need
to be variables, initialized properly based upon clues in the symbol
list.
Interested in taking a look into this?
Dave
Well, I took a stab at it. Here are the changes I made to "defs.h"
looking at Documentation/x86_64/mm.txt. We need to some how put
this under "#if THIS_KERNEL_VERSION > 2.6.10".
---
defs.h.org 2005-10-28 13:43:11.000000000 -0700
+++ defs.h 2005-10-28 13:53:58.000000000 -0700
@@ -1740,14 +1740,14 @@ struct load_module {
#define _64BIT_
#define MACHINE_TYPE "X86_64"
-#define USERSPACE_TOP 0x0000008000000000
+#define USERSPACE_TOP 0x0000800000000000
#define __START_KERNEL_map 0xffffffff80000000
-#define PAGE_OFFSET 0x0000010000000000
+#define PAGE_OFFSET 0xffff810000000000
-#define VMALLOC_START 0xffffff0000000000
-#define VMALLOC_END 0xffffff7fffffffff
-#define MODULES_VADDR 0xffffffffa0000000
-#define MODULES_END 0xffffffffafffffff
+#define VMALLOC_START 0xffffc20000000000
+#define VMALLOC_END 0xffffe1ffffffffff
+#define MODULES_VADDR 0xffffffff88000000
+#define MODULES_END 0xfffffffffff00000
#define MODULES_LEN (MODULES_END - MODULES_VADDR)
#define PTOV(X) ((unsigned long)(X)+(machdep->kvbase))
Even with these changes, I am not sure if crash is running
fine. Its seem doesn't show any useful stacks + there is a
warning on start (about exception stacks).
[root@localhost crash-4.0-2.8]# ./crash
crash 4.0-2.8
Copyright (C) 2002, 2003, 2004, 2005 Red Hat, Inc.
Copyright (C) 2004, 2005 IBM Corporation
Copyright (C) 1999-2005 Hewlett-Packard Co
Copyright (C) 1999, 2002 Silicon Graphics, Inc.
Copyright (C) 1999, 2000, 2001, 2002 Mission Critical Linux, Inc.
This program is free software, covered by the GNU General Public
License,
and you are welcome to change it and/or distribute copies of it under
certain conditions. Enter "help copying" to see the conditions.
This program has absolutely no warranty. Enter "help warranty" for
details.
GNU gdb 6.1
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you
are
welcome to change it and/or distribute copies of it under certain
conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for
details.
This GDB was configured as "x86_64-unknown-linux-gnu"...
WARNING: cpu 0 first exception stack: cccccccccccccccc
boot_exception_stacks: ffffffff8052ce80
KERNEL: /usr/src/linux-2.6.14-rc5-madv/vmlinux
DUMPFILE: /dev/mem
CPUS: 2
DATE: Fri Oct 28 13:58:50 2005
UPTIME: 06:32:12
LOAD AVERAGE: 0.11, 0.10, 0.06
TASKS: 66
NODENAME: localhost.localdomain
RELEASE: 2.6.14-rc5
VERSION: #10 SMP Wed Oct 26 15:58:51 PDT 2005
MACHINE: x86_64 (3000 Mhz)
MEMORY: 4.6 GB
PID: 1460
COMMAND: "crash"
TASK: ffff810122c9f0c0 [THREAD_INFO: ffff810113442000]
CPU: 0
STATE: TASK_RUNNING (ACTIVE)
crash>
crash> bt 13939
PID: 13939 TASK: ffff810119123740 CPU: 0 COMMAND: "vi"
#0 [ffff810114535c78] schedule at ffffffff803b12b3
RIP: 000000377c7beb95 RSP: 00007ffffff402d8 RFLAGS: 00010246
RAX: 0000000000000017 RBX: ffffffff8010dc26 RCX: 00007ffffff40388
RDX: 0000000000000000 RSI: 00007ffffff400a0 RDI: 0000000000000001
RBP: 0000000000000000 R8: 0000000000000000 R9: 00007ffffff40020
R10: 00007ffffff40020 R11: 0000000000000246 R12: 000000000058b0e0
R13: 000000000058b0e0 R14: 0000000000000058 R15: 0000000000000001
ORIG_RAX: 0000000000000017 CS: 0033 SS: 002b
It shows only "schedule" for all processes. Doesn't seem to show
any more stack traces.
Thanks,
Badari