xref: /freebsd/sys/amd64/linux/linux_emul_md.h (revision bdb561843e865eaa5bbdc5394ed9d9c91136240c)
1 /*
2  * SPDX-License-Identifier: BSD-2-Clause
3  *
4  * Copyright (c) 2026 Devin Teske <dteske@FreeBSD.org>
5  */
6 
7 #ifndef _AMD64_LINUX_EMUL_MD_H_
8 #define	_AMD64_LINUX_EMUL_MD_H_
9 
10 /*
11  * Machine-dependent part of the Linux process emuldata, embedded in
12  * struct linux_pemuldata as pem_md.
13  */
14 struct linux_pemuldata_md {
15 	uint32_t	md_pkey_allocation_map;	/* x86 protection keys */
16 };
17 
18 /*
19  * Initial protection key allocation map: key 0 is the default key,
20  * implicitly allocated on Linux (mm_pkey_allocation_map is initialized
21  * to 0x1).  Inherited on fork, reset on exec.
22  */
23 #define	LINUX_PKEY_INITIAL_MAP	0x1
24 
25 /*
26  * Initial PKRU at exec: access disabled for keys 1..15, key 0 open;
27  * the Linux init_pkru default.
28  */
29 #define	LINUX_PKRU_INIT		0x55555554
30 
31 struct thread;
32 
33 void	linux_pkru_exec_init(struct thread *);
34 
35 #endif	/* !_AMD64_LINUX_EMUL_MD_H_ */
36