1s390_guarded_storage(2) System Calls Manual s390_guarded_storage(2)
2
3
4
6 s390_guarded_storage - operations with z/Architecture guarded storage
7 facility
8
10 Standard C library (libc, -lc)
11
13 #include <asm/guarded_storage.h> /* Definition of GS_* constants */
14 #include <sys/syscall.h> /* Definition of SYS_* constants */
15 #include <unistd.h>
16
17 int syscall(SYS_s390_guarded_storage, int command,
18 struct gs_cb *gs_cb);
19
20 Note: glibc provides no wrapper for s390_guarded_storage(), necessitat‐
21 ing the use of syscall(2).
22
24 The s390_guarded_storage() system call enables the use of the Guarded
25 Storage Facility (a z/Architecture-specific feature) for user-space
26 processes.
27
28 The guarded storage facility is a hardware feature that allows marking
29 up to 64 memory regions (as of z14) as guarded; reading a pointer with
30 a newly introduced "Load Guarded" (LGG) or "Load Logical and Shift
31 Guarded" (LLGFSG) instructions will cause a range check on the loaded
32 value and invoke a (previously set up) user-space handler if one of the
33 guarded regions is affected.
34
35 The command argument indicates which function to perform. The follow‐
36 ing commands are supported:
37
38 GS_ENABLE
39 Enable the guarded storage facility for the calling task. The
40 initial content of the guarded storage control block will be all
41 zeros. After enablement, user-space code can use the "Load
42 Guarded Storage Controls" (LGSC) instruction (or the
43 load_gs_cb() function wrapper provided in the asm/guarded_stor‐
44 age.h header) to load an arbitrary control block. While a task
45 is enabled, the kernel will save and restore the calling content
46 of the guarded storage registers on context switch.
47
48 GS_DISABLE
49 Disables the use of the guarded storage facility for the calling
50 task. The kernel will cease to save and restore the content of
51 the guarded storage registers, the task-specific content of
52 these registers is lost.
53
54 GS_SET_BC_CB
55 Set a broadcast guarded storage control block to the one pro‐
56 vided in the gs_cb argument. This is called per thread and as‐
57 sociates a specific guarded storage control block with the call‐
58 ing task. This control block will be used in the broadcast com‐
59 mand GS_BROADCAST.
60
61 GS_CLEAR_BC_CB
62 Clears the broadcast guarded storage control block. The guarded
63 storage control block will no longer have the association estab‐
64 lished by the GS_SET_BC_CB command.
65
66 GS_BROADCAST
67 Sends a broadcast to all thread siblings of the calling task.
68 Every sibling that has established a broadcast guarded storage
69 control block will load this control block and will be enabled
70 for guarded storage. The broadcast guarded storage control
71 block is consumed; a second broadcast without a refresh of the
72 stored control block with GS_SET_BC_CB will not have any effect.
73
74 The gs_cb argument specifies the address of a guarded storage control
75 block structure and is currently used only by the GS_SET_BC_CB command;
76 all other aforementioned commands ignore this argument.
77
79 On success, the return value of s390_guarded_storage() is 0.
80
81 On error, -1 is returned, and errno is set to indicate the error.
82
84 EFAULT command was GS_SET_BC_CB and the copying of the guarded storage
85 control block structure pointed by the gs_cb argument has
86 failed.
87
88 EINVAL The value provided in the command argument was not valid.
89
90 ENOMEM command was one of GS_ENABLE or GS_SET_BC_CB, and the allocation
91 of a new guarded storage control block has failed.
92
93 EOPNOTSUPP
94 The guarded storage facility is not supported by the hardware.
95
97 Linux on s390.
98
100 Linux 4.12. System z14.
101
103 The description of the guarded storage facility along with related in‐
104 structions and Guarded Storage Control Block and Guarded Storage Event
105 Parameter List structure layouts is available in "z/Architecture Prin‐
106 ciples of Operations" beginning from the twelfth edition.
107
108 The gs_cb structure has a field gsepla (Guarded Storage Event Parameter
109 List Address), which is a user-space pointer to a Guarded Storage Event
110 Parameter List structure (that contains the address of the aforemen‐
111 tioned event handler in the gseha field), and its layout is available
112 as a gs_epl structure type definition in the asm/guarded_storage.h
113 header.
114
116 syscall(2)
117
118
119
120Linux man-pages 6.04 2023-03-30 s390_guarded_storage(2)