1###################################-*-asm*-
2#
3#    Copyright (C) 2009-2015 Free Software Foundation, Inc.
4#
5#
6#  Contributed by Michael Eager <eager@eagercon.com>.
7#
8#  This file is free software; you can redistribute it and/or modify it
9#  under the terms of the GNU General Public License as published by the
10#  Free Software Foundation; either version 3, or (at your option) any
11#  later version.
12#
13#  GCC is distributed in the hope that it will be useful, but WITHOUT
14#  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
15#  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
16#  License for more details.
17#
18#  Under Section 7 of GPL version 3, you are granted additional
19#  permissions described in the GCC Runtime Library Exception, version
20#  3.1, as published by the Free Software Foundation.
21#
22#  You should have received a copy of the GNU General Public License and
23#  a copy of the GCC Runtime Library Exception along with this program;
24#  see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
25#  <http://www.gnu.org/licenses/>.
26#
27#  stack_overflow_exit.S
28#
29#  Checks for stack overflows and sets the global variable
30#  stack_overflow_error with the value of current stack pointer
31#
32#  This routine exits from the program
33#
34#######################################
35
36	.globl	_stack_overflow_error
37	.data
38	.align	2
39	.type	_stack_overflow_error,@object
40	.size	_stack_overflow_error,4
41_stack_overflow_error:
42	.data32	0
43
44	.text
45	.globl	_stack_overflow_exit
46	.ent	_stack_overflow_exit
47	.type	_stack_overflow_exit,@function
48
49_stack_overflow_exit:
50#ifdef __PIC__
51	mfs	r20,rpc
52	addik	r20,r20,_GLOBAL_OFFSET_TABLE_+8
53	swi	r1,r20,_stack_overflow_error@GOTOFF
54	bri	exit@PLT
55#else
56	swi	r1,r0,_stack_overflow_error
57	bri	exit
58#endif
59
60	.end 	_stack_overflow_exit
61	.size	_stack_overflow_exit,. - _stack_overflow_exit
62