Obtains the value of a 64-bit parameter passed by a 64-bit process when it invokes a system call provided by a 32-bit kernel extension.
#include <sys/remap.h> unsigned long long get64bitparm (parm, position) unsigned long parm; int position;
In the 32-bit kernel, pointers and longs are 32-bit types. In 64-bit programs, pointers and longs are 64-bit types. When a 64-bit program invokes a system call and passes 64-bit values, there is no direct way for a kernel extension to obtain the full 64-bit value, because the kernel extension is running in 32-bit mode.
To allow 64-bit values to be passed to a system call, the system call handler saves the high-order word of the 8 parameter registers. Then parameters are truncated to 32-bit values before the system call function is invoked. The full 64-bit value can be retrieved by calling get64bitparm(), passing the original 32-bit parameter and the 0-based parameter number as arguments.
The full 64-bit argument value is returned as a long long. If called from a 32-bit process, the returned value is unpredictable. If position is less than 0 or greater than 7, the panic kernel service is called.
#include <sys/remap.h> my_syscall(int count, void *user_data) { __ptr64 user_ptr; if (IS64U) user_ptr = (__ptr64)get64bitparm((unsigned long)user_data, 1); else user_ptr = (__ptr64)user_data; ... }
When my_syscall is called from a 64-bit process, user_data will have been truncated to 32 bits, if the caller is a 64-bit process. The get64bitparm kernel service allows the full 64-bit value to be obtained. When my_syscall is called from a 32-bit process, the user_data pointer can be used directly. The count parameter can be used directly whether the current process is 32-bit or 64-bit, since the size of an int is the same in both 32-bit mode and 64-bit mode.
The get64bitparm kernel service is not needed when the 64-bit kernel is running, because a pointer parameter is already a 64-bit value. To allow for common code, the get64bitparm kernel service is defined as a macro that returns its first argument, when a kernel extension is compiled in 64-bit mode.
This kernel service can only be called from the process environment when the current process is in 64-bit mode.
The get64bitparm kernel service is only available on the 32-bit PowerPC kernel.
The saveretval64 kernel service, as_remap64 kernel service.