aboutsummaryrefslogtreecommitdiff
path: root/i386
diff options
context:
space:
mode:
authorFlavio Cruz <flaviocruz@gmail.com>2022-12-16 21:06:25 -0500
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2022-12-17 03:23:52 +0100
commite493c4e8c54ece41bd24b209cfb9efc24254214b (patch)
treee2d22783de731d40126bb76a35ac0d90e8ae1c0a /i386
parentc00d8d62878434e82b04d5ad5901f938d120debf (diff)
downloadgnumach-e493c4e8c54ece41bd24b209cfb9efc24254214b.tar.gz
gnumach-e493c4e8c54ece41bd24b209cfb9efc24254214b.tar.bz2
gnumach-e493c4e8c54ece41bd24b209cfb9efc24254214b.zip
Use struct for time_value_t and define seconds as long_integer_t.
On 64 bit kernels, seconds will be 64 bits long and won't suffer from the 2038 problem. We also add a new type rpc_time_value_t to handle the conversion between 32 bit userland and 64 bit kernel. Message-Id: <Y50kIaIgaIdGjDAk@mars>
Diffstat (limited to 'i386')
-rwxr-xr-xi386/include/mach/i386/machine_types.defs16
-rw-r--r--i386/include/mach/i386/vm_types.h8
2 files changed, 22 insertions, 2 deletions
diff --git a/i386/include/mach/i386/machine_types.defs b/i386/include/mach/i386/machine_types.defs
index f3de1e44..d1b61be9 100755
--- a/i386/include/mach/i386/machine_types.defs
+++ b/i386/include/mach/i386/machine_types.defs
@@ -66,13 +66,25 @@ type long_natural_t = uint32_t;
#endif /* __x86_64__ */
/*
- * long_natural_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(__x86_64__)
+type long_integer_t = int64_t;
+#else
+type long_integer_t = int32_t;
+#endif /* __x86_64__ */
+
+/*
+ * 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) && 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 */
/*
diff --git a/i386/include/mach/i386/vm_types.h b/i386/include/mach/i386/vm_types.h
index 86e8563a..7e5857a5 100644
--- a/i386/include/mach/i386/vm_types.h
+++ b/i386/include/mach/i386/vm_types.h
@@ -69,6 +69,12 @@ typedef int integer_t;
typedef unsigned long long_natural_t;
/*
+ * Larger version of integer_t. Only used when we want to hold possibly larger
+ * values than what is possible with integer_t.
+ */
+typedef long long_integer_t;
+
+/*
* A vm_offset_t is a type-neutral pointer,
* e.g. an offset into a virtual memory space.
*/
@@ -117,6 +123,7 @@ static inline __mach_uint32_t convert_vm_to_user(__mach_uint64_t kaddr)
return (__mach_uint32_t)kaddr;
}
typedef __mach_uint32_t rpc_long_natural_t;
+typedef __mach_int32_t rpc_long_integer_t;
#else /* MACH_KERNEL */
typedef vm_offset_t rpc_vm_address_t;
typedef vm_offset_t rpc_vm_offset_t;
@@ -124,6 +131,7 @@ 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;
#endif /* MACH_KERNEL */
#endif /* __ASSEMBLER__ */