diff options
author | Luca Dariz <luca@orpolo.org> | 2022-04-03 16:59:55 +0200 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2022-08-27 22:19:18 +0200 |
commit | 3e1702a65fb3caf50c8d09a1b383b0056a5efc82 (patch) | |
tree | a4f687afd3a455bd664daeddf947492fabd16745 /i386 | |
parent | e2f1d502a5a5ab6a8885cc518ed254c79f7ab27c (diff) | |
download | gnumach-3e1702a65fb3caf50c8d09a1b383b0056a5efc82.tar.gz gnumach-3e1702a65fb3caf50c8d09a1b383b0056a5efc82.tar.bz2 gnumach-3e1702a65fb3caf50c8d09a1b383b0056a5efc82.zip |
add rpc_versions for vm types
* vm_types.h: add new types and conversion functions
* mach_types.defs: adapt vm types depending on kernel user/server
* vm_info.h: adapt rpc structure to have uniformly-sized members also
on 64-bit
* x86_64/configfrag.c: add new option to select the user-space variant.
Note that with this change the user-space interface is somehow fixed,
i.e. it can't support 32-bit and 64-bit tasks at the same time.
If this would be needed at some point, this change needs to be reworked.
Signed-off-by: Luca Dariz <luca@orpolo.org>
Message-Id: <20220403145955.120742-3-luca@orpolo.org>
Diffstat (limited to 'i386')
-rw-r--r-- | i386/include/mach/i386/vm_types.h | 37 |
1 files changed, 33 insertions, 4 deletions
diff --git a/i386/include/mach/i386/vm_types.h b/i386/include/mach/i386/vm_types.h index f49a95a1..16aedc44 100644 --- a/i386/include/mach/i386/vm_types.h +++ b/i386/include/mach/i386/vm_types.h @@ -37,6 +37,12 @@ #ifdef __ASSEMBLER__ #else /* __ASSEMBLER__ */ +#include <stdint.h> + +#ifdef MACH_KERNEL +#include <kern/assert.h> +#endif + /* * A natural_t is the type for the native * integer type, e.g. 32 or 64 or.. whatever @@ -88,13 +94,36 @@ typedef unsigned long long rpc_phys_addr_t; * expressing the difference between two * vm_offset_t entities. */ -#ifdef __x86_64__ typedef unsigned long vm_size_t; -#else -typedef natural_t vm_size_t; -#endif typedef vm_size_t * vm_size_array_t; +/* + * rpc_types are for user/kernel interfaces. On kernel side they may differ from + * the native types, while on user space they shall be the same. + * These three types are always of the same size, so we can reuse the conversion + * functions. + */ +#if defined(MACH_KERNEL) && defined(USER32) +typedef uint32_t rpc_vm_address_t; +typedef uint32_t rpc_vm_offset_t; +typedef uint32_t rpc_vm_size_t; +static inline uint64_t convert_vm_from_user(uint32_t uaddr) +{ + return (uint64_t)uaddr; +} +static inline uint32_t convert_vm_to_user(uint64_t kaddr) +{ + assert(kaddr <= 0xFFFFFFFF); + return (uint32_t)kaddr; +} +#else /* MACH_KERNEL */ +typedef vm_offset_t rpc_vm_address_t; +typedef vm_offset_t rpc_vm_offset_t; +typedef vm_size_t rpc_vm_size_t; +#define convert_vm_to_user null_conversion +#define convert_vm_from_user null_conversion +#endif /* MACH_KERNEL */ + #endif /* __ASSEMBLER__ */ /* |