2 * $Id: kl_dump_ia64.h 1151 2005-02-23 01:09:12Z tjm $
4 * This file is part of libklib.
5 * A library which provides access to Linux system kernel dumps.
7 * Created by Silicon Graphics, Inc.
8 * Contributions by IBM, NEC, and others
10 * Copyright (C) 1999 - 2005 Silicon Graphics, Inc. All rights reserved.
11 * Copyright (C) 2001, 2002 IBM Deutschland Entwicklung GmbH, IBM Corporation
12 * Copyright 2000 Junichi Nomura, NEC Solutions <j-nomura@ce.jp.nec.com>
14 * This code is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser Public License as published by
16 * the Free Software Foundation; either version 2.1 of the License, or
17 * (at your option) any later version. See the file COPYING for more
21 /* This header file holds the architecture specific crash dump header */
22 #ifndef __KL_DUMP_IA64_H
23 #define __KL_DUMP_IA64_H
27 # define KL_NR_CPUS 128 /* max number CPUs */
30 #define KL_DUMP_MAGIC_NUMBER_IA64 0xdeaddeadULL /* magic number */
31 #define KL_DUMP_VERSION_NUMBER_IA64 0x4 /* version number */
35 * mkswap.c calls getpagesize() to get the system page size,
36 * which is not necessarily the same as the hardware page size.
38 * For ia64 the kernel PAGE_SIZE can be configured from 4KB ... 16KB.
40 * The physical memory is layed out out in the hardware/minimal pages.
41 * This is the size we need to use for dumping physical pages.
43 * Note ths hardware/minimal page size being use in;
44 * arch/ia64/kernel/efi.c`efi_memmap_walk():
45 * curr.end = curr.start + (md->num_pages << 12);
47 * Since the system page size could change between the kernel we boot
48 * on the the kernel that cause the core dume we may want to have something
49 * more constant like the maximum system page size (See include/asm-ia64/page.h).
51 #define DUMP_MIN_PAGE_SHIFT 12
52 #define DUMP_MIN_PAGE_SIZE (1UL << DUMP_MIN_PAGE_SHIFT)
53 #define DUMP_MIN_PAGE_MASK (~(DUMP_MIN_PAGE_SIZE - 1))
54 #define DUMP_MIN_PAGE_ALIGN(addr) (((addr) + DUMP_MIN_PAGE_SIZE - 1) & DUMP_MIN_PAGE_MASK)
56 #define DUMP_MAX_PAGE_SHIFT 16
57 #define DUMP_MAX_PAGE_SIZE (1UL << DUMP_MAX_PAGE_SHIFT)
58 #define DUMP_MAX_PAGE_MASK (~(DUMP_MAX_PAGE_SIZE - 1))
59 #define DUMP_MAX_PAGE_ALIGN(addr) (((addr) + DUMP_MAX_PAGE_SIZE - 1) & DUMP_MAX_PAGE_MASK)
61 #define DUMP_HEADER_OFFSET DUMP_MAX_PAGE_SIZE
63 #define DUMP_EF_PAGE_SHIFT DUMP_MIN_PAGE_SHIFT
65 #define DUMP_PAGE_SHIFT DUMP_MIN_PAGE_SHIFT
66 #define DUMP_PAGE_SIZE DUMP_MIN_PAGE_SIZE
67 #define DUMP_PAGE_MASK DUMP_MIN_PAGE_MASK
68 #define DUMP_PAGE_ALIGN(addr) DUMP_MIN_PAGE_ALIGN(addr)
70 struct kl_ia64_fpreg {
72 unsigned long bits[2];
73 long double __dummy; /* force 16-byte alignment */
77 struct kl_pt_regs_ia64 {
78 /* for 2.6 kernels only. This structure was totally different in 2.4 kernels */
79 unsigned long b6; /* scratch */
80 unsigned long b7; /* scratch */
82 unsigned long ar_csd; /* used by cmp8xchg16 (scratch) */
83 unsigned long ar_ssd; /* reserved for future use (scratch) */
85 unsigned long r8; /* scratch (return value register 0) */
86 unsigned long r9; /* scratch (return value register 1) */
87 unsigned long r10; /* scratch (return value register 2) */
88 unsigned long r11; /* scratch (return value register 3) */
90 unsigned long cr_ipsr; /* interrupted task's psr */
91 unsigned long cr_iip; /* interrupted task's instruction pointer */
92 unsigned long cr_ifs; /* interrupted task's function state */
94 unsigned long ar_unat; /* interrupted task's NaT register (preserved) */
95 unsigned long ar_pfs; /* prev function state */
96 unsigned long ar_rsc; /* RSE configuration */
97 /* The following two are valid only if cr_ipsr.cpl > 0: */
98 unsigned long ar_rnat; /* RSE NaT */
99 unsigned long ar_bspstore; /* RSE bspstore */
101 unsigned long pr; /* 64 predicate registers (1 bit each) */
102 unsigned long b0; /* return pointer (bp) */
103 unsigned long loadrs; /* size of dirty partition << 16 */
105 unsigned long r1; /* the gp pointer */
106 unsigned long r12; /* interrupted task's memory stack pointer */
107 unsigned long r13; /* thread pointer */
109 unsigned long ar_fpsr; /* floating point status (preserved) */
110 unsigned long r15; /* scratch */
112 /* The remaining registers are NOT saved for system calls. */
114 unsigned long r14; /* scratch */
115 unsigned long r2; /* scratch */
116 unsigned long r3; /* scratch */
118 /* The following registers are saved by SAVE_REST: */
119 unsigned long r16; /* scratch */
120 unsigned long r17; /* scratch */
121 unsigned long r18; /* scratch */
122 unsigned long r19; /* scratch */
123 unsigned long r20; /* scratch */
124 unsigned long r21; /* scratch */
125 unsigned long r22; /* scratch */
126 unsigned long r23; /* scratch */
127 unsigned long r24; /* scratch */
128 unsigned long r25; /* scratch */
129 unsigned long r26; /* scratch */
130 unsigned long r27; /* scratch */
131 unsigned long r28; /* scratch */
132 unsigned long r29; /* scratch */
133 unsigned long r30; /* scratch */
134 unsigned long r31; /* scratch */
136 unsigned long ar_ccv; /* compare/exchange value (scratch) */
139 * * Floating point registers that the kernel considers scratch:
141 struct kl_ia64_fpreg f6; /* scratch */
142 struct kl_ia64_fpreg f7; /* scratch */
143 struct kl_ia64_fpreg f8; /* scratch */
144 struct kl_ia64_fpreg f9; /* scratch */
145 struct kl_ia64_fpreg f10; /* scratch */
146 struct kl_ia64_fpreg f11; /* scratch */
147 } __attribute__((packed));
150 * Structure: dump_header_asm_t
151 * Function: This is the header for architecture-specific stuff. It
152 * follows right after the dump header.
154 typedef struct kl_dump_header_ia64_s {
155 /* the dump magic number -- unique to verify dump is valid */
156 uint64_t magic_number;
157 /* the version number of this dump */
159 /* the size of this header (in case we can't read it) */
160 uint32_t header_size;
161 /* pointer to pt_regs */
163 /* the dump registers */
164 struct kl_pt_regs_ia64 regs;
165 /* the rnat register saved after flushrs */
167 /* the pfs register saved after flushrs */
169 /* the bspstore register saved after flushrs */
173 uint32_t smp_num_cpus;
174 uint32_t dumping_cpu;
175 struct kl_pt_regs_ia64 smp_regs[KL_NR_CPUS];
176 uint64_t smp_current_task[KL_NR_CPUS];
177 uint64_t stack[KL_NR_CPUS];
178 } __attribute__((packed)) kl_dump_header_ia64_t;
180 /* The following struct is used just to calculate the size needed
181 * to store per CPU info. (Make sure it is sync with the above struct)
183 struct kl_dump_CPU_info_ia64 {
184 struct kl_pt_regs_ia64 smp_regs;
185 uint64_t smp_current_task;
187 } __attribute__((packed));
189 /* function declarations
191 int kl_set_dumparch_ia64(void);
192 uint32_t dha_num_cpus_ia64(void);
193 kaddr_t dha_current_task_ia64(int cpuid);
194 int dha_cpuid_ia64(kaddr_t);
195 kaddr_t dha_stack_ia64(int);
196 kaddr_t dha_stack_ptr_ia64(int);
197 int kl_read_dump_header_ia64(void);
199 #endif /* __KL_DUMP_IA64_H */