1 #ifndef _ASM_I386_CRASHDUMP_H
2 #define _ASM_I386_CRASHDUMP_H
5 * linux/include/asm-i386/crashdump.h
7 * Copyright (c) 2003, 2004 Red Hat, Inc. All rights reserved.
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2, or (at your option)
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
30 * Structure taken from arch/i386/kernel/irq.c. It used to live in asm/irq.h.
32 #ifdef CONFIG_4KSTACKS
34 struct thread_info tinfo;
35 u32 stack[THREAD_SIZE/sizeof(u32)];
39 extern int page_is_ram (unsigned long);
40 extern unsigned long next_ram_page (unsigned long);
42 #define platform_timestamp(x) rdtscll(x)
44 #define platform_fix_regs() \
48 esp = (unsigned long) ((char *)regs + sizeof (struct pt_regs)); \
50 if (regs->xcs & 3) { \
52 ss = regs->xss & 0xffff; \
56 myregs.xss = (myregs.xss & 0xffff0000) | ss; \
59 static inline void platform_init_stack(void **stackptr)
61 #ifdef CONFIG_4KSTACKS
62 *stackptr = (void *)kmalloc(sizeof(union dump_irq_ctx), GFP_KERNEL);
64 memset(*stackptr, 0, sizeof(union dump_irq_ctx));
67 "crashdump: unable to allocate separate stack\n");
73 typedef asmlinkage void (*crashdump_func_t)(struct pt_regs *, void *);
75 static inline void platform_start_crashdump(void *stackptr,
76 crashdump_func_t dumpfunc,
81 #ifdef CONFIG_4KSTACKS
84 union dump_irq_ctx * curctx;
85 union dump_irq_ctx * dumpctx;
87 curctx = (union dump_irq_ctx *) current_thread_info();
88 dumpctx = (union dump_irq_ctx *) stackptr;
90 /* build the stack frame on the IRQ stack */
91 dsp = (u32*) ((char*)dumpctx + sizeof(*dumpctx));
92 dumpctx->tinfo.task = curctx->tinfo.task;
93 dumpctx->tinfo.previous_esp = current_stack_pointer;
99 " xchgl %%ebx,%%esp \n"
101 " xchgl %%ebx,%%esp \n"
102 : : "a"(dumpfunc), "b"(dsp)
103 : "memory", "cc", "edx", "ecx"
109 #define platform_cleanup_stack(stackptr) \
115 #define platform_freeze_cpu() \
117 for (;;) local_irq_disable(); \
121 #endif /* __KERNEL__ */
123 #endif /* _ASM_I386_CRASHDUMP_H */