diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/mach/mach_types.defs | 13 | ||||
-rw-r--r-- | include/mach/time_value.h | 27 |
2 files changed, 38 insertions, 2 deletions
diff --git a/include/mach/mach_types.defs b/include/mach/mach_types.defs index 74b85232..da74a3f2 100644 --- a/include/mach/mach_types.defs +++ b/include/mach/mach_types.defs @@ -261,7 +261,18 @@ type kernel_version_t = (MACH_MSG_TYPE_STRING, 512*8); type kernel_boot_info_t = (MACH_MSG_TYPE_STRING, 4096*8); -type time_value_t = struct[2] of integer_t; +type rpc_time_value_t = struct { + rpc_long_integer_t seconds; + integer_t microseconds; +}; +type time_value_t = rpc_time_value_t +#if defined(KERNEL_SERVER) + intran: time_value_t convert_time_value_from_user(rpc_time_value_t) + outtran: rpc_time_value_t convert_time_value_to_user(time_value_t) +#elif defined(KERNEL_USER) + ctype: rpc_time_value_t +#endif + ; type emulation_vector_t = ^array[] of vm_offset_t; diff --git a/include/mach/time_value.h b/include/mach/time_value.h index 3a9c384c..53692bcf 100644 --- a/include/mach/time_value.h +++ b/include/mach/time_value.h @@ -33,12 +33,37 @@ * Time value returned by kernel. */ +struct rpc_time_value { + /* TODO: this should be 64 bits regardless of the arch to be Y2038 proof. */ + rpc_long_integer_t seconds; + integer_t microseconds; +}; +typedef struct rpc_time_value rpc_time_value_t; + +/* + * Time value used by kernel. + */ struct time_value { - integer_t seconds; + long_integer_t seconds; integer_t microseconds; }; typedef struct time_value time_value_t; +/** + * Functions used by Mig to perform user to kernel conversion and vice-versa. + * We only do this because we may run a 64 bit kernel with a 32 bit user space. + */ +static inline rpc_time_value_t convert_time_value_to_user(time_value_t tv) +{ + rpc_time_value_t user = {.seconds = tv.seconds, .microseconds = tv.microseconds}; + return user; +} +static inline time_value_t convert_time_value_from_user(rpc_time_value_t tv) +{ + time_value_t kernel = {.seconds = tv.seconds, .microseconds = tv.microseconds}; + return kernel; +} + /* * Macros to manipulate time values. Assume that time values * are normalized (microseconds <= 999999). |