Rizin
unix-like reverse engineering framework and cli tools
linux-s390x.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: 2020 pancake <pancake@nopcode.org>
2 // SPDX-License-Identifier: LGPL-3.0-only
3 
4 #if 0
5 
6 https://www.kernel.org/doc/Documentation/s390/Debugging390.txt
7 
8 s/390 & z/Architecture Register usage
9 =====================================
10 r0 used by syscalls/assembly call-clobbered
11 r1 used by syscalls/assembly call-clobbered
12 r2 argument 0 / return value 0 call-clobbered
13 r3 argument 1 / return value 1 (if long long) call-clobbered
14 r4 argument 2 call-clobbered
15 r5 argument 3 call-clobbered
16 r6 argument 4 saved
17 r7 pointer-to arguments 5 to ... saved
18 r8 this & that saved
19 r9 this & that saved
20 r10 static-chain ( if nested function ) saved
21 r11 frame-pointer ( if function used alloca ) saved
22 r12 got-pointer saved
23 r13 base-pointer saved
24 r14 return-address saved
25 r15 stack-pointer saved
26 $pc
27 $sp
28 
29 f0 argument 0 / return value ( float/double ) call-clobbered
30 f2 argument 1 call-clobbered
31 f4 z/Architecture argument 2 saved
32 f6 z/Architecture argument 3 saved
33 The remaining floating points
34 f1,f3,f5 f7-f15 are call-clobbered.
35 
36 
37 The current architectures have the following registers.
38 
39 16 General propose registers, 32 bit on s/390 and 64 bit on z/Architecture,
40 r0-r15 (or gpr0-gpr15), used for arithmetic and addressing.
41 
42 16 Control registers, 32 bit on s/390 and 64 bit on z/Architecture, cr0-cr15,
43 kernel usage only, used for memory management, interrupt control, debugging
44 control etc.
45 
46 16 Access registers (ar0-ar15), 32 bit on both s/390 and z/Architecture,
47 normally not used by normal programs but potentially could be used as
48 temporary storage. These registers have a 1:1 association with general
49 purpose registers and are designed to be used in the so-called access
50 register mode to select different address spaces.
51 Access register 0 (and access register 1 on z/Architecture, which needs a
52 64 bit pointer) is currently used by the pthread library as a pointer to
53 the current running threads private area.
54 
55 16 64 bit floating point registers (fp0-fp15 ) IEEE & HFP floating
56 point format compliant on G5 upwards & a Floating point control reg (FPC)
57 4 64 bit registers (fp0,fp2,fp4 & fp6) HFP only on older machines.
58 Note:
59 Linux (currently) always uses IEEE & emulates G5 IEEE format on older machines,
60 ( provided the kernel is configured for this ).
61 #endif
62 
63 return strdup(
64  "=PC pc\n"
65  "=LR r14\n"
66  "=SP r15\n"
67  "=BP r13\n"
68  "=R0 r2\n"
69  "=A0 r2\n"
70  "=A1 r3\n"
71  "=A2 r4\n"
72  "=A3 r5\n"
73  "=SN r0\n"
74  "gpr r0 .32 0 0\n"
75  "gpr r1 .32 4 0\n"
76  "gpr r2 .32 8 0\n"
77  "gpr r3 .32 12 0\n"
78  "gpr r4 .32 16 0\n"
79  "gpr r5 .32 20 0\n"
80  "gpr r6 .32 24 0\n"
81  "gpr r7 .32 28 0\n"
82  "gpr r8 .32 32 0\n"
83  "gpr r9 .32 36 0\n"
84  "gpr r10 .32 40 0\n"
85  "gpr r11 .32 44 0\n"
86  "gpr r12 .32 48 0\n"
87  "gpr r13 .32 52 0\n"
88  "gpr r14 .32 56 0\n"
89  "gpr r15 .32 60 0\n"
90  "gpr pc .32 64 0\n"
91  // kernel only
92  "gpr cr0 .32 68 0\n"
93  "gpr cr1 .32 72 0\n"
94  "gpr cr2 .32 76 0\n"
95  "gpr cr3 .32 80 0\n"
96  "gpr cr4 .32 84 0\n"
97  "gpr cr5 .32 88 0\n"
98  "gpr cr6 .32 92 0\n"
99  "gpr cr7 .32 96 0\n"
100  "gpr cr8 .32 100 0\n"
101  "gpr cr9 .32 104 0\n"
102  "gpr cr10 .32 108 0\n"
103  "gpr cr11 .32 112 0\n"
104  "gpr cr12 .32 116 0\n"
105  "gpr cr13 .32 120 0\n"
106  "gpr cr14 .32 124 0\n"
107  "gpr cr15 .32 128 0\n"
108  // used for tls cache, used for threading
109  "gpr ar0 .32 132 0\n"
110  "gpr ar1 .32 136 0\n"
111  "gpr ar2 .32 140 0\n"
112  "gpr ar3 .32 144 0\n"
113  "gpr ar4 .32 148 0\n"
114  "gpr ar5 .32 152 0\n"
115  "gpr ar6 .32 156 0\n"
116  "gpr ar7 .32 160 0\n"
117  "gpr ar8 .32 164 0\n"
118  "gpr ar9 .32 170 0\n"
119  "gpr ar10 .32 174 0\n"
120  "gpr ar11 .32 178 0\n"
121  "gpr ar12 .32 182 0\n"
122  "gpr ar13 .32 186 0\n"
123  "gpr ar14 .32 190 0\n"
124  "gpr ar15 .32 194 0\n"
125 
126 );
r3
Definition: arm-aliases.s.cs:3
r2
Definition: arm-aliases.s.cs:2
static ut32 arithmetic(ArmOp *op, int k)
Definition: armass64.c:933
enum register_t Register
int call(int a, int b)
Definition: bcj_test.c:25
const lzma_allocator const uint8_t * in
Definition: block.h:527
static int value
Definition: cmd_api.c:93
void usage(const char *message)
char * alloca()
RzCryptoSelector bit
Definition: crypto.c:16
static static sync static getppid static getegid const char static filename char static len const char char static bufsiz static mask static vfork const void static prot static getpgrp const char static swapflags static arg static fd static protocol which
Definition: sflib.h:79
static static sync static getppid static getegid const char static filename char static len const char char static bufsiz static mask static vfork const void static prot static getpgrp const char static swapflags long
Definition: sflib.h:79
f5
const char int mode
Definition: ioapi.h:137
#define reg(n)
const char * spaces(int count)
static static fork const void static count static fd const char const char static newpath char char char static envp time_t static t const char static mode static whence const char static dir time_t static t unsigned static seconds const char struct utimbuf static buf static inc static sig const char static mode static oldfd struct tms static buf static getgid static geteuid const char static filename static arg static mask struct ustat static ubuf static getppid static setsid static egid sigset_t static set struct timeval struct timezone static tz select
Definition: sflib.h:108
return strdup("=PC pc\n" "=LR r14\n" "=SP r15\n" "=BP r13\n" "=R0 r2\n" "=A0 r2\n" "=A1 r3\n" "=A2 r4\n" "=A3 r5\n" "=SN r0\n" "gpr r0 .32 0 0\n" "gpr r1 .32 4 0\n" "gpr r2 .32 8 0\n" "gpr r3 .32 12 0\n" "gpr r4 .32 16 0\n" "gpr r5 .32 20 0\n" "gpr r6 .32 24 0\n" "gpr r7 .32 28 0\n" "gpr r8 .32 32 0\n" "gpr r9 .32 36 0\n" "gpr r10 .32 40 0\n" "gpr r11 .32 44 0\n" "gpr r12 .32 48 0\n" "gpr r13 .32 52 0\n" "gpr r14 .32 56 0\n" "gpr r15 .32 60 0\n" "gpr pc .32 64 0\n" "gpr cr0 .32 68 0\n" "gpr cr1 .32 72 0\n" "gpr cr2 .32 76 0\n" "gpr cr3 .32 80 0\n" "gpr cr4 .32 84 0\n" "gpr cr5 .32 88 0\n" "gpr cr6 .32 92 0\n" "gpr cr7 .32 96 0\n" "gpr cr8 .32 100 0\n" "gpr cr9 .32 104 0\n" "gpr cr10 .32 108 0\n" "gpr cr11 .32 112 0\n" "gpr cr12 .32 116 0\n" "gpr cr13 .32 120 0\n" "gpr cr14 .32 124 0\n" "gpr cr15 .32 128 0\n" "gpr ar0 .32 132 0\n" "gpr ar1 .32 136 0\n" "gpr ar2 .32 140 0\n" "gpr ar3 .32 144 0\n" "gpr ar4 .32 148 0\n" "gpr ar5 .32 152 0\n" "gpr ar6 .32 156 0\n" "gpr ar7 .32 160 0\n" "gpr ar8 .32 164 0\n" "gpr ar9 .32 170 0\n" "gpr ar10 .32 174 0\n" "gpr ar11 .32 178 0\n" "gpr ar12 .32 182 0\n" "gpr ar13 .32 186 0\n" "gpr ar14 .32 190 0\n" "gpr ar15 .32 194 0\n")
static static fork const void static count static fd const char static mode const char static pathname const char static path const char static dev const char static group static getpid static getuid void void static data static pause access
Definition: sflib.h:64
r13
Definition: regs-good.s.cs:8
f7
Definition: regs-good.s.cs:29
static RzSocket * s
Definition: rtr.c:28
static struct sockaddr static addrlen static backlog const void static flags void struct sockaddr socklen_t static fromlen const void const struct sockaddr to
Definition: sfsocketcall.h:125
#define a(i)
Definition: sha256.c:41
Definition: zran.c:68
Definition: z80asm.h:140
static uv_thread_t * threads
Definition: threadpool.c:38
control