Chapter Contents

Previous

Next
IARV64

IARV64



64-Bit Virtual Storage Allocation

Portability: SASC


SYNOPSIS
DESCRIPTION
RETURN VALUE
IMPLEMENTATION
EXAMPLE 1
EXAMPLE 2
RELATED FUNCTIONS


SYNOPSIS

#include 	<osiarv64.h>
int IARV64(char _ _near *request, ...);


DESCRIPTION

The IARV64 function implements the functionality of the IARV64 assembler macro. The request argument is the address of a null-terminated string. The remainder of the argument list is a list of keywords followed, in most cases, by an argument specifying a value for the keyword. The list is terminated by the _Iend keyword. The request argument must be one of the following:

GETSTOR
Create a memory object.

DETACH
Free one or more memory objects.

PAGEFIX
Fix physical pages within one or more memory objects.

PAGEUNFIX
Unfix physical pages within one or more memory objects.

PAGEOUT
Notify the system that data within physical pages of one or more memory objects will not be used in the near future.

PAGEIN
Notify the system that data within physical pages of one or more memory objects are needed in the near future.

DISCARDDATA
Discard data within physical pages of one or more memory objects.

CHANGEGUARD
Request that a specified range in a memory object be changed from guard area to usable area or from usable area to guard area.

LIST
Requests a list of memory objects.

The supported keywords and their associated data are as follows. All references to pointer operands should be considered _ _near unless specifically stated as being _ _huge.

The following parameters may only be specified in an authorized program.


RETURN VALUE

IARV64 returns the value in R15 after calling the IARV64 OS macro. If the parms are in error though, it returns -1.


IMPLEMENTATION

The IARV64 function is implemented by the source module L$UIARV.


EXAMPLE 1

This SPE example gets one megabyte of above the bar memory (compile with the HUGEPTRS option):

#include <osmain.h>
#include 	<osiarv64.h>
#include 		<oswto.h>

char *string1; //(this pointer is _ _huge due to compile option)
int rc;

void osmain()
{

	
     rc = IARV64("GETSTOR", _Isegments, 1ll,            
           			_Iorigin, (__near *) &string1,  _Iend); 


		WTP("GETSTOR rc = %i", rc);       
		strcpy(string1, "hello world.");
     WTP("string1 = %~hpX, '%s'", string1, string1);
}


EXAMPLE 2

This example gets some storage in system keys and then displays a list of memory objects via the LIST request. This example is valid only if it is compiled with hugeptrs.

int num, x, reason;                    
long long adr;              
char list[255];             
struct V64WAHEADER *pHeader;
struct V64WAENTRY *pEntry;  
char *string1;


_ldregs(R1, 0x0000000C);                           
_ossvc(107);              // switch to supervisor state
rc = IARV64("GETSTOR", _Isegments, 1ll,            
            _Ikey, 0x20,                           
            _Iorigin, (_ _near *) &string1,  _Iend);
WTP("GETSTOR rc = %i", rc);                        
rc = IARV64("GETSTOR", _Isegments, 5000ll,         
            _Ikey, 0,                              
            _Iorigin, (_ _near *) &string1,  _Iend);
rc = IARV64("LIST", _Iv64listptr, (_ _near *) list, 
            _Ireason, (_ _near *) &reason,          
            _Iv64listlength, sizeof(list), _Iend); 
_ldregs(R1, 0x00000004);                           
_ossvc(107);              // return to problem state                         
if (rc == 0)                                                  
{                                                             
   pHeader = list;                                            
   WTP("V64WARETURNCODE = %i", pHeader->V64WARETURNCODE);     
   WTP("V64WANUMDATAAREAS = %i", pHeader->V64WANUMDATAAREAS); 
   pEntry = (struct V64WAENTRY *)                             
            ((char *) pHeader + V64WAHEADER_LEN);             
   x = 1;                                                     
   memcpy(&num, &pHeader->V64WANUMDATAAREAS, 4);              
   while (num--)                                              
   {                                                          
      WTP("x = %i", x++);                                     
      WTP(" Storage key = %02hhX", pEntry->v64waflag);        
      memcpy(&adr, &pEntry->v64wastart64, 8);                 
      WTP(" Start: %016llX", adr);                            
      memcpy(&adr, &pEntry->v64waend64, 8);                   
      WTP("   End: %016llX", adr);                            
      pEntry++;                                               
   }                                                          
}


RELATED FUNCTIONS

hpcreate, hpalloc


Chapter Contents

Previous

Next

Top of Page

Copyright © 2004 by SAS Institute Inc., Cary, NC, USA. All rights reserved.