X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/a991bd8d3e7fe02dbca0644054bab73c5b75324a..HEAD:/osfmk/mach/port.h diff --git a/osfmk/mach/port.h b/osfmk/mach/port.h index a70035edd..9472cecea 100644 --- a/osfmk/mach/port.h +++ b/osfmk/mach/port.h @@ -142,8 +142,13 @@ typedef struct ipc_port *ipc_port_t; #define IPC_PORT_NULL ((ipc_port_t) NULL) #define IPC_PORT_DEAD ((ipc_port_t)~0UL) -#define IPC_PORT_VALID(port) \ - ((port) != IPC_PORT_NULL && (port) != IPC_PORT_DEAD) +#define IPC_PORT_VALID(port) ipc_port_valid(port) + +static inline boolean_t +ipc_port_valid(ipc_port_t port) +{ + return port != IPC_PORT_DEAD && port; +} typedef ipc_port_t mach_port_t; @@ -269,7 +274,6 @@ typedef mach_port_type_t *mach_port_type_array_t; #define MACH_PORT_TYPE_DEAD_NAME MACH_PORT_TYPE(MACH_PORT_RIGHT_DEAD_NAME) #define MACH_PORT_TYPE_LABELH MACH_PORT_TYPE(MACH_PORT_RIGHT_LABELH) /* obsolete */ - #ifdef MACH_KERNEL_PRIVATE /* Holder used to have a receive right - remembered to filter exceptions */ #define MACH_PORT_TYPE_EX_RECEIVE MACH_PORT_TYPE_LABELH @@ -451,9 +455,16 @@ enum mach_port_guard_exception_codes { kGUARD_EXC_SEND_INVALID_RIGHT = 1u << 18, kGUARD_EXC_RCV_INVALID_NAME = 1u << 19, kGUARD_EXC_RCV_GUARDED_DESC = 1u << 20, /* should never be fatal; for development only */ + kGUARD_EXC_MOD_REFS_NON_FATAL = 1u << 21, + kGUARD_EXC_IMMOVABLE_NON_FATAL = 1u << 22, }; -#define MAX_FATAL_kGUARD_EXC_CODE (1u << 6) +#define MAX_FATAL_kGUARD_EXC_CODE (1u << 7) + +/* + * Mach port guard flags. + */ +#define MPG_FLAGS_NONE (0x00ull) /* * These flags are used as bits in the subcode of kGUARD_EXC_STRICT_REPLY exceptions. @@ -465,6 +476,16 @@ enum mach_port_guard_exception_codes { #define MPG_FLAGS_STRICT_REPLY_MISMATCHED_PERSONA (0x10ull << 56) #define MPG_FLAGS_STRICT_REPLY_MASK (0xffull << 56) +/* + * These flags are used as bits in the subcode of kGUARD_EXC_MOD_REFS exceptions. + */ +#define MPG_FLAGS_MOD_REFS_PINNED_DEALLOC (0x01ull << 56) + +/* + * These flags are used as bits in the subcode of kGUARD_EXC_IMMOVABLE exceptions. + */ +#define MPG_FLAGS_IMMOVABLE_PINNED (0x01ull << 56) + /* * Flags for mach_port_guard_with_flags. These flags extend * the attributes associated with a guarded port.