[kazoo][syscalls] Regenerate src/runtime and src/syscall/zx

Add helper script to run kazoo on fidl syscall definitions, as well as
running it.

There's a variety of changes here because kazoo does not contain an
allowlist of syscalls to expose to Go, rather choosing to expose all of
them as is done in other languages. This makes the diff unfortunately
difficult review. However! I wrote a script to diff func-by-func:

- First, all functions that are in the old bindings are in the new ones.
The following functions signature changed (to match either names or
arguments as described by the current syscall bindings -- I believe
these just hadn't been updated by mkfuchsia.vdso recently.)

  vdsoCall_zx_bti_pin(handle uint32, options uint32, vmo uint32, offset uint64, size uint64, addrs unsafe.Pointer, addrs_count uint, pmt unsafe.Pointer) int32
  vdsoCall_zx_debug_read(handle uint32, buffer unsafe.Pointer, buffer_size unsafe.Pointer) int32
  vdsoCall_zx_fifo_read(handle uint32, elem_size uint, data unsafe.Pointer, count uint, actual_count unsafe.Pointer) int32
  vdsoCall_zx_job_set_policy(handle uint32, options uint32, topic uint32, policy unsafe.Pointer, count uint32) int32
  vdsoCall_zx_object_wait_many(items unsafe.Pointer, count uint, deadline int64) int32

- These functions were removed, as they no longer exist (again, just out
of date bindings):

  vdsoCall_zx_task_bind_exception_port(handle uint32, port uint32, key uint64, options uint32) int32
  vdsoCall_zx_task_resume_from_exception(handle uint32, port uint32, options uint32) int32'

- These functions were added (presumably this shouldn't be problematic,
and now Go has access to the same things other languages do):

  vdsoCall_zx_clock_create(options uint64, args unsafe.Pointer, out unsafe.Pointer) int32
  vdsoCall_zx_clock_get_details(handle uint32, options uint64, details unsafe.Pointer) int32
  vdsoCall_zx_clock_get_monotonic_via_kernel() int64
  vdsoCall_zx_clock_read(handle uint32, now unsafe.Pointer) int32
  vdsoCall_zx_clock_update(handle uint32, options uint64, args unsafe.Pointer) int32
  vdsoCall_zx_guest_create(resource uint32, options uint32, guest_handle unsafe.Pointer, vmar_handle unsafe.Pointer) int32
  vdsoCall_zx_guest_set_trap(handle uint32, kind uint32, addr uintptr, size uint, port_handle uint32, key uint64) int32
  vdsoCall_zx_ioports_release(resource uint32, io_addr uint16, len uint32) int32
  vdsoCall_zx_pci_add_subtract_io_range(handle uint32, mmio bool, base uint64, len uint64, add bool) int32
  vdsoCall_zx_pci_cfg_pio_rw(handle uint32, bus uint8, dev uint8, funk uint8, offset uint8, val unsafe.Pointer, width uint, write bool) int32
  vdsoCall_zx_pci_config_read(handle uint32, offset uint16, width uint, out_val unsafe.Pointer) int32
  vdsoCall_zx_pci_config_write(handle uint32, offset uint16, width uint, val uint32) int32
  vdsoCall_zx_pci_enable_bus_master(handle uint32, enable bool) int32
  vdsoCall_zx_pci_get_bar(handle uint32, bar_num uint32, out_bar unsafe.Pointer, out_handle unsafe.Pointer) int32
  vdsoCall_zx_pci_get_nth_device(handle uint32, index uint32, out_info unsafe.Pointer, out_handle unsafe.Pointer) int32
  vdsoCall_zx_pci_init(handle uint32, init_buf unsafe.Pointer, len uint32) int32
  vdsoCall_zx_pci_map_interrupt(handle uint32, which_irq int32, out_handle unsafe.Pointer) int32
  vdsoCall_zx_pci_query_irq_mode(handle uint32, mode uint32, out_max_irqs unsafe.Pointer) int32
  vdsoCall_zx_pci_reset_device(handle uint32) int32
  vdsoCall_zx_pci_set_irq_mode(handle uint32, mode uint32, requested_irq_count uint32) int32
  vdsoCall_zx_syscall_test_0() int32
  vdsoCall_zx_syscall_test_1(a int32) int32
  vdsoCall_zx_syscall_test_2(a int32, b int32) int32
  vdsoCall_zx_syscall_test_3(a int32, b int32, c int32) int32
  vdsoCall_zx_syscall_test_4(a int32, b int32, c int32, d int32) int32
  vdsoCall_zx_syscall_test_5(a int32, b int32, c int32, d int32, e int32) int32
  vdsoCall_zx_syscall_test_6(a int32, b int32, c int32, d int32, e int32, f int32) int32
  vdsoCall_zx_syscall_test_7(a int32, b int32, c int32, d int32, e int32, f int32, g_ int32) int32
  vdsoCall_zx_syscall_test_8(a int32, b int32, c int32, d int32, e int32, f int32, g_ int32, h int32) int32
  vdsoCall_zx_syscall_test_handle_create(return_value int32, out unsafe.Pointer) int32
  vdsoCall_zx_syscall_test_wrapper(a int32, b int32, c int32) int32
  vdsoCall_zx_ticks_get_via_kernel() int64
  vdsoCall_zx_vcpu_create(guest uint32, options uint32, entry uintptr, out unsafe.Pointer) int32
  vdsoCall_zx_vcpu_interrupt(handle uint32, vector uint32) int32
  vdsoCall_zx_vcpu_read_state(handle uint32, kind uint32, buffer unsafe.Pointer, buffer_size uint) int32
  vdsoCall_zx_vcpu_resume(handle uint32, packet unsafe.Pointer) int32
  vdsoCall_zx_vcpu_write_state(handle uint32, kind uint32, buffer unsafe.Pointer, buffer_size uint) int32
  vdsoCall_zx_vmar_op_range(handle uint32, op uint32, address uint64, size uint64, buffer unsafe.Pointer, buffer_size uint) int32'])

- The following functions changed and became "blocking", calling
entersyscall() and exitsyscall() around the actual syscall branch.

  vdsoCall_zx_vmo_read(handle uint32, buffer unsafe.Pointer, offset uint64, buffer_size uint) int32
  vdsoCall_zx_vmo_write(handle uint32, buffer unsafe.Pointer, offset uint64, buffer_size uint) int32
  vdsoCall_zx_interrupt_wait(handle uint32, out_timestamp unsafe.Pointer) int32
  vdsoCall_zx_vmo_op_range(handle uint32, op uint32, offset uint64, size uint64, buffer unsafe.Pointer, buffer_size uint) int32

- The following two functions were quite troublesome! They should be
"blocking", but making them so hangs the runtime. So kazoo currently
special cases these (see
https://fuchsia-review.googlesource.com/c/fuchsia/+/344608) to make them
not call entersyscall() and exitsyscall() even though the definition
says they should. I unfortunately do not have a full explanation for
this.

  vdsoCall_zx_futex_wait(value_ptr unsafe.Pointer, current_value int32, new_futex_owner uint32, deadline int64) int32
  vdsoCall_zx_nanosleep(deadline int64) int32

This change does not yet remove mkfuchsiavdso.go, mkfuchsia.go, or the abigen
parsing library, that can be done in a followup once this sticks.

Bug: 39918
Change-Id: I1fbe3b9017652cca0611b96ae3597340e3c98629
8 files changed
tree: 2a71df3e0fc9d485592125548115d3e01b5da26c
  1. .github/
  2. api/
  3. doc/
  4. lib/
  5. makefuchsia/
  6. makeroot/
  7. meta/
  8. misc/
  9. src/
  10. test/
  11. .gitattributes
  12. .gitignore
  13. AUTHORS
  14. BUILD.gn
  15. CONTRIBUTING.md
  16. CONTRIBUTORS
  17. favicon.ico
  18. LICENSE
  19. PATENTS
  20. README.md
  21. regen-fidl
  22. regen-syscalls
  23. robots.txt
  24. VERSION
README.md

The Go Programming Language

Go is an open source programming language that makes it easy to build simple, reliable, and efficient software.

Gopher image Gopher image by Renee French, licensed under Creative Commons 3.0 Attributions license.

Our canonical Git repository is located at https://go.googlesource.com/go. There is a mirror of the repository at https://github.com/golang/go.

Unless otherwise noted, the Go source files are distributed under the BSD-style license found in the LICENSE file.

Download and Install

Binary Distributions

Official binary distributions are available at https://golang.org/dl/.

After downloading a binary release, visit https://golang.org/doc/install or load doc/install.html in your web browser for installation instructions.

Install From Source

If a binary distribution is not available for your combination of operating system and architecture, visit https://golang.org/doc/install/source or load doc/install-source.html in your web browser for source installation instructions.

Contributing

Go is the work of thousands of contributors. We appreciate your help!

To contribute, please read the contribution guidelines: https://golang.org/doc/contribute.html

Note that the Go project uses the issue tracker for bug reports and proposals only. See https://golang.org/wiki/Questions for a list of places to ask questions about the Go language.