~ubuntu-branches/ubuntu/utopic/xen/utopic

« back to all changes in this revision

Viewing changes to xen/include/asm-x86/x86_32/elf.h

  • Committer: Bazaar Package Importer
  • Author(s): Bastian Blank
  • Date: 2010-05-06 15:47:38 UTC
  • mto: (1.3.1) (15.1.1 sid) (4.1.1 experimental)
  • mto: This revision was merged to the branch mainline in revision 3.
  • Revision ID: james.westby@ubuntu.com-20100506154738-agoz0rlafrh1fnq7
Tags: upstream-4.0.0
ImportĀ upstreamĀ versionĀ 4.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef __X86_32_ELF_H__
 
2
#define __X86_32_ELF_H__
 
3
 
 
4
typedef struct {
 
5
    unsigned long ebx;
 
6
    unsigned long ecx;
 
7
    unsigned long edx;
 
8
    unsigned long esi;
 
9
    unsigned long edi;
 
10
    unsigned long ebp;
 
11
    unsigned long eax;
 
12
    unsigned long ds;
 
13
    unsigned long es;
 
14
    unsigned long fs;
 
15
    unsigned long gs;
 
16
    unsigned long orig_eax;
 
17
    unsigned long eip;
 
18
    unsigned long cs;
 
19
    unsigned long eflags;
 
20
    unsigned long esp;
 
21
    unsigned long ss;
 
22
} ELF_Gregset;
 
23
 
 
24
static inline void elf_core_save_regs(ELF_Gregset *core_regs, 
 
25
                                      crash_xen_core_t *xen_core_regs)
 
26
{
 
27
    unsigned long tmp;
 
28
 
 
29
    asm volatile("movl %%ebx,%0" : "=m"(core_regs->ebx));
 
30
    asm volatile("movl %%ecx,%0" : "=m"(core_regs->ecx));
 
31
    asm volatile("movl %%edx,%0" : "=m"(core_regs->edx));
 
32
    asm volatile("movl %%esi,%0" : "=m"(core_regs->esi));
 
33
    asm volatile("movl %%edi,%0" : "=m"(core_regs->edi));
 
34
    asm volatile("movl %%ebp,%0" : "=m"(core_regs->ebp));
 
35
    asm volatile("movl %%eax,%0" : "=m"(core_regs->eax));
 
36
    asm volatile("movw %%ds, %%ax;" :"=a"(core_regs->ds));
 
37
    asm volatile("movw %%es, %%ax;" :"=a"(core_regs->es));
 
38
    asm volatile("movw %%fs, %%ax;" :"=a"(core_regs->fs));
 
39
    asm volatile("movw %%gs, %%ax;" :"=a"(core_regs->gs));
 
40
    /* orig_eax not filled in for now */
 
41
    core_regs->eip = (unsigned long)elf_core_save_regs;
 
42
    asm volatile("movw %%cs, %%ax;" :"=a"(core_regs->cs));
 
43
    asm volatile("pushfl; popl %0" :"=m"(core_regs->eflags));
 
44
    asm volatile("movl %%esp,%0" : "=m"(core_regs->esp));
 
45
    asm volatile("movw %%ss, %%ax;" :"=a"(core_regs->ss));
 
46
 
 
47
    asm volatile("mov %%cr0, %0" : "=r" (tmp) : );
 
48
    xen_core_regs->cr0 = tmp;
 
49
 
 
50
    asm volatile("mov %%cr2, %0" : "=r" (tmp) : );
 
51
    xen_core_regs->cr2 = tmp;
 
52
 
 
53
    asm volatile("mov %%cr3, %0" : "=r" (tmp) : );
 
54
    xen_core_regs->cr3 = tmp;
 
55
 
 
56
    asm volatile("mov %%cr4, %0" : "=r" (tmp) : );
 
57
    xen_core_regs->cr4 = tmp;
 
58
}
 
59
 
 
60
#endif /* __X86_32_ELF_H__ */
 
61
 
 
62
/*
 
63
 * Local variables:
 
64
 * mode: C
 
65
 * c-set-style: "BSD"
 
66
 * c-basic-offset: 4
 
67
 * tab-width: 4
 
68
 * indent-tabs-mode: nil
 
69
 * End:
 
70
 */