blob: 9c1f24fd5d112a1e0e94503180fb17b425e8e596 [file] [log] [blame]
Stephen Rothwell608f8b32005-11-03 16:24:25 +11001#ifndef _ASM_POWERPC_SIGCONTEXT_H
2#define _ASM_POWERPC_SIGCONTEXT_H
Linus Torvalds1da177e2005-04-16 15:20:36 -07003
4/*
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version
8 * 2 of the License, or (at your option) any later version.
9 */
10#include <linux/compiler.h>
11#include <asm/ptrace.h>
Stephen Rothwell608f8b32005-11-03 16:24:25 +110012#ifdef __powerpc64__
Linus Torvalds1da177e2005-04-16 15:20:36 -070013#include <asm/elf.h>
Stephen Rothwell608f8b32005-11-03 16:24:25 +110014#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -070015
16struct sigcontext {
17 unsigned long _unused[4];
18 int signal;
Stephen Rothwell608f8b32005-11-03 16:24:25 +110019#ifdef __powerpc64__
Linus Torvalds1da177e2005-04-16 15:20:36 -070020 int _pad0;
Stephen Rothwell608f8b32005-11-03 16:24:25 +110021#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -070022 unsigned long handler;
23 unsigned long oldmask;
24 struct pt_regs __user *regs;
Stephen Rothwell608f8b32005-11-03 16:24:25 +110025#ifdef __powerpc64__
Linus Torvalds1da177e2005-04-16 15:20:36 -070026 elf_gregset_t gp_regs;
27 elf_fpregset_t fp_regs;
28/*
Stephen Rothwell608f8b32005-11-03 16:24:25 +110029 * To maintain compatibility with current implementations the sigcontext is
30 * extended by appending a pointer (v_regs) to a quadword type (elf_vrreg_t)
31 * followed by an unstructured (vmx_reserve) field of 69 doublewords. This
32 * allows the array of vector registers to be quadword aligned independent of
33 * the alignment of the containing sigcontext or ucontext. It is the
34 * responsibility of the code setting the sigcontext to set this pointer to
35 * either NULL (if this processor does not support the VMX feature) or the
Linus Torvalds1da177e2005-04-16 15:20:36 -070036 * address of the first quadword within the allocated (vmx_reserve) area.
37 *
Stephen Rothwell608f8b32005-11-03 16:24:25 +110038 * The pointer (v_regs) of vector type (elf_vrreg_t) is type compatible with
39 * an array of 34 quadword entries (elf_vrregset_t). The entries with
40 * indexes 0-31 contain the corresponding vector registers. The entry with
41 * index 32 contains the vscr as the last word (offset 12) within the
42 * quadword. This allows the vscr to be stored as either a quadword (since
43 * it must be copied via a vector register to/from storage) or as a word.
44 * The entry with index 33 contains the vrsave as the first word (offset 0)
Linus Torvalds1da177e2005-04-16 15:20:36 -070045 * within the quadword.
Michael Neulingce48b212008-06-25 14:07:18 +100046 *
47 * Part of the VSX data is stored here also by extending vmx_restore
48 * by an additional 32 double words. Architecturally the layout of
49 * the VSR registers and how they overlap on top of the legacy FPR and
50 * VR registers is shown below:
51 *
52 * VSR doubleword 0 VSR doubleword 1
53 * ----------------------------------------------------------------
54 * VSR[0] | FPR[0] | |
55 * ----------------------------------------------------------------
56 * VSR[1] | FPR[1] | |
57 * ----------------------------------------------------------------
58 * | ... | |
59 * | ... | |
60 * ----------------------------------------------------------------
61 * VSR[30] | FPR[30] | |
62 * ----------------------------------------------------------------
63 * VSR[31] | FPR[31] | |
64 * ----------------------------------------------------------------
65 * VSR[32] | VR[0] |
66 * ----------------------------------------------------------------
67 * VSR[33] | VR[1] |
68 * ----------------------------------------------------------------
69 * | ... |
70 * | ... |
71 * ----------------------------------------------------------------
72 * VSR[62] | VR[30] |
73 * ----------------------------------------------------------------
74 * VSR[63] | VR[31] |
75 * ----------------------------------------------------------------
76 *
77 * FPR/VSR 0-31 doubleword 0 is stored in fp_regs, and VMX/VSR 32-63
78 * is stored at the start of vmx_reserve. vmx_reserve is extended for
79 * backwards compatility to store VSR 0-31 doubleword 1 after the VMX
80 * registers and vscr/vrsave.
Linus Torvalds1da177e2005-04-16 15:20:36 -070081 */
82 elf_vrreg_t __user *v_regs;
Michael Neulingce48b212008-06-25 14:07:18 +100083 long vmx_reserve[ELF_NVRREG+ELF_NVRREG+32+1];
Stephen Rothwell608f8b32005-11-03 16:24:25 +110084#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -070085};
86
Stephen Rothwell608f8b32005-11-03 16:24:25 +110087#endif /* _ASM_POWERPC_SIGCONTEXT_H */