aboutsummaryrefslogtreecommitdiff
path: root/i386/include
diff options
context:
space:
mode:
authorFlavio Cruz <flaviocruz@gmail.com>2022-12-18 12:21:27 -0500
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2022-12-18 18:39:02 +0100
commit3b097978c147d6e98f02e7b2d31e75a36e36338f (patch)
treebf8e7c770b5e8dfbf104dcf80e594ce573470754 /i386/include
parent16e0cdef9ce952fa5f7980d19f113be027e88b27 (diff)
downloadgnumach-3b097978c147d6e98f02e7b2d31e75a36e36338f.tar.gz
gnumach-3b097978c147d6e98f02e7b2d31e75a36e36338f.tar.bz2
gnumach-3b097978c147d6e98f02e7b2d31e75a36e36338f.zip
Use long_natural_t for recnum_t
For 64 bits, device operations will provide an addressing space of 64 bits. Also define the translation functions if long_natural_t or long_integer_t are ever used in RPCs. Note that MIG does not implicitly inherit the translation functions from types hence the need to redefine them for recnum_t. Message-Id: <Y59MFzekEA0YUXIw@mars>
Diffstat (limited to 'i386/include')
-rwxr-xr-xi386/include/mach/i386/machine_types.defs53
-rw-r--r--i386/include/mach/i386/vm_types.h20
2 files changed, 52 insertions, 21 deletions
diff --git a/i386/include/mach/i386/machine_types.defs b/i386/include/mach/i386/machine_types.defs
index d1b61be9..3d540be9 100755
--- a/i386/include/mach/i386/machine_types.defs
+++ b/i386/include/mach/i386/machine_types.defs
@@ -55,37 +55,48 @@ type natural_t = uint32_t;
type integer_t = int32_t;
/*
- * A long_natural_t is a possibly larger unsigned integer type than natural_t.
- * Should be used instead of natural_t when we want the data to be less subject
- * to overflows.
+ * long_natural_t and long_integer_t for kernel <-> userland interfaces as the
+ * size depends on the architecture of both kernel and userland.
*/
+#if defined(KERNEL_SERVER) && defined(USER32)
+type rpc_long_natural_t = uint32_t;
+type rpc_long_integer_t = int32_t;
+#else /* KERNEL and USER32 */
#if defined(__x86_64__)
-type long_natural_t = uint64_t;
+type rpc_long_natural_t = uint64_t;
+type rpc_long_integer_t = int64_t;
#else
-type long_natural_t = uint32_t;
+type rpc_long_natural_t = uint32_t;
+type rpc_long_integer_t = int32_t;
#endif /* __x86_64__ */
+#endif /* KERNEL_SERVER and USER32 */
/*
- * Larger version of integer_t. Only used when we want to hold possibly larger
- * values than what is possible with integer_t.
+ * A long_natural_t is a possibly larger unsigned integer type than natural_t.
+ * Should be used instead of natural_t when we want the data to be less subject
+ * to overflows.
*/
-#if defined(__x86_64__)
-type long_integer_t = int64_t;
-#else
-type long_integer_t = int32_t;
-#endif /* __x86_64__ */
+type long_natural_t = rpc_long_natural_t
+#if defined(KERNEL_SERVER)
+ intran: long_natural_t convert_long_natural_from_user(rpc_long_natural_t)
+ outtran: rpc_long_natural_t convert_long_natural_to_user(long_natural_t)
+#elif defined(KERNEL_USER)
+ ctype: rpc_long_natural_t
+#endif
+ ;
/*
- * long_natural_t and long_integer_t for kernel <-> userland interfaces as the
- * size depends on the architecture of both kernel and userland.
+ * Larger version of integer_t. Only used when we want to hold possibly larger
+ * values than what is possible with integer_t.
*/
-#if defined(KERNEL) && defined(USER32)
-type rpc_long_natural_t = uint32_t;
-type rpc_long_integer_t = int32_t;
-#else /* KERNEL and USER32 */
-type rpc_long_natural_t = long_natural_t;
-type rpc_long_integer_t = long_integer_t;
-#endif /* KERNEL_SERVER and USER32 */
+type long_integer_t = rpc_long_integer_t
+#if defined(KERNEL_SERVER)
+ intran: long_integer_t convert_long_integer_from_user(rpc_long_integer_t)
+ outtran: rpc_long_integer_t convert_long_integer_to_user(long_integer_t)
+#elif defined(KERNEL_USER)
+ ctype: rpc_long_integer_t
+#endif
+ ;
/*
* Physical address size
diff --git a/i386/include/mach/i386/vm_types.h b/i386/include/mach/i386/vm_types.h
index 7e5857a5..bb43a9fb 100644
--- a/i386/include/mach/i386/vm_types.h
+++ b/i386/include/mach/i386/vm_types.h
@@ -113,6 +113,7 @@ typedef vm_size_t * vm_size_array_t;
typedef __mach_uint32_t rpc_vm_address_t;
typedef __mach_uint32_t rpc_vm_offset_t;
typedef __mach_uint32_t rpc_vm_size_t;
+
static inline __mach_uint64_t convert_vm_from_user(__mach_uint32_t uaddr)
{
return (__mach_uint64_t)uaddr;
@@ -122,18 +123,37 @@ static inline __mach_uint32_t convert_vm_to_user(__mach_uint64_t kaddr)
assert(kaddr <= 0xFFFFFFFF);
return (__mach_uint32_t)kaddr;
}
+
typedef __mach_uint32_t rpc_long_natural_t;
typedef __mach_int32_t rpc_long_integer_t;
+
+static inline __mach_int64_t convert_long_integer_from_user(__mach_int32_t i)
+{
+ return (__mach_int64_t)i;
+}
+static inline __mach_int32_t convert_long_integer_to_user(__mach_int64_t i)
+{
+ assert(i <= 0x7FFFFFFF);
+ return (__mach_int32_t)i;
+}
#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
+
typedef long_natural_t rpc_long_natural_t;
typedef long_integer_t rpc_long_integer_t;
+
+#define convert_long_integer_to_user null_conversion
+#define convert_long_integer_from_user null_conversion
#endif /* MACH_KERNEL */
+#define convert_long_natural_to_user convert_vm_to_user
+#define convert_long_natural_from_user convert_vm_from_user
+
#endif /* __ASSEMBLER__ */
/*