Skip to content

Commit

Permalink
syscalls: skip generating mrsh.c if not userspace
Browse files Browse the repository at this point in the history
There is no need to generate all the *_mrsh.c files for
marshalling syscall arguments when userspace is not enabled.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
  • Loading branch information
dcpleung authored and carlescufi committed Mar 11, 2023
1 parent 641b898 commit 751de22
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -735,6 +735,7 @@ add_custom_command(OUTPUT include/generated/syscall_dispatch.c ${syscall_list_h}
--base-output include/generated/syscalls # Write to this dir
--syscall-dispatch include/generated/syscall_dispatch.c # Write this file
--syscall-list ${syscall_list_h}
$<$<BOOL:${CONFIG_USERSPACE}>:--gen-mrsh-files>
${SYSCALL_LONG_REGISTERS_ARG}
${SYSCALL_SPLIT_TIMEOUT_ARG}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
Expand Down
19 changes: 11 additions & 8 deletions scripts/build/gen_syscalls.py
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,8 @@ def parse_args():
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")
parser.add_argument("--gen-mrsh-files", action="store_true",
help="Generate marshalling files (*_mrsh.c)")
args = parser.parse_args()


Expand Down Expand Up @@ -477,14 +479,15 @@ def main():
fp.write(header)

# Likewise emit _mrsh.c files for syscall inclusion
for fn in mrsh_defs:
mrsh_fn = os.path.join(args.base_output, fn + "_mrsh.c")

with open(mrsh_fn, "w") as fp:
fp.write("/* auto-generated by gen_syscalls.py, don't edit */\n\n")
fp.write(mrsh_includes[fn] + "\n")
fp.write("\n")
fp.write(mrsh_defs[fn] + "\n")
if args.gen_mrsh_files:
for fn in mrsh_defs:
mrsh_fn = os.path.join(args.base_output, fn + "_mrsh.c")

with open(mrsh_fn, "w") as fp:
fp.write("/* auto-generated by gen_syscalls.py, don't edit */\n\n")
fp.write(mrsh_includes[fn] + "\n")
fp.write("\n")
fp.write(mrsh_defs[fn] + "\n")

if __name__ == "__main__":
main()

0 comments on commit 751de22

Please sign in to comment.