tree: 89dcdf36e64961e3754e4a9fe11505ff6e94e58d [path history] [tgz]
  1. BUILD.gn
  2. OWNERS
  3. README.md
  4. alias_workaround.cc
  5. alias_workaround.h
  6. alias_workaround_test.cc
  7. asm_output.cc
  8. asm_output_test.cc
  9. category_output.cc
  10. category_output_test.cc
  11. fidl_to_h.py
  12. go_syscalls_output.cc
  13. go_syscalls_output_test.cc
  14. gotest
  15. json_output.cc
  16. json_output_test.cc
  17. kernel_branches_output.cc
  18. kernel_branches_output_test.cc
  19. kernel_header_output.cc
  20. kernel_header_output_test.cc
  21. kernel_wrappers_output.cc
  22. kernel_wrappers_output_test.cc
  23. ktrace_output.cc
  24. ktrace_output_test.cc
  25. macros.h
  26. main.cc
  27. output_util.cc
  28. output_util.h
  29. output_util_test.cc
  30. outputs.h
  31. runtests
  32. rust_output.cc
  33. rust_output_test.cc
  34. string_util.cc
  35. string_util.h
  36. string_util_test.cc
  37. syscall_library.cc
  38. syscall_library.h
  39. syscall_library_test.cc
  40. syscall_numbers_output.cc
  41. syscall_numbers_output_test.cc
  42. test.h
  43. test_aliases.test.fidl
  44. test_kernel_cases.test.fidl
  45. test_kernelwrappers.test.fidl
  46. test_main.cc
  47. test_no_methods.test.fidl
  48. test_one_protocol_one_method.test.fidl
  49. test_one_protocol_two_methods.test.fidl
  50. test_one_protocol_two_methods_with_internal.test.fidl
  51. test_out_voidptr.test.fidl
  52. test_pointers_and_vectors.test.fidl
  53. test_rights_specs.test.fidl
  54. test_rust_selection.test.fidl
  55. test_selection.test.fidl
  56. test_various_categories.test.fidl
  57. test_vdsowrappers.test.fidl
  58. user_header_output.cc
  59. user_header_output_test.cc
  60. vdso_header_output.cc
  61. vdso_header_output_test.cc
  62. vdso_wrappers_output.cc
  63. vdso_wrappers_output_test.cc
  64. writer.cc
  65. writer.h
  66. writer_test.cc
zircon/tools/kazoo/README.md

Kazoo: Backend for fidlc for syscall definitions

Summary

kazoo is a host-side tool that operates as a backend for fidlc. In particular, Kazoo is used to process the definitions of kernel syscalls, and output various formats used by the kernel, user space, and other tools. See kazoo -h for a complete list of the output formats.

fidlc is run first to parse and interpret .fidl files, and it outputs a JSON IR representation. kazoo then processes the JSON IR.

FIDL syntax

In order to use the base FIDL syntax to express syscalls, some experimental syntax and style extensions are used. A possibly-incomplete outline of these as compared with standard FIDL syntax includes:

  • The attribute [Transport="Syscall"] must be applied to all protocols that are part of the syscall interface.

  • All .fidl files must be part of library zz or library zx. “zx” is currently used by FIDL-proper to magically define the existing defintions of some basic types, e.g. zx.status that are used by other FIDL files. Because of this “zz” is used for the new syscall definitions. In the future, Kazoo will accept only library zx, and the automatically generated “zx” and the syscalls in “zz” will be merged into “zx” that will all appear in source .fidl files.

  • Type aliases used to impart meaning. alias_workarounds.fidl includes various aliases that expand to something similar to the correct type, however Kazoo treats these specially. For example, mutable_string is used to indicate that the type is a string, but that should be treated as mutable (generally for a string that's both input and output).

  • Doc comments of the form /// Rights: ... are used by the Kazoo JSON generator, and are propagated to the documentation update script.

  • Attributes of the form [vdsocall], [const], etc. correspond to the previous similar definitions in abigen.

  • Some structs are defined in the current .fidl files, however, they're not used to generate the real Zircon headers yet. Similarly for enums, bits, etc. Only protocols are used to define the function syscall interface.

Testing

There are unittests in kazoo-test which are in the source tree next to the rest of the implementation.

These can be run using ./runtests which will also run fidlc and kazoo and generate all the outputs into /tmp for inspection. It should be run with a cwd of //zircon/tools/kazoo as ./runtests.