1 .\" Copyright (C) 2018 Eugene Syromyatnikov <evgsyr@gmail.com>
3 .\" %%%LICENSE_START(VERBATIM)
4 .\" Permission is granted to make and distribute verbatim copies of this
5 .\" manual provided the copyright notice and this permission notice are
6 .\" preserved on all copies.
8 .\" Permission is granted to copy and distribute modified versions of this
9 .\" manual under the conditions for verbatim copying, provided that the
10 .\" entire resulting derived work is distributed under the terms of a
11 .\" permission notice identical to this one.
13 .\" Since the Linux kernel and libraries are constantly changing, this
14 .\" manual page may be incorrect or out-of-date. The author(s) assume no
15 .\" responsibility for errors or omissions, or for damages resulting from
16 .\" the use of the information contained herein. The author(s) may not
17 .\" have taken the same level of care in the production of this manual,
18 .\" which is licensed free of charge, as they might when working
21 .\" Formatted or processed versions of this manual, if unaccompanied by
22 .\" the source, must acknowledge the copyright and authors of this work.
25 .TH S390_GUARDED_STORAGE 2 2019-03-06 "Linux Programmer's Manual"
27 s390_guarded_storage \- operations with z/Architecture guarded storage facility
30 .B #include <asm/guarded_storage.h>
32 .BI "int s390_guarded_storage(int " command ", struct gs_cb *" gs_cb ");"
36 .BR s390_guarded_storage ()
37 system call enables the use of the Guarded Storage Facility
38 (a z/Architecture-specific feature) for user-space processes.
40 .\" The description is based on
41 .\" http://www-05.ibm.com/de/linux-on-z-ws-us/agenda/pdfs/8_-_Linux_Whats_New_-_Stefan_Raspl.pdf
42 .\" and "z/Architecture Principles of Operation" obtained from
43 .\" http://publibfi.boulder.ibm.com/epubs/pdf/dz9zr011.pdf
44 The guarded storage facility is a hardware feature that allows marking up to
45 64 memory regions (as of z14) as guarded;
46 reading a pointer with a newly introduced "Load Guarded" (LGG)
47 or "Load Logical and Shift Guarded" (LLGFSG) instructions will cause
48 a range check on the loaded value and invoke a (previously set up)
49 user-space handler if one of the guarded regions is affected.
52 .\" The command description is copied from v4.12-rc1~139^2~56^2 commit message
54 argument indicates which function to perform.
55 The following commands are supported:
58 Enable the guarded storage facility for the calling task.
59 The initial content of the guarded storage control block will be all zeros.
60 After enablement, user-space code can use the "Load Guarded Storage
61 Controls" (LGSC) instruction (or the
63 function wrapper provided in the
64 .I asm/guarded_storage.h
65 header) to load an arbitrary control block.
66 While a task is enabled, the kernel will save and restore the calling content
67 of the guarded storage registers on context switch.
70 Disables the use of the guarded storage facility for the calling task.
71 The kernel will cease to save and restore the content of the guarded storage
72 registers, the task-specific content of these registers is lost.
75 Set a broadcast guarded storage control block to the one provided in the
78 This is called per thread and associates a specific guarded storage control
79 block with the calling task.
80 This control block will be used in the broadcast command
84 Clears the broadcast guarded storage control block.
85 The guarded storage control block will no longer have the association
91 Sends a broadcast to all thread siblings of the calling task.
92 Every sibling that has established a broadcast guarded storage control block
93 will load this control block and will be enabled for guarded storage.
94 The broadcast guarded storage control block is consumed; a second broadcast
95 without a refresh of the stored control block with
97 will not have any effect.
101 argument specifies the address of a guarded storage control block structure
102 and is currently used only by the
104 command; all other aforementioned commands ignore this argument.
106 On success, the return value of
107 .BR s390_guarded_storage ()
110 On error, \-1 is returned, and
112 is set appropriately.
119 and the copying of the guarded storage control block structure pointed by the
124 The value provided in the
126 argument was not valid.
131 .BR GS_ENABLE " or " GS_SET_BC_CB ,
132 and the allocation of a new guarded storage control block has failed.
135 The guarded storage facility is not supported by the hardware.
137 .\" 916cda1aa1b412d7cf2991c3af7479544942d121, v4.12-rc1~139^2~56^2
138 This system call is available since Linux 4.12.
140 This Linux-specific system call is available only on the s390 architecture.
142 The guarded storage facility is available beginning with System z14.
144 Glibc does not provide a wrapper for this system call, use
148 The description of the guarded storage facility along with related
149 instructions and Guarded Storage Control Block and
150 Guarded Storage Event Parameter List structure layouts
151 is available in "z/Architecture Principles of Operations"
152 beginning from the twelfth edition.
156 structure has a field
158 (Guarded Storage Event Parameter List Address), which is a user-space pointer
159 to a Guarded Storage Event Parameter List structure
160 (that contains the address
161 of the aforementioned event handler in the
163 field), and its layout is available as a
165 structure type definition in the
166 .I asm/guarded_storage.h
169 .\" For the example of using the guarded storage facility, see
170 .\" .UR https://developer.ibm.com/javasdk/2017/09/25/concurrent-scavenge-using-guarded-storage-facility-works/
171 .\" the article with the description of its usage in the Java Garbage Collection