-
Notifications
You must be signed in to change notification settings - Fork 429
Expand file tree
/
Copy pathomriarv64.c
More file actions
561 lines (478 loc) · 19.1 KB
/
Copy pathomriarv64.c
File metadata and controls
561 lines (478 loc) · 19.1 KB
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
/*******************************************************************************
* Copyright IBM Corp. and others 1991
*
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which accompanies this
* distribution and is available at https://www.eclipse.org/legal/epl-2.0/
* or the Apache License, Version 2.0 which accompanies this distribution and
* is available at https://www.apache.org/licenses/LICENSE-2.0.
*
* This Source Code may also be made available under the following
* Secondary Licenses when the conditions for such availability set
* forth in the Eclipse Public License, v. 2.0 are satisfied: GNU
* General Public License, version 2 with the GNU Classpath
* Exception [1] and GNU General Public License, version 2 with the
* OpenJDK Assembly Exception [2].
*
* [1] https://www.gnu.org/software/classpath/license.html
* [2] https://openjdk.org/legal/assembly-exception.html
*
* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 OR GPL-2.0-only WITH OpenJDK-assembly-exception-1.0
*******************************************************************************/
/*
* This file is used to generate the HLASM corresponding to the C calls
* that use the IARV64 macro in omrvmem.c
*
* This file is compiled manually using the METAL-C compiler that was
* introduced in z/OS V1R9. The generated output (omriarv64.s) is then
* inserted into omrvmem_support_above_bar.s which is compiled by our makefiles.
*
* omrvmem_support_above_bar.s indicates where to put the contents of omriarv64.s.
* Search for:
* Insert contents of omriarv64.s below
*
* *******
* NOTE!!!!! You must strip the line numbers from any pragma statements!
* *******
*
* It should be obvious, however, just to be clear be sure to omit the
* first two lines from omriarv64.s which will look something like:
*
* TITLE '5694A01 V1.9 z/OS XL C
* ./omriarv64.c'
*
* To compile:
* xlc -S -qmetal -Wc,lp64 -qlongname omriarv64.c
*
* z/OS V1R9 z/OS V1R9.0 Metal C Programming Guide and Reference:
* http://publibz.boulder.ibm.com/epubs/pdf/ccrug100.pdf
*/
#include "omriarv64.h"
#pragma prolog(omrallocate_1M_fixed_pages,"MYPROLOG")
#pragma epilog(omrallocate_1M_fixed_pages,"MYEPILOG")
__asm(" IARV64 PLISTVER=MAX,MF=(L,LGETSTOR)":"DS"(lgetstor));
/*
* Allocate 1MB fixed pages using IARV64 system macro.
* Memory allocated is freed using omrfree_memory_above_bar().
*
* @params[in] numMBSegments Number of 1MB segments to be allocated
* @params[in] userExtendedPrivateAreaMemoryType capability of OS: 0 - general, 1 - 2G-32G range, 2 - 2G-64G range
*
* @return pointer to memory allocated, NULL on failure.
*/
void * omrallocate_1M_fixed_pages(int *numMBSegments, int *userExtendedPrivateAreaMemoryType, const char * ttkn) {
long segments;
long origin;
long useMemoryType = *userExtendedPrivateAreaMemoryType;
int iarv64_rc = 0;
__asm(" IARV64 PLISTVER=MAX,MF=(L,LGETSTOR)":"DS"(wgetstor));
segments = *numMBSegments;
wgetstor = lgetstor;
switch (useMemoryType) {
case ZOS64_VMEM_ABOVE_BAR_GENERAL:
__asm(" IARV64 REQUEST=GETSTOR,COND=YES,SADMP=NO,CONTROL=UNAUTH,PAGEFRAMESIZE=1MEG,"\
"SEGMENTS=(%2),ORIGIN=(%1),TTOKEN=(%4),RETCODE=%0,MF=(E,(%3))"\
::"m"(iarv64_rc),"r"(&origin),"r"(&segments),"r"(&wgetstor),"r"(ttkn));
break;
case ZOS64_VMEM_2_TO_32G:
__asm(" IARV64 REQUEST=GETSTOR,COND=YES,SADMP=NO,USE2GTO32G=YES,"\
"CONTROL=UNAUTH,PAGEFRAMESIZE=1MEG,"\
"SEGMENTS=(%2),ORIGIN=(%1),TTOKEN=(%4),RETCODE=%0,MF=(E,(%3))"\
::"m"(iarv64_rc),"r"(&origin),"r"(&segments),"r"(&wgetstor),"r"(ttkn));
break;
case ZOS64_VMEM_2_TO_64G:
__asm(" IARV64 REQUEST=GETSTOR,COND=YES,SADMP=NO,USE2GTO64G=YES,"\
"CONTROL=UNAUTH,PAGEFRAMESIZE=1MEG,"\
"SEGMENTS=(%2),ORIGIN=(%1),TTOKEN=(%4),RETCODE=%0,MF=(E,(%3))"\
::"m"(iarv64_rc),"r"(&origin),"r"(&segments),"r"(&wgetstor),"r"(ttkn));
break;
}
if (0 != iarv64_rc) {
return (void *)0;
}
return (void *)origin;
}
#pragma prolog(omrallocate_1M_pageable_pages_above_bar,"MYPROLOG")
#pragma epilog(omrallocate_1M_pageable_pages_above_bar,"MYEPILOG")
__asm(" IARV64 PLISTVER=MAX,MF=(L,NGETSTOR)":"DS"(ngetstor));
/*
* Allocate 1MB pageable pages above 2GB bar using IARV64 system macro.
* Memory allocated is freed using omrfree_memory_above_bar().
*
* @params[in] numMBSegments Number of 1MB segments to be allocated
* @params[in] userExtendedPrivateAreaMemoryType capability of OS: 0 - general, 1 - 2G-32G range, 2 - 2G-64G range
*
* @return pointer to memory allocated, NULL on failure.
*/
void * omrallocate_1M_pageable_pages_above_bar(int *numMBSegments, int *userExtendedPrivateAreaMemoryType, const char * ttkn) {
long segments;
long origin;
long useMemoryType = *userExtendedPrivateAreaMemoryType;
int iarv64_rc = 0;
__asm(" IARV64 PLISTVER=MAX,MF=(L,NGETSTOR)":"DS"(wgetstor));
segments = *numMBSegments;
wgetstor = ngetstor;
switch (useMemoryType) {
case ZOS64_VMEM_ABOVE_BAR_GENERAL:
__asm(" IARV64 REQUEST=GETSTOR,COND=YES,SADMP=NO,CONTROL=UNAUTH,"\
"PAGEFRAMESIZE=PAGEABLE1MEG,TYPE=PAGEABLE,SEGMENTS=(%2),"\
"ORIGIN=(%1),TTOKEN=(%4),RETCODE=%0,MF=(E,(%3))"\
::"m"(iarv64_rc),"r"(&origin),"r"(&segments),"r"(&wgetstor),"r"(ttkn));
break;
case ZOS64_VMEM_2_TO_32G:
__asm(" IARV64 REQUEST=GETSTOR,COND=YES,SADMP=NO,CONTROL=UNAUTH,USE2GTO32G=YES,"\
"PAGEFRAMESIZE=PAGEABLE1MEG,TYPE=PAGEABLE,SEGMENTS=(%2),"\
"ORIGIN=(%1),TTOKEN=(%4),RETCODE=%0,MF=(E,(%3))"\
::"m"(iarv64_rc),"r"(&origin),"r"(&segments),"r"(&wgetstor),"r"(ttkn));
break;
case ZOS64_VMEM_2_TO_64G:
__asm(" IARV64 REQUEST=GETSTOR,COND=YES,SADMP=NO,CONTROL=UNAUTH,USE2GTO64G=YES,"\
"PAGEFRAMESIZE=PAGEABLE1MEG,TYPE=PAGEABLE,SEGMENTS=(%2),"\
"ORIGIN=(%1),TTOKEN=(%4),RETCODE=%0,MF=(E,(%3))"\
::"m"(iarv64_rc),"r"(&origin),"r"(&segments),"r"(&wgetstor),"r"(ttkn));
break;
}
if (0 != iarv64_rc) {
return (void *)0;
}
return (void *)origin;
}
#pragma prolog(omrallocate_1M_pageable_pages_guarded_above_bar,"MYPROLOG")
#pragma epilog(omrallocate_1M_pageable_pages_guarded_above_bar,"MYEPILOG")
__asm(" IARV64 PLISTVER=MAX,MF=(L,SGETSTOR)":"DS"(sgetstor));
/*
* Allocate 1MB pageable guarded pages above 2GB bar using IARV64 system macro.
* Memory allocated is freed using omrfree_memory_above_bar().
*
* @params[in] numMBSegments Number of 1MB segments to be allocated
* @params[in] userExtendedPrivateAreaMemoryType capability of OS: 0 - general, 1 - 2G-32G range, 2 - 2G-64G range
*
* @return pointer to memory allocated, NULL on failure.
*/
void *omrallocate_1M_pageable_pages_guarded_above_bar(int *numMBSegments, int *userExtendedPrivateAreaMemoryType, const char *ttkn) {
long segments;
long origin;
long useMemoryType = *userExtendedPrivateAreaMemoryType;
int iarv64_rc = 0;
__asm(" IARV64 PLISTVER=MAX,MF=(L,SGETSTOR)":"DS"(wgetstor));
segments = *numMBSegments;
wgetstor = ngetstor;
switch (useMemoryType) {
case ZOS64_VMEM_ABOVE_BAR_GENERAL:
__asm(" IARV64 REQUEST=GETSTOR,COND=YES,SADMP=NO,CONTROL=UNAUTH,"\
"GUARDSIZE64=(%2),"\
"PAGEFRAMESIZE=PAGEABLE1MEG,TYPE=PAGEABLE,SEGMENTS=(%2),"\
"ORIGIN=(%1),TTOKEN=(%4),RETCODE=%0,MF=(E,(%3))"\
::"m"(iarv64_rc),"r"(&origin),"r"(&segments),"r"(&wgetstor),"r"(ttkn));
break;
case ZOS64_VMEM_2_TO_32G:
__asm(" IARV64 REQUEST=GETSTOR,COND=YES,SADMP=NO,CONTROL=UNAUTH,USE2GTO32G=YES,"\
"GUARDSIZE64=(%2),"\
"PAGEFRAMESIZE=PAGEABLE1MEG,TYPE=PAGEABLE,SEGMENTS=(%2),"\
"ORIGIN=(%1),TTOKEN=(%4),RETCODE=%0,MF=(E,(%3))"\
::"m"(iarv64_rc),"r"(&origin),"r"(&segments),"r"(&wgetstor),"r"(ttkn));
break;
case ZOS64_VMEM_2_TO_64G:
__asm(" IARV64 REQUEST=GETSTOR,COND=YES,SADMP=NO,CONTROL=UNAUTH,USE2GTO64G=YES,"\
"GUARDSIZE64=(%2),"\
"PAGEFRAMESIZE=PAGEABLE1MEG,TYPE=PAGEABLE,SEGMENTS=(%2),"\
"ORIGIN=(%1),TTOKEN=(%4),RETCODE=%0,MF=(E,(%3))"\
::"m"(iarv64_rc),"r"(&origin),"r"(&segments),"r"(&wgetstor),"r"(ttkn));
break;
}
if (0 != iarv64_rc) {
return (void *)0;
}
return (void *)origin;
}
#pragma prolog(omrallocate_2G_pages,"MYPROLOG")
#pragma epilog(omrallocate_2G_pages,"MYEPILOG")
__asm(" IARV64 PLISTVER=MAX,MF=(L,OGETSTOR)":"DS"(ogetstor));
/*
* Allocate 2GB fixed pages using IARV64 system macro.
* Memory allocated is freed using omrfree_memory_above_bar().
*
* @params[in] num2GBUnits Number of 2GB units to be allocated
* @params[in] userExtendedPrivateAreaMemoryType capability of OS: 0 - general, 1 - 2G-32G range, 2 - 2G-64G range
*
* @return pointer to memory allocated, NULL on failure.
*/
void * omrallocate_2G_pages(int *num2GBUnits, int *userExtendedPrivateAreaMemoryType, const char * ttkn) {
long units;
long origin;
long useMemoryType = *userExtendedPrivateAreaMemoryType;
int iarv64_rc = 0;
__asm(" IARV64 PLISTVER=MAX,MF=(L,OGETSTOR)":"DS"(wgetstor));
units = *num2GBUnits;
wgetstor = ogetstor;
switch (useMemoryType) {
case ZOS64_VMEM_ABOVE_BAR_GENERAL:
__asm(" IARV64 REQUEST=GETSTOR,COND=YES,SADMP=NO,CONTROL=UNAUTH,"\
"PAGEFRAMESIZE=2G,TYPE=FIXED,UNITSIZE=2G,UNITS=(%2),"\
"ORIGIN=(%1),TTOKEN=(%4),RETCODE=%0,MF=(E,(%3))"\
::"m"(iarv64_rc),"r"(&origin),"r"(&units),"r"(&wgetstor),"r"(ttkn));
break;
case ZOS64_VMEM_2_TO_32G:
__asm(" IARV64 REQUEST=GETSTOR,COND=YES,SADMP=NO,CONTROL=UNAUTH,USE2GTO32G=YES,"\
"PAGEFRAMESIZE=2G,TYPE=FIXED,UNITSIZE=2G,UNITS=(%2),"\
"ORIGIN=(%1),TTOKEN=(%4),RETCODE=%0,MF=(E,(%3))"\
::"m"(iarv64_rc),"r"(&origin),"r"(&units),"r"(&wgetstor),"r"(ttkn));
break;
case ZOS64_VMEM_2_TO_64G:
__asm(" IARV64 REQUEST=GETSTOR,COND=YES,SADMP=NO,CONTROL=UNAUTH,USE2GTO64G=YES,"\
"PAGEFRAMESIZE=2G,TYPE=FIXED,UNITSIZE=2G,UNITS=(%2),"\
"ORIGIN=(%1),TTOKEN=(%4),RETCODE=%0,MF=(E,(%3))"\
::"m"(iarv64_rc),"r"(&origin),"r"(&units),"r"(&wgetstor),"r"(ttkn));
break;
}
if (0 != iarv64_rc) {
return (void *)0;
}
return (void *)origin;
}
#pragma prolog(omrallocate_4K_pages_in_userExtendedPrivateArea,"MYPROLOG")
#pragma epilog(omrallocate_4K_pages_in_userExtendedPrivateArea,"MYEPILOG")
__asm(" IARV64 PLISTVER=MAX,MF=(L,MGETSTOR)":"DS"(mgetstor));
/*
* Allocate 4KB pages above 2GB bar using IARV64 system macro.
* Memory allocated is freed using omrfree_memory_above_bar().
*
* @params[in] numMBSegments Number of 1MB segments to be allocated
* @params[in] userExtendedPrivateAreaMemoryType capability of OS: 0 - general, 1 - 2G-32G range, 2 - 2G-64G range
*
* @return pointer to memory allocated, NULL on failure.
*/
void * omrallocate_4K_pages_in_userExtendedPrivateArea(int *numMBSegments, int *userExtendedPrivateAreaMemoryType, const char * ttkn) {
long segments;
long origin;
long useMemoryType = *userExtendedPrivateAreaMemoryType;
int iarv64_rc = 0;
__asm(" IARV64 PLISTVER=MAX,MF=(L,MGETSTOR)":"DS"(wgetstor));
segments = *numMBSegments;
wgetstor = mgetstor;
switch (useMemoryType) {
case ZOS64_VMEM_ABOVE_BAR_GENERAL:
break;
case ZOS64_VMEM_2_TO_32G:
__asm(" IARV64 REQUEST=GETSTOR,COND=YES,SADMP=NO,USE2GTO32G=YES,"\
"CONTROL=UNAUTH,PAGEFRAMESIZE=4K,"\
"SEGMENTS=(%2),ORIGIN=(%1),TTOKEN=(%4),RETCODE=%0,MF=(E,(%3))"\
::"m"(iarv64_rc),"r"(&origin),"r"(&segments),"r"(&wgetstor),"r"(ttkn));
break;
case ZOS64_VMEM_2_TO_64G:
__asm(" IARV64 REQUEST=GETSTOR,COND=YES,SADMP=NO,USE2GTO64G=YES,"\
"CONTROL=UNAUTH,PAGEFRAMESIZE=4K,"\
"SEGMENTS=(%2),ORIGIN=(%1),TTOKEN=(%4),RETCODE=%0,MF=(E,(%3))"\
::"m"(iarv64_rc),"r"(&origin),"r"(&segments),"r"(&wgetstor),"r"(ttkn));
break;
}
if (0 != iarv64_rc) {
return (void *)0;
}
return (void *)origin;
}
#pragma prolog(omrallocate_4K_pages_guarded_in_userExtendedPrivateArea,"MYPROLOG")
#pragma epilog(omrallocate_4K_pages_guarded_in_userExtendedPrivateArea,"MYEPILOG")
__asm(" IARV64 PLISTVER=MAX,MF=(L,TGETSTOR)":"DS"(tgetstor));
/*
* Allocate 4KB pages guarded above 2G bar using IARV64 system macro.
* Memory allocated is freed using omrfree_memory_above_bar().
*
* @params[in] numMBSegments Number of 1MB segments to be allocated
* @params[in] userExtendedPrivateAreaMemoryType capability of OS: 0 - general, 1 - 2G-32G range, 2 - 2G-64G range
*
* @return pointer to memory allocated, NULL on failure.
*/
void *omrallocate_4K_pages_guarded_in_userExtendedPrivateArea(int *numMBSegments, int *userExtendedPrivateAreaMemoryType, const char *ttkn) {
long segments;
long origin;
long useMemoryType = *userExtendedPrivateAreaMemoryType;
int iarv64_rc = 0;
__asm(" IARV64 PLISTVER=MAX,MF=(L,TGETSTOR)":"DS"(wgetstor));
segments = *numMBSegments;
wgetstor = tgetstor;
switch (useMemoryType) {
case ZOS64_VMEM_ABOVE_BAR_GENERAL:
break;
case ZOS64_VMEM_2_TO_32G:
__asm(" IARV64 REQUEST=GETSTOR,COND=YES,SADMP=NO,CONTROL=UNAUTH,USE2GTO32G=YES,"\
"GUARDSIZE64=(%2),PAGEFRAMESIZE=4K,SEGMENTS=(%2),"\
"ORIGIN=(%1),TTOKEN=(%4),RETCODE=%0,MF=(E,(%3))"\
::"m"(iarv64_rc),"r"(&origin),"r"(&segments),"r"(&wgetstor),"r"(ttkn));
break;
case ZOS64_VMEM_2_TO_64G:
__asm(" IARV64 REQUEST=GETSTOR,COND=YES,SADMP=NO,CONTROL=UNAUTH,USE2GTO64G=YES,"\
"GUARDSIZE64=(%2),PAGEFRAMESIZE=4K,SEGMENTS=(%2),"\
"ORIGIN=(%1),TTOKEN=(%4),RETCODE=%0,MF=(E,(%3))"\
::"m"(iarv64_rc),"r"(&origin),"r"(&segments),"r"(&wgetstor),"r"(ttkn));
break;
}
if (0 != iarv64_rc) {
return (void *)0;
}
return (void *)origin;
}
#pragma prolog(omrallocate_4K_pages_above_bar,"MYPROLOG")
#pragma epilog(omrallocate_4K_pages_above_bar,"MYEPILOG")
__asm(" IARV64 PLISTVER=MAX,MF=(L,RGETSTOR)":"DS"(rgetstor));
/*
* Allocate 4KB pages using IARV64 system macro.
* Memory allocated is freed using omrfree_memory_above_bar().
*
* @params[in] numMBSegments Number of 1MB segments to be allocated
*
* @return pointer to memory allocated, NULL on failure.
*/
void * omrallocate_4K_pages_above_bar(int *numMBSegments, const char * ttkn) {
long segments;
long origin;
int iarv64_rc = 0;
__asm(" IARV64 PLISTVER=MAX,MF=(L,RGETSTOR)":"DS"(wgetstor));
segments = *numMBSegments;
wgetstor = rgetstor;
__asm(" IARV64 REQUEST=GETSTOR,COND=YES,SADMP=NO,"\
"CONTROL=UNAUTH,PAGEFRAMESIZE=4K,"\
"SEGMENTS=(%2),ORIGIN=(%1),TTOKEN=(%4),RETCODE=%0,MF=(E,(%3))"\
::"m"(iarv64_rc),"r"(&origin),"r"(&segments),"r"(&wgetstor),"r"(ttkn));
if (0 != iarv64_rc) {
return (void *)0;
}
return (void *)origin;
}
#pragma prolog(omrallocate_4K_pages_guarded_above_bar,"MYPROLOG")
#pragma epilog(omrallocate_4K_pages_guarded_above_bar,"MYEPILOG")
__asm(" IARV64 PLISTVER=MAX,MF=(L,EGETSTOR)":"DS"(egetstor));
/*
* Allocate 4KB pages guarded using IARV64 system macro.
* Memory allocated is freed using omrfree_memory_above_bar().
*
* @params[in] numMBSegments Number of 1MB segments to be allocated
*
* @return pointer to memory allocated, NULL on failure.
*/
void *omrallocate_4K_pages_guarded_above_bar(int *numMBSegments, const char *ttkn) {
long segments;
long origin;
int iarv64_rc = 0;
__asm(" IARV64 PLISTVER=MAX,MF=(L,EGETSTOR)":"DS"(wgetstor));
segments = *numMBSegments;
wgetstor = rgetstor;
__asm(" IARV64 REQUEST=GETSTOR,COND=YES,SADMP=NO,"\
"GUARDSIZE=(%2),"\
"CONTROL=UNAUTH,PAGEFRAMESIZE=4K,"\
"SEGMENTS=(%2),ORIGIN=(%1),TTOKEN=(%4),RETCODE=%0,MF=(E,(%3))"\
::"m"(iarv64_rc),"r"(&origin),"r"(&segments),"r"(&wgetstor),"r"(ttkn));
if (0 != iarv64_rc) {
return (void *)0;
}
return (void *)origin;
}
#pragma prolog(omrfree_memory_above_bar,"MYPROLOG")
#pragma epilog(omrfree_memory_above_bar,"MYEPILOG")
__asm(" IARV64 PLISTVER=MAX,MF=(L,PGETSTOR)":"DS"(pgetstor));
/*
* Free memory allocated using IARV64 system macro.
*
* @params[in] address pointer to memory region to be freed
*
* @return non-zero if memory is not freed successfully, 0 otherwise.
*/
int omrfree_memory_above_bar(void *address, const char * ttkn){
void * xmemobjstart;
int iarv64_rc = 0;
__asm(" IARV64 PLISTVER=MAX,MF=(L,PGETSTOR)":"DS"(wgetstor));
xmemobjstart = address;
wgetstor = pgetstor;
__asm(" IARV64 REQUEST=DETACH,COND=YES,MEMOBJSTART=(%2),TTOKEN=(%3),RETCODE=%0,MF=(E,(%1))"\
::"m"(iarv64_rc),"r"(&wgetstor),"r"(&xmemobjstart),"r"(ttkn));
return iarv64_rc;
}
#pragma prolog(omrremove_guard,"MYPROLOG")
#pragma epilog(omrremove_guard,"MYEPILOG")
__asm(" IARV64 PLISTVER=MAX,MF=(L,FGETSTOR)":"DS"(fgetstor));
/*
* Remove guard for memory allocated using IARV64 system macro.
*
* @params[in] address pointer to memory region to be freed
* @params[in] numMBSegments Number of 1MB segments to be allocated
*
* @return non-zero if memory is not freed successfully, 0 otherwise.
* 04 - Operation completed successfully but with exceptions.
* One or more segments in the memory object are already
* in the requested state.
* 08 - Request was rejected because there was insufficient
* storage to satisfy the request.
*/
int omrremove_guard(void *address, int *numMBSegments){
void * memObjConvertStart;
int iarv64_rc = 0;
long segments;
__asm(" IARV64 PLISTVER=MAX,MF=(L,FGETSTOR)":"DS"(wgetstor));
memObjConvertStart = address;
wgetstor = fgetstor;
segments = *numMBSegments;
__asm(" IARV64 REQUEST=CHANGEGUARD,CONVERT=FROMGUARD,COND=YES,"\
"CONVERTSTART=(%2),CONVERTSIZE64=(%3),"\
"RETCODE=%0,MF=(E,(%1))"\
::"m"(iarv64_rc),"r"(&wgetstor),"r"(&memObjConvertStart),"r"(&segments));
return iarv64_rc;
}
#pragma prolog(omradd_guard,"MYPROLOG")
#pragma epilog(omradd_guard,"MYEPILOG")
__asm(" IARV64 PLISTVER=MAX,MF=(L,DGETSTOR)":"DS"(dgetstor));
/*
* Add guard to memory allocated using IARV64 system macro.
*
* @params[in] address pointer to memory region to be freed
*
* @return non-zero if memory is not freed successfully, 0 otherwise.
* 04 - Operation completed successfully but with exceptions.
* One or more segments in the memory object are already
* in the requested state.
* 08 - Request was rejected because there was insufficient
* storage to satisfy the request.
*/
int omradd_guard(void *address, int *numMBSegments) {
void * memObjConvertStart;
int iarv64_rc = 0;
long segments;
__asm(" IARV64 PLISTVER=MAX,MF=(L,DGETSTOR)":"DS"(wgetstor));
memObjConvertStart = address;
wgetstor = dgetstor;
segments = *numMBSegments;
__asm(" IARV64 REQUEST=CHANGEGUARD,CONVERT=TOGUARD,COND=YES,"\
"CONVERTSTART=(%2),CONVERTSIZE64=(%3),"\
"RETCODE=%0,MF=(E,(%1))"\
::"m"(iarv64_rc),"r"(&wgetstor),"r"(&memObjConvertStart),"r"(&segments));
return iarv64_rc;
}
#pragma prolog(omrdiscard_data,"MYPROLOG")
#pragma epilog(omrdiscard_data,"MYEPILOG")
__asm(" IARV64 PLISTVER=MAX,MF=(L,QGETSTOR)":"DS"(qgetstor));
/* Used to pass parameters to IARV64 DISCARDDATA in omrdiscard_data(). */
struct rangeList {
void *startAddr;
long pageCount;
};
/*
* Discard memory allocated using IARV64 system macro.
*
* @params[in] address pointer to memory region to be discarded
* @params[in] numFrames number of frames to be discarded. Frame size is 4KB.
*
* @return non-zero if memory is not discarded successfully, 0 otherwise.
*/
int omrdiscard_data(void *address, int *numFrames) {
struct rangeList range;
void *rangePtr;
int iarv64_rc = 0;
__asm(" IARV64 PLISTVER=MAX,MF=(L,MGETSTOR)":"DS"(wgetstor));
range.startAddr = address;
range.pageCount = *numFrames;
rangePtr = (void *)⦥
wgetstor = qgetstor;
__asm(" IARV64 REQUEST=DISCARDDATA,KEEPREAL=NO,"\
"RANGLIST=(%1),RETCODE=%0,MF=(E,(%2))"\
::"m"(iarv64_rc),"r"(&rangePtr),"r"(&wgetstor));
return iarv64_rc;
}