]> git.ipfire.org Git - thirdparty/glibc.git/blame - sysdeps/alpha/bb_init_func.S
Update copyright dates with scripts/update-copyrights.
[thirdparty/glibc.git] / sysdeps / alpha / bb_init_func.S
CommitLineData
f7a9f785 1/* Copyright (C) 1996-2016 Free Software Foundation, Inc.
8a9cbf0d 2 Contributed by David Mosberger (davidm@cs.arizona.edu).
db31c863 3 This file is part of the GNU C Library.
8a9cbf0d 4
db31c863 5 The GNU C Library is free software; you can redistribute it and/or
3214b89b
AJ
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
8a9cbf0d 9
db31c863
UD
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
3214b89b 13 Lesser General Public License for more details.
8a9cbf0d 14
3214b89b 15 You should have received a copy of the GNU Lesser General Public
ab84e3ff
PE
16 License along with the GNU C Library. If not, see
17 <http://www.gnu.org/licenses/>. */
8a9cbf0d
RM
18
19/* __bb_init_func is invoked at the beginning of each function, before
db31c863
UD
20 any registers have been saved. It is therefore safe to use any
21 caller-saved (call-used) registers (except for argument registers
22 a1-a5). */
8a9cbf0d
RM
23
24#include <sysdep.h>
8a9cbf0d
RM
25
26/*
27 * These offsets should match with "struct bb" declared in gcc/libgcc2.c.
28 */
29#define ZERO_WORD 0x00
30#define NEXT 0x20
31
32 .set noat
33 .set noreorder
34
35ENTRY(__bb_init_func)
24c177a0
RM
36 .prologue 0
37
8a9cbf0d
RM
38 ldq t0, ZERO_WORD(a0) /* t0 <- blocks->zero_word */
39 beq t0, init /* not initialized yet -> */
40 ret
b870eeda 41
dd8dd50f 42END(__bb_init_func)
24c177a0 43
b870eeda 44 .ent init
dd8dd50f
RM
45init:
46 .frame sp, 0x38, ra, 0
24c177a0
RM
47 subq sp, 0x38, sp
48 .prologue 0
8a9cbf0d 49
8a9cbf0d
RM
50 stq pv, 0x30(sp)
51 br pv, 1f
521: ldgp gp, 0(pv)
53
49aebbc6 54 ldiq t1, __bb_head
8a9cbf0d
RM
55 lda t3, _gmonparam
56 ldq t2, 0(t1)
57 ldl t3, 0(t3) /* t3 = _gmonparam.state */
49aebbc6 58 lda t0, 1
8a9cbf0d
RM
59 stq t0, ZERO_WORD(a0) /* blocks->zero_word = 1 */
60 stq t2, NEXT(a0) /* blocks->next = __bb_head */
61 stq a0, 0(t1)
b870eeda
UD
62 bne t2, $leave
63 beq t3, $leave /* t3 == GMON_PROF_ON? yes -> */
8a9cbf0d
RM
64
65 /* also need to initialize destructor: */
66 stq ra, 0x00(sp)
67 lda a0, __bb_exit_func
68 stq a1, 0x08(sp)
69 lda pv, atexit
70 stq a2, 0x10(sp)
71 stq a3, 0x18(sp)
72 stq a4, 0x20(sp)
73 stq a5, 0x28(sp)
74 jsr ra, (pv), atexit
75 ldq ra, 0x00(sp)
76 ldq a1, 0x08(sp)
77 ldq a2, 0x10(sp)
78 ldq a3, 0x18(sp)
79 ldq a4, 0x20(sp)
80 ldq a5, 0x28(sp)
81
b870eeda 82$leave: ldq pv, 0x30(sp)
8a9cbf0d
RM
83 addq sp, 0x38, sp
84 ret
24c177a0 85
b870eeda 86 .end init