• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/* libunwind - a platform-independent unwind library
2   Copyright (C) 2008 Google, Inc
3	Contributed by Paul Pluzhnikov <ppluzhnikov@google.com>
4   Copyright (C) 2010 Konstantin Belousov <kib@freebsd.org>
5   Copyright (C) 2017 IBM
6
7   Modified for s390x by Michael Munday <mike.munday@ibm.com>
8
9This file is part of libunwind.
10
11Permission is hereby granted, free of charge, to any person obtaining
12a copy of this software and associated documentation files (the
13"Software"), to deal in the Software without restriction, including
14without limitation the rights to use, copy, modify, merge, publish,
15distribute, sublicense, and/or sell copies of the Software, and to
16permit persons to whom the Software is furnished to do so, subject to
17the following conditions:
18
19The above copyright notice and this permission notice shall be
20included in all copies or substantial portions of the Software.
21
22THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
23EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
25NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
26LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
27OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
28WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.  */
29
30// int _Us390x_getcontext (unw_tdep_context_t *ucp)
31
32	.global _Us390x_getcontext
33	.type _Us390x_getcontext, @function
34_Us390x_getcontext:
35	.cfi_startproc
36
37	// Save the minimal set of registers required to restore the
38	// context. Generally speaking this is just the preserved
39	// registers but we've also saved the parameter registers
40	// so that return values can be modified too.
41
42	// save PSW address
43	// (not strictly needed but makes other code simpler)
44	stg   %r14,0x30(%r2)
45
46	// floating point parameters (not strictly needed)
47	std   %f0,0x100(%r2)
48	std   %f2,0x110(%r2)
49	std   %f4,0x120(%r2)
50	std   %f6,0x130(%r2)
51
52	// floating point preserved registers
53	stfpc 0xf8(%r2)
54	std   %f8,0x140(%r2)
55	std   %f9,0x148(%r2)
56	std   %f10,0x150(%r2)
57	std   %f11,0x158(%r2)
58	std   %f12,0x160(%r2)
59	std   %f13,0x168(%r2)
60	std   %f14,0x170(%r2)
61	std   %f15,0x178(%r2)
62
63	// preserved registers and parameters
64	lgr   %r1,%r2
65	lghi  %r2,0
66	stmg  %r2,%r15,0x48(%r1)
67
68	br    %r14
69
70	.cfi_endproc
71	.size _Us390x_getcontext, . - _Us390x_getcontext
72
73	// We do not need executable stack.
74	.section        .note.GNU-stack,"",@progbits
75