diff options
| author | Marco Vanotti <mvanotti@users.noreply.github.com> | 2022-08-31 17:42:58 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-08-31 17:42:58 -0700 |
| commit | b01ec5715e2ae72463124fd42608bcee9b8132b8 (patch) | |
| tree | c9c95bdb3eefaa4789df49610b8660c373c43689 | |
| parent | 51e54e30cbb17bbb9f6d4b522d0f2f2c05d4fb5c (diff) | |
sys/fuchsia: update the port system calls (#3348)
Also adds a test for zx_port_*
Co-authored-by: Aaron Green <aarongreen@google.com>
| -rw-r--r-- | pkg/runtest/run.go | 1 | ||||
| -rw-r--r-- | sys/fuchsia/pc.txt | 2 | ||||
| -rw-r--r-- | sys/fuchsia/port.txt | 66 | ||||
| -rw-r--r-- | sys/fuchsia/port_amd64.const (renamed from sys/fuchsia/ports_amd64.const) | 0 | ||||
| -rw-r--r-- | sys/fuchsia/port_arm64.const (renamed from sys/fuchsia/ports_arm64.const) | 0 | ||||
| -rw-r--r-- | sys/fuchsia/ports.txt | 19 | ||||
| -rw-r--r-- | sys/fuchsia/test/port | 5 |
7 files changed, 73 insertions, 20 deletions
diff --git a/pkg/runtest/run.go b/pkg/runtest/run.go index c040f3481..985c5979c 100644 --- a/pkg/runtest/run.go +++ b/pkg/runtest/run.go @@ -306,6 +306,7 @@ func parseProg(target *prog.Target, dir, filename string) (*prog.Prog, map[strin // Fuchsia specific errors. "ZX_ERR_BAD_HANDLE": 11, + "ZX_ERR_TIMED_OUT": 21, } info := &ipc.ProgInfo{Calls: make([]ipc.CallInfo, len(p.Calls))} for i, call := range p.Calls { diff --git a/sys/fuchsia/pc.txt b/sys/fuchsia/pc.txt index eb984f670..cffa23127 100644 --- a/sys/fuchsia/pc.txt +++ b/sys/fuchsia/pc.txt @@ -7,4 +7,4 @@ include <zircon/types.h> # Never used as output # resource zx_root[zx_handle] -pc_firmware_tables(handle zx_handle, acpi_rsdp ptr[out, int64], smbios ptr[out, int64]) +zx_pc_firmware_tables(handle zx_handle, acpi_rsdp ptr[out, int64], smbios ptr[out, int64]) diff --git a/sys/fuchsia/port.txt b/sys/fuchsia/port.txt new file mode 100644 index 000000000..f6cd7e056 --- /dev/null +++ b/sys/fuchsia/port.txt @@ -0,0 +1,66 @@ +# Copyright 2022 syzkaller project authors. All rights reserved. +# Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file. + +include <zircon/syscalls.h> +include <zircon/syscalls/port.h> + +resource zx_port[zx_handle] + +port_create_options = ZX_PORT_BIND_TO_INTERRUPT, 0 + +zx_port_create(options flags[port_create_options], out ptr[out, zx_port]) +zx_port_cancel(port zx_port, source zx_handle, key proc[1000, 16]) +zx_port_queue(handle zx_port, packet ptr[in, zx_port_packet_user]) +zx_port_wait(handle zx_port, deadline zx_time, packet ptr[out, zx_port_packet]) + +zx_packet_user [ + u64 array[int64, 4] + u32 array[int32, 8] + u16 array[int16, 16] + c8 array[int8, 32] +] + +zx_packet_signal { + trigger int32 + observed int32 + count int64 + timestamp int64 + reserved1 int64 +} + +zx_packet_interrupt { + timestamp int64 + reserved0 int64 + reserved1 int64 + reserved2 int64 +} + +zx_packet_page_request { + command int16 + flags int16 + reserved0 int16 + offset int64 + length int64 + reserved1 int64 +} + +zx_port_packet_payload [ + user zx_packet_user + signal zx_packet_signal + interrupt zx_packet_interrupt + page_request zx_packet_page_request +] + +zx_port_packet { + key int64 + type int32 + status int32 + payload zx_port_packet_payload +} + +zx_port_packet_user { + key proc[1000, 16, int64] + type const[ZX_PKT_TYPE_USER, int32] + status const[0, int32] + payload zx_packet_user +} diff --git a/sys/fuchsia/ports_amd64.const b/sys/fuchsia/port_amd64.const index 726f40535..726f40535 100644 --- a/sys/fuchsia/ports_amd64.const +++ b/sys/fuchsia/port_amd64.const diff --git a/sys/fuchsia/ports_arm64.const b/sys/fuchsia/port_arm64.const index 726f40535..726f40535 100644 --- a/sys/fuchsia/ports_arm64.const +++ b/sys/fuchsia/port_arm64.const diff --git a/sys/fuchsia/ports.txt b/sys/fuchsia/ports.txt deleted file mode 100644 index 969e680d5..000000000 --- a/sys/fuchsia/ports.txt +++ /dev/null @@ -1,19 +0,0 @@ -# Copyright 2017 syzkaller project authors. All rights reserved. -# Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file. - -include <zircon/syscalls.h> -include <zircon/syscalls/port.h> - -resource zx_port[zx_handle] - -zx_port_create(options const[0], out ptr[out, zx_port]) -zx_port_queue(handle zx_port, packet ptr[in, zx_port_packet]) -zx_port_wait(handle zx_port, deadline zx_time, packet ptr[out, zx_port_packet]) -zx_port_cancel(port zx_port, source zx_handle, key proc[1000, 4]) - -zx_port_packet { - key proc[1000, 4, int64] - type const[ZX_PKT_TYPE_USER, int32] - status const[0, int32] - u64 array[int64, 4] -} diff --git a/sys/fuchsia/test/port b/sys/fuchsia/test/port new file mode 100644 index 000000000..8dd2815eb --- /dev/null +++ b/sys/fuchsia/test/port @@ -0,0 +1,5 @@ +zx_port_create(0x0, &AUTO=<r0=>0x0) +zx_port_wait(r0, 0x0, &AUTO) # ZX_ERR_TIMED_OUT +zx_port_queue(r0, &AUTO) +zx_port_wait(r0, 0x0, &AUTO) +zx_handle_close(r0) |
