1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
|
* zvslist.s -- ask VSM what is allocated in one common area.
*
* VSMLIST has no C entry point and is a macro, so this is the only part
* of the project that has to be assembler. Called from C as
* zvslist(&req) with plain OS linkage: R1 points at a one-word list
* holding the address of the request block.
*
* struct zreq { int area; unsigned len; void *wk; int rc;
* void *self; unsigned long long save[18]; int space; }
*
* area 1 CSA, 2 SQA, 3 LSQA, 4 private; space 1 FREE (allocated storage
* and the free space inside it), 2 UNALLOC (holes in CSA or the private
* area); len is the work area length; rc receives the service's own
* return code (0 complete, 4 "did not fit, ask again", else an error).
*
* Returns 0 if the service was called, -1 for an unknown area.
*
* The save area lives in the caller's block (offset 24) rather than in
* this CSECT: in an XPLINK load module an assembler CSECT is read-only,
* and the first store into it takes a 0C4. Only the base register and
* the literal pool stay here, and both are read-only.
*
* No address constant is loaded into the base register: in an XPLINK
* load module the binder turns =A(zvslist) into a function descriptor
* and the loader fills it with an address that is not this CSECT, so
* every literal and branch went to the wrong place. BALR alone sets a
* base the assembler can use.
*
* VSMLIST writes its control block into the first 32 bytes of the work
* area and needs the register operand in doubled parentheses: with
* WKAREA=((4),5) the macro generates "LA 15,5" and stores the length
* at address 12, but with WKAREA=((4),(5)) it stores R5.
*
* The return code at work+0 is the service's own state: it must be zero
* before the first call, and left alone for the continuation calls.
* The C side clears it once, before the loop; the stub must not.
*
* The offsets below are shared with src/ztop.c and checked there.
SYSSTATE AMODE64=NO,ARCHLVL=2,OSREL=ZOSV1R6
zvslist CSECT
zvslist AMODE 31
zvslist RMODE 24
STM 14,12,12(13)
BALR 12,0
USING *,12
L 2,0(1) R2 -> struct zreq
LR 11,2 R11 keeps it: services keep R11
LA 10,24(,2) our save area, in that block
ST 13,4(,10) chain it to the caller's first
ST 10,8(,13)
LR 13,10
ST 2,16(,2) self, for the caller's information
L 3,0(2) area
L 5,4(2) work area length
L 4,8(2) work area address
L 6,168(2) space: 1 FREE, 2 UNALLOC
LHI 15,-1
ST 15,12(2) unknown area until proven
CHI 3,1 the area codes are small
BE CSA
CHI 3,2
BE SQA
CHI 3,3
BE LSQA
CHI 3,4
BE PVT
B OUT
CSA CHI 6,1
BE CSAF
CHI 6,2
BE CSAU
CSAF VSMLIST SP=CSA,SPACE=FREE,WKAREA=((4),(5))
B DONE
CSAU VSMLIST SP=CSA,SPACE=UNALLOC,WKAREA=((4),(5))
B DONE
SQA VSMLIST SP=SQA,SPACE=FREE,WKAREA=((4),(5))
B DONE
LSQA VSMLIST SP=LSQA,SPACE=FREE,WKAREA=((4),(5))
B DONE
PVT CHI 6,1
BE PVTF
CHI 6,2
BE PVTU
PVTF VSMLIST SP=PVT,SPACE=FREE,WKAREA=((4),(5))
B DONE
PVTU VSMLIST SP=PVT,SPACE=UNALLOC,WKAREA=((4),(5))
DONE LR 2,11 the struct, kept in R11
L 4,8(2) work area
L 15,0(4) service return code
ST 15,12(2)
SR 15,15
OUT L 13,4(,13) back to the caller's save area
LM 14,12,12(13)
BR 14
LTORG
END
|