v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
push_registers_asm.cc
Go to the documentation of this file.
1
// Copyright 2020 the V8 project authors. All rights reserved.
2
// Use of this source code is governed by a BSD-style license that can be
3
// found in the LICENSE file.
4
5
// Push all callee-saved registers to get them on the stack for conservative
6
// stack scanning.
7
//
8
// See asm/x64/push_registers_clang.cc for why the function is not generated
9
// using clang.
10
11
// Do not depend on V8_TARGET_OS_* defines as some embedders may override the
12
// GN toolchain (e.g. ChromeOS) and not provide them.
13
14
// PPC ABI source:
15
// http://refspecs.linuxfoundation.org/ELF/ppc64/PPC-elf64abi.html
16
17
// AIX Runtime process stack:
18
// https://www.ibm.com/support/knowledgecenter/ssw_aix_71/assembler/idalangref_runtime_process.html
19
asm
(
20
#if defined(_AIX)
21
".csect .text[PR] \n"
22
".align 2 \n"
23
".globl .PushAllRegistersAndIterateStack, hidden \n"
24
".PushAllRegistersAndIterateStack: \n"
25
#else
26
".text \n"
27
".align 2 \n"
28
".globl PushAllRegistersAndIterateStack \n"
29
".type PushAllRegistersAndIterateStack, %function \n"
30
".hidden PushAllRegistersAndIterateStack \n"
31
"PushAllRegistersAndIterateStack: \n"
32
#endif
33
// Push all callee-saved registers.
34
// lr, TOC pointer, r16 to r31. 160 bytes.
35
// The parameter save area shall be allocated by the caller. 112 bytes.
36
// At anytime, SP (r1) needs to be multiple of 16 (i.e. 16-aligned).
37
" mflr 0 \n"
38
" std 0, 16(1) \n"
39
#if defined(_AIX)
40
" std 2, 40(1) \n"
41
#else
42
" std 2, 24(1) \n"
43
#endif
44
" stdu 1, -256(1) \n"
45
" std 14, 112(1) \n"
46
" std 15, 120(1) \n"
47
" std 16, 128(1) \n"
48
" std 17, 136(1) \n"
49
" std 18, 144(1) \n"
50
" std 19, 152(1) \n"
51
" std 20, 160(1) \n"
52
" std 21, 168(1) \n"
53
" std 22, 176(1) \n"
54
" std 23, 184(1) \n"
55
" std 24, 192(1) \n"
56
" std 25, 200(1) \n"
57
" std 26, 208(1) \n"
58
" std 27, 216(1) \n"
59
" std 28, 224(1) \n"
60
" std 29, 232(1) \n"
61
" std 30, 240(1) \n"
62
" std 31, 248(1) \n"
63
// Pass 1st parameter (r3) unchanged (Stack*).
64
// Pass 2nd parameter (r4) unchanged (StackVisitor*).
65
// Save 3rd parameter (r5; IterateStackCallback).
66
" mr 6, 5 \n"
67
#if defined(_AIX)
68
// Set up TOC for callee.
69
" ld 2,8(5) \n"
70
// AIX uses function descriptors, which means that
71
// pointers to functions do not point to code, but
72
// instead point to metadata about them, hence
73
// need to deterrence.
74
" ld 6,0(6) \n"
75
#endif
76
// Pass 3rd parameter as sp (stack pointer).
77
" mr 5, 1 \n"
78
#if !defined(_AIX)
79
// Set up r12 to be equal to the callee address (in order for TOC
80
// relocation). Only needed on LE Linux.
81
" mr 12, 6 \n"
82
#endif
83
// Call the callback.
84
" mtctr 6 \n"
85
" bctrl \n"
86
// Discard all the registers.
87
" addi 1, 1, 256 \n"
88
// Restore lr.
89
" ld 0, 16(1) \n"
90
" mtlr 0 \n"
91
#if defined(_AIX)
92
// Restore TOC pointer.
93
" ld 2, 40(1) \n"
94
#else
95
" ld 2, 24(1) \n"
96
#endif
97
" blr \n"
);
src
heap
base
asm
ppc
push_registers_asm.cc
Generated on Sun Apr 6 2025 21:08:54 for v8 by
1.12.0