/* IBM_PROLOG_BEGIN_TAG                                                   */
/* This is an automatically generated prolog.                             */
/*                                                                        */
/* bos72Q src/bos/kernel/sys/pin.h 1.13.1.1                               */
/*                                                                        */
/* Licensed Materials - Property of IBM                                   */
/*                                                                        */
/* COPYRIGHT International Business Machines Corp. 1989,2019              */
/* All Rights Reserved                                                    */
/*                                                                        */
/* US Government Users Restricted Rights - Use, duplication or            */
/* disclosure restricted by GSA ADP Schedule Contract with IBM Corp.      */
/*                                                                        */
/* IBM_PROLOG_END_TAG                                                     */
/* @(#)67     1.13.1.1  src/bos/kernel/sys/pin.h, sysvmm, bos72Q, q2019_13A4 2/6/19 00:42:44 */

/*
 * COMPONENT_NAME: (SYSVMM) Virtual Memory Manager
 *
 * FUNCTIONS:
 *
 * ORIGINS: 27
 *
 * (C) COPYRIGHT International Business Machines Corp. 1989, 1989
 * All Rights Reserved
 * Licensed Materials - Property of IBM
 *
 * US Government Users Restricted Rights - Use, duplication or
 * disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
 */

#ifndef _H_PIN
#define _H_PIN

#include <sys/kerrno.h>

#ifdef __cplusplus
extern "C" {
#endif

/*
**	PIN kernel service
*/

int
pincode(int (*func)());

#define PIN_SUCC	 0 		/*  return value if successful        */
#define MEM_INSUFF	ENOMEM		/*  insufficient memory avail.        */
#define MEM_INVAL	EINVAL		/*  specified range of memory invalid
					 *  or length parameter negative      */

/*
**	UNPIN kernel service -- additional defines
*/

int
unpincode(int (*func)());

#define UNPIN_SUCC	 0		/*  return value if successful        */
#define UNPIN_UNDERFL	EINVAL		/*  one or pages were not pinned      */

#if defined(__64BIT_KERNEL) || defined(__FULL_PROTO)
int ltpin(void * vaddr, long nbytes);
int ltunpin(void * vaddr, long nbytes);
int pin(void * vaddr, long nbytes);
int unpin(void * vaddr, long nbytes);
#endif

#ifdef _KERNEL
    int vm_pinp (vmid_t, vpn_t, vpn_t, uint);
    int vm_unpinp(vmid_t, vpn_t, vpn_t);
#endif

/*
 * Context stack related service
 */
kerrno_t pin_context_stack(long flags);
kerrno_t unpin_context_stack(long flags);

/* kerrornos for pin_context_stack() and unpin_context_stack() */
#define ENOMEM_PIN_CONTEXT_STACK	KERROR(ENOMEM, sysvmm_BLOCK_02, 1)
#define ENOSPC_PIN_CONTEXT_STACK	KERROR(ENOSPC, sysvmm_BLOCK_02, 2)
#define EINVAL_PIN_CONTEXT_STACK	KERROR(EINVAL, sysvmm_BLOCK_02, 3)
#define EINVAL_UNPIN_CONTEXT_STACK	KERROR(EINVAL, sysvmm_BLOCK_02, 4)

#ifdef __cplusplus
}
#endif

#endif	/* _H_PIN */
