|
|
HP C
|
Previous | Contents | Index |
The __CMP_SWAP_QUAD_REL function performs a conditional atomic compare and exchange operation with release semantics on a quadword. The quadword pointed to by source is read and compared with the quadword old_value. If they are equal, the quadword new_value is written into the quadword pointed to by source. The read and write is performed atomically, with no intervening access to the same memory region.
Release memory ordering guarantees that the memory read/write is made visible after all previous data memory acceses to the same memory location by other processors.
The function returns 1 if the write occurs, and 0 otherwise.
This function has the following format:
int __CMP_SWAP_QUAD_REL (volatile void *source, int old_value, int new_value); |
source
The quadword value to be compared with old_value.old_value
The quadword value source is compared with.new_value
The quadword value written into source if source and old_value are equal.
The __RETURN_ADDRESS function produces the address to which the function containing the built-in call will return as a 64-bit integer (on Alpha systems, the value of R26 on entry to the function; on I64 systems, the value of B0 on entry to the function).
This built-in function cannot be used within a function specified to use nonstandard linkage.
This function has the following format:
__int64 __RETURN_ADDRESS (void); |
The __break2 function is used to implement the Alpha __PAL_GENTRAP and __PAL_BUGCHK built-in functions on OpenVMS I64 systems.
The __break2 function is equivalent to the __break function with the second parameter passed in general register 17:
R17 = _value; _code); |
This function has the following format:
void __break2 (__Integer_Constant __break_code, unsigned __int64 __r17_value); |
__breakcode
The particular software condition that has occurred.__r17_value
The value of R17, a volatile general register reserved by the OpenVMS Itanium calling standard for use by compiled code to communicate with specialized compiler support routines that require out-of-band information passing.
The __flushrs function flushes the register stack.
This function has the following format:
void __flushrs (void); |
The __loadrs function loads the register stack.
This function has the following format:
void __loadrs (void); |
The __prober function determines whether read access to the virtual address specified by __address bits {60:0} and the region register indexed by __address bits {63:61} is permitted at the privilege level given by __mode bits {1:0}. It returns 1 if the access is permitted, and 0 otherwise.
This function can probe only with equal or lower privilege levels. If the specified privilege level is higher (lower number), then the probe is performed with the current privilege level.
This function is the same as the Intel __probe_r function.
This function has the following format:
int __prober (__int64 __address, unsigned int __mode); |
__address
Virtual address for which read-access permission is being checked.__mode
Privilege level for which read-access permission is being checked.
The __probew function determines whether write access to the virtual address specified by __address bits {60:0} and the region register indexed by __address bits {63:61}, is permitted at the privilege level given by __mode bits {1:0}. It returns 1 if the access is permitted, and 0 otherwise.
This function can probe only with equal or lower privilege levels. If the specified privilege level is higher (lower number), then the probe is performed with the current privilege level.
This function is the same as the Intel __probe_w function.
This function has the following format:
int __probew (__int64 __address, unsigned int __mode); |
__address
Virtual address for which write-access permission is being checked.__mode
Privilege level for which write-access permission is being checked.
The __tak function returns the translation access key.
This function has the following format:
unsigned int __tak (__int64 __address); |
__address
Virtual address for translation key is being returned.
The __tpa function translates a virtual address to a physical address.
This function has the following format:
__int64 __tpa(__int64 __address); |
__address
Virtual address to be translated.
The following sections describe the HP C built-in functions available on OpenVMS VAX systems.
The HP C built-in functions use enumerated typedefs to define possible return values. We recommend that you use the enumerated types to store and compare return values.
The __ALLOCA function allocates n bytes from the stack.
This function has the following format:
void *__ALLOCA (unsigned int n); |
n
The number of bytes to be allocated.
A pointer to the allocated memory is returned.
The _ADAWI function adds its source operand to the destination. This function is interlocked against similar operations by other processors or devices in the system.
The _ADAWI function has the following format:
typedef enum { _adawi_sum_neg=--1, _adawi_sum_zero, _adawi_sum_pos} _ADAWI_STATUS; |
__src
The value to be added to the destination.__dest
A pointer to the destination. The destination must be aligned on a word boundary. (You can achieve alignment using the _align or __align storage-class modifier.)
There are three possible return values:
The _BBCCI function performs the following functions in interlocked fashion:
The _BBCCI function has the following format:
typedef enum { _bbcci_oldval_1, _bbcci_oldval_0} _BBCCI_STATUS; |
__position
The position of the bit within the field.__address
The base address of the field.
The return value of _bbcci_oldval_1 (0) or _bbcci_oldval_0 (1) is the complement of the value of the specified bit before being cleared.
The _BBSSI function performs the following functions in interlocked fashion:
The _BBSSI function has the following format:
typedef enum { _bbssi_oldval_0, _bbcci_oldval_1} _BBSSI_STATUS; |
__position
The position of the bit within the field.__address
The base address of the field.
The return value of _bbssi_oldval_0 (0) or _bbssi_oldval_1 (1) is the value of the specified bit before being set.
The _FFC function finds the position of the first clear bit in a field. The bits are tested for clear status starting at bit 0 and extending to the highest bit in the field.
The _FFC function has the following format:
typedef enum { _ff_bit_not_found, _ff_bit_found} _FF_STATUS; |
__start
The start position of the field.__size
The size of the field, in bits. The size must be a value from 0 to 32 bits.__base
The address of the field.__position
The address of an integer to receive the position of the clear bit. If no bit is clear, the integer is set to the position of the first bit past the last bit tested.
There are two possible return values:
The _FFS function finds the position of the first set bit in a field. The bits are tested for set status starting at bit 0 and extending to the highest bit in the field.
The _FFS function has the following format:
typedef enum { _ff_bit_not_found, _ff_bit_found} _FF_STATUS; |
__start
The start position of the field.__size
The size of the field, in bits. The size must be a value from 0 to 32 bits.__base
The address of the field.__position
The address of an integer to receive the position of the set bit. If no bit is set, the integer is set to the position of the first bit past the last bit tested.
There are two possible return values:
The _HALT function halts the processor when executed by a process running in kernel mode. This is a privileged function.
The _HALT function has the following format:
void _HALT (void); |
The _INSQHI function inserts an entry into the front of a queue in an indivisible manner. This operation is interlocked against similar operations by other processors or devices in the system.
The _INSQHI function has the following format:
typedef enum {_insqi_inserted_many, _insqi_not_inserted, _insqi_inserted_only} _INSQI_STATUS; |
__new_entry
A pointer to the new entry to be inserted. The entry must be aligned on a quadword boundary. (You can achieve alignment using the _align or __align storage-class modifier.)__head
A pointer to the queue header. The header must be aligned on a quadword boundary. (You can achieve alignment using the _align or __align storage-class modifier.)
There are three possible return values:
The _INSQTI function inserts an entry at the end of a queue in an indivisible manner. This operation is interlocked against similar operations by other processors or devices in the system.
The _INSQTI function has the following format:
typedef enum {_insqi_inserted_many, _insqi_not_inserted, _insqi_inserted_only} _INSQI_STATUS; |
__new_entry
A pointer to the new entry to be inserted. The entry must be aligned on a quadword boundary. (You can achieve alignment using the _align or __align storage-class modifier.)__head
A pointer to the queue header. The header must be aligned on a quadword boundary. (You can achieve alignment using the _align or __align storage-class modifier.)
There are three possible return values:
The _INSQUE function inserts a new entry into a queue following an existing entry.
The _INSQUE function has the following format:
typedef enum { _insque_inserted_only, _insque_inserted_many} _INSQUE_STATUS; |
__new_entry
A pointer to the new entry to be inserted.__predecessor
A pointer to an existing entry in the queue.
There are two possible return values:
The _LOCC function locates the first character in a string matching the target character.
The _LOCC function has the following format:
unsigned short _LOCC (char __target, unsigned short __length, const char *__string, ...); |
__target
The character being searched.__length
The length of the searched string. The length must be a value from 0 to 65,535.__string
A pointer to the searched string....
An optional position argument, which is a pointer to a pointer to char. If the searched character is found, this output argument is updated to point to the character found. If the character is not found, this argument is set to the address one byte beyond the string.
If the target character is found, the return value is the number of bytes remaining in the string; otherwise, the return value is 0.
The _MFPR function returns the contents of a processor register. This is a privileged function.
The _MFPR function has the following formats:
void _MFPR (int register_num, int *destination); |
register_num
The number of the privileged register to be read.destination
A pointer to the location receiving the value from the register. This location can be a signed or unsigned int.
The _MOVC3 function copies a block of memory.
The _MOVC3 function has the following format:
void _MOVC3 (unsigned short __length, const char *__src, char *__dest, ...); |
__length
The length of the source string, in bytes. The length must be a value from 0 to 65,535.__src
A pointer to the source string.__dest
A pointer to the destination memory....
One or two optional arguments:
- endscr
A pointer to a pointer to char. The _MOVC3 function sets this output argument to the address of the byte beyond the source string. Although this is an optional argument, it is required if enddest is specified.- enddest
A pointer to a pointer to char. The _MOVC3 function sets this output argument to the address of the byte beyond the destination string.
The _MOVC5 function allows the source string specified by the pointer and length pair to be moved to the destination string specified by the other pointer and length pair. If the source string is smaller than the destination string, the destination string is padded with the specified character.
The _MOVC5 function has the following format:
void _MOVC5 (unsigned short __srclen, const char *__src, char __fill, |
__srclen
The length of the source string, in bytes. The length must be a value from 0 to 65,535.__src
A pointer to the source string.__fill
The fill character to be used if the source string is smaller than the destination string.__destlen
The length of the destination string, in bytes. The length must be a value from 0 to 65,535.__dest
A pointer to the destination string....
One to three optional arguments:
- unmoved_src
A pointer to an unsigned short integer. The _MOVC5 function sets this output argument to the number of unmoved bytes remaining in the source string. This argument is optional if the endscr argument is not specified.- endscr
A pointer to a pointer to char. The _MOVC5 function sets this output argument to the address of the byte beyond the source string. Although this is an optional argument, it is required if enddest is specified.- enddest
A pointer to a pointer to char. The _MOVC5 function sets this output argument to the address of the byte beyond the destination string.
The _MOVPSL function stores the value of the Processor Status Longword (PSL).
The _MOVPSL function has the following format:
void _MOVPSL (void *__psl); |
__psl
The address of the location for storing the value of the PSL.
Previous | Next | Contents | Index |
|