hkeyset_add, hkeyset_replace, hkeyset_restore, or hkeyset_get Kernel Service

Purpose

Manipulates the protection domain (page access as controlled by storage keys) in use for code execution in the kernel environment.

Syntax

#include <sys/skeys.h>

hkeyset_t hkeyset_add ( hkeyset_t keyset );
hkeyset_t hkeyset_replace ( hkeyset_t keyset );
void hkeyset_restore ( hkeyset_t keyset );
hkeyset_t hkeyset_get ( void );

Parameters

Item Description
keyset The hardware keyset to be activated.

Description

If storage protection keys are enabled, every memory page has a hardware storage protection key associated with it. A keyset is a representation of the access rights to a set of storage protection keys. To access a memory page, a hardware keyset containing the storage key associated with the memory page must be active.

The hkeyset_add kernel service updates the protection domain by adding the hardware keyset specified by the keyset parameter to the currently addressable hardware keyset. The previous hardware keyset is returned.

The hkeyset_replace kernel service updates the protection domain by loading the hardware keyset specified by the keyset parameter as the currently addressable storage set. The previous hardware keyset is returned.

The hkeyset_restore kernel service restores a caller's hardware keyset when returning from a module entry point. It does not return any value.

The hkeyset_get kernel service reads the current hardware keyset without altering it.

Execution Environment

The hkeyset_add, hkeyset_replace, hkeyset_restore, or hkeyset_get kernel service can be called from either the process environment or the interrupt environment.

Return Values

The hkeyset_add, hkeyset_replace, and hkeyset_get kernel services return the keyset value that was active before the call. The hkeyset_restore kernel service does not return any value.