userspace: don't split args on 64-bit systems
None of the splitting logic is needed if 64-bit return values or parameters fit inside a register. Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
This commit is contained in:
parent
800b35f598
commit
9ff64bb497
2 changed files with 16 additions and 5 deletions
|
@ -583,6 +583,14 @@ add_custom_command(
|
||||||
)
|
)
|
||||||
|
|
||||||
add_custom_target(${SYSCALL_LIST_H_TARGET} DEPENDS ${syscall_list_h})
|
add_custom_target(${SYSCALL_LIST_H_TARGET} DEPENDS ${syscall_list_h})
|
||||||
|
|
||||||
|
# 64-bit systems do not require special handling of 64-bit system call
|
||||||
|
# parameters or return values, indicate this to the system call boilerplate
|
||||||
|
# generation script.
|
||||||
|
if(CONFIG_64BIT)
|
||||||
|
set(SYSCALL_LONG_REGISTERS_ARG --long-registers)
|
||||||
|
endif()
|
||||||
|
|
||||||
add_custom_command(OUTPUT include/generated/syscall_dispatch.c ${syscall_list_h}
|
add_custom_command(OUTPUT include/generated/syscall_dispatch.c ${syscall_list_h}
|
||||||
# Also, some files are written to include/generated/syscalls/
|
# Also, some files are written to include/generated/syscalls/
|
||||||
COMMAND
|
COMMAND
|
||||||
|
@ -592,6 +600,7 @@ add_custom_command(OUTPUT include/generated/syscall_dispatch.c ${syscall_list_h}
|
||||||
--base-output include/generated/syscalls # Write to this dir
|
--base-output include/generated/syscalls # Write to this dir
|
||||||
--syscall-dispatch include/generated/syscall_dispatch.c # Write this file
|
--syscall-dispatch include/generated/syscall_dispatch.c # Write this file
|
||||||
--syscall-list ${syscall_list_h}
|
--syscall-list ${syscall_list_h}
|
||||||
|
${SYSCALL_LONG_REGISTERS_ARG}
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||||
DEPENDS ${syscalls_json}
|
DEPENDS ${syscalls_json}
|
||||||
)
|
)
|
||||||
|
|
|
@ -143,7 +143,7 @@ def typename_split(item):
|
||||||
return (m[0].strip(), m[1])
|
return (m[0].strip(), m[1])
|
||||||
|
|
||||||
def need_split(argtype):
|
def need_split(argtype):
|
||||||
return argtype in types64
|
return (not args.long_registers) and (argtype in types64)
|
||||||
|
|
||||||
# Note: "lo" and "hi" are named in little endian conventions,
|
# Note: "lo" and "hi" are named in little endian conventions,
|
||||||
# but it doesn't matter as long as they are consistently
|
# but it doesn't matter as long as they are consistently
|
||||||
|
@ -152,7 +152,7 @@ def union_decl(type):
|
||||||
return "union { struct { uintptr_t lo, hi; } split; %s val; }" % type
|
return "union { struct { uintptr_t lo, hi; } split; %s val; }" % type
|
||||||
|
|
||||||
def wrapper_defs(func_name, func_type, args):
|
def wrapper_defs(func_name, func_type, args):
|
||||||
ret64 = func_type in types64
|
ret64 = need_split(func_type)
|
||||||
mrsh_args = [] # List of rvalue expressions for the marshalled invocation
|
mrsh_args = [] # List of rvalue expressions for the marshalled invocation
|
||||||
split_args = []
|
split_args = []
|
||||||
nsplit = 0
|
nsplit = 0
|
||||||
|
@ -243,7 +243,7 @@ def marshall_defs(func_name, func_type, args):
|
||||||
nmrsh += 1
|
nmrsh += 1
|
||||||
|
|
||||||
# Final argument for a 64 bit return value?
|
# Final argument for a 64 bit return value?
|
||||||
if func_type in types64:
|
if need_split(func_type):
|
||||||
nmrsh += 1
|
nmrsh += 1
|
||||||
|
|
||||||
decl_arglist = ", ".join([" ".join(argrec) for argrec in args])
|
decl_arglist = ", ".join([" ".join(argrec) for argrec in args])
|
||||||
|
@ -287,7 +287,7 @@ def marshall_defs(func_name, func_type, args):
|
||||||
mrsh += "\t" + "return 0;\n"
|
mrsh += "\t" + "return 0;\n"
|
||||||
else:
|
else:
|
||||||
mrsh += "\t" + "%s ret = %s;\n" % (func_type, vrfy_call)
|
mrsh += "\t" + "%s ret = %s;\n" % (func_type, vrfy_call)
|
||||||
if func_type in types64:
|
if need_split(func_type):
|
||||||
ptr = "((u64_t *)%s)" % mrsh_rval(nmrsh - 1, nmrsh)
|
ptr = "((u64_t *)%s)" % mrsh_rval(nmrsh - 1, nmrsh)
|
||||||
mrsh += "\t" + "Z_OOPS(Z_SYSCALL_MEMORY_WRITE(%s, 8));\n" % ptr
|
mrsh += "\t" + "Z_OOPS(Z_SYSCALL_MEMORY_WRITE(%s, 8));\n" % ptr
|
||||||
mrsh += "\t" + "*%s = ret;\n" % ptr
|
mrsh += "\t" + "*%s = ret;\n" % ptr
|
||||||
|
@ -339,7 +339,9 @@ def parse_args():
|
||||||
parser.add_argument("-o", "--base-output", required=True,
|
parser.add_argument("-o", "--base-output", required=True,
|
||||||
help="Base output directory for syscall macro headers")
|
help="Base output directory for syscall macro headers")
|
||||||
parser.add_argument("-s", "--split-type", action="append",
|
parser.add_argument("-s", "--split-type", action="append",
|
||||||
help="A long type that must be split/marshalled")
|
help="A long type that must be split/marshalled on 32-bit systems")
|
||||||
|
parser.add_argument("-x", "--long-registers", action="store_true",
|
||||||
|
help="Indicates we are on system with 64-bit registers")
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue