aboutsummaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorDzmitry <dmitryya@users.noreply.github.com>2022-08-17 08:53:29 -0700
committerGitHub <noreply@github.com>2022-08-17 08:53:29 -0700
commit22b60cea14f9d1f28343f40a3f95b6995e60e80d (patch)
tree8ae5b7585ddd45f9b031053dfd02618c0870abb8 /sys
parent4e72d2292433cbeb93ba348a9e31a9a59d322441 (diff)
Update clock, resource and smc system calls (#3316)
* sys/fuchsia: add clock system calls Renames time.txt to clock.txt Updates `zx_clock_read` and adds new ones: `zx_clock_get_details` and `zx_clock_update` * sys/fuchsia: add the resource system call * sys/fuchsia: add the smc system call
Diffstat (limited to 'sys')
-rw-r--r--sys/fuchsia/clock.txt54
-rw-r--r--sys/fuchsia/resource.txt5
-rw-r--r--sys/fuchsia/smc.txt30
-rw-r--r--sys/fuchsia/time.txt16
4 files changed, 87 insertions, 18 deletions
diff --git a/sys/fuchsia/clock.txt b/sys/fuchsia/clock.txt
new file mode 100644
index 000000000..4bdc0d34e
--- /dev/null
+++ b/sys/fuchsia/clock.txt
@@ -0,0 +1,54 @@
+# 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/clock.h>
+
+resource zx_time[int64]: 0, ZX_TIME_INFINITE
+
+zx_clock_get_monotonic() (ignore_return)
+zx_clock_get_monotonic_via_kernel() (ignore_return)
+zx_clock_create(option flags[clock_create_opt], args ptr[in, zx_clock_create_args_v1], out ptr[out, zx_handle])
+zx_clock_read(handle zx_handle, now ptr[out, intptr]) (ignore_return)
+zx_clock_get_details(handle zx_handle, option const[0x400000000000000], details ptr[out, zx_clock_details_v1])
+zx_clock_update(handle zx_handle, option flags[clock_update_opt], args ptr[in, zx_clock_update_args_v2])
+
+clock_create_opt = ZX_CLOCK_OPT_MONOTONIC, ZX_CLOCK_OPT_CONTINUOUS, ZX_CLOCK_OPT_AUTO_START
+clock_update_opt = 0x800000000000000, ZX_CLOCK_UPDATE_OPTION_SYNTHETIC_VALUE_VALID, ZX_CLOCK_UPDATE_OPTION_REFERENCE_VALUE_VALID, ZX_CLOCK_UPDATE_OPTION_RATE_ADJUST_VALID, ZX_CLOCK_UPDATE_OPTION_ERROR_BOUND_VALID
+
+zx_clock_update_args_v2 {
+ rate_adjust int32
+ padding int32
+ synthetic_value int64
+ reference_value int64
+ error_bound int64
+}
+
+zx_clock_create_args_v1 {
+ backstop_time zx_time
+}
+
+zx_clock_rate {
+ synthetic_ticks int32
+ reference_ticks int32
+}
+
+zx_clock_transformation {
+ reference_offset int64
+ synthetic_offset int64
+ rate zx_clock_rate
+}
+
+zx_clock_details_v1 {
+ options int64
+ backstop_time zx_time
+ ticks_to_synthetic zx_clock_transformation
+ mono_to_synthetic zx_clock_transformation
+ error_bound int64
+ query_ticks int64
+ last_value_update_ticks int64
+ last_rate_adjust_update_ticks int64
+ last_error_bounds_update_ticks int64
+ generation_counter int32
+ padding1 int32
+}
diff --git a/sys/fuchsia/resource.txt b/sys/fuchsia/resource.txt
index c59e69d6b..fe2d5a511 100644
--- a/sys/fuchsia/resource.txt
+++ b/sys/fuchsia/resource.txt
@@ -4,9 +4,10 @@
# See https://cs.opensource.google/fuchsia/fuchsia/+/main:zircon/vdso/resource.fidl
include <zircon/syscalls.h>
+include <zircon/syscalls/resource.h>
resource zx_resource[zx_handle]
-zx_resource_create(parent_rsrc zx_handle, options int32, base int64, size int64, name ptr[in, int8], name_size len[name], resource_out ptr[out, zx_resource])
+zx_resource_create(parent_rsrc zx_handle, options flags[res_create_options], base int64, size int64, name ptr[in, array[int8]], name_size len[name], resource_out ptr[out, zx_resource])
-# TODO: The rest of the resource.fidl calls
+res_create_options = ZX_RSRC_KIND_MMIO, ZX_RSRC_KIND_IRQ, ZX_RSRC_KIND_IOPORT, ZX_RSRC_KIND_ROOT, ZX_RSRC_KIND_HYPERVISOR, ZX_RSRC_KIND_VMEX, ZX_RSRC_KIND_SMC
diff --git a/sys/fuchsia/smc.txt b/sys/fuchsia/smc.txt
new file mode 100644
index 000000000..a23319845
--- /dev/null
+++ b/sys/fuchsia/smc.txt
@@ -0,0 +1,30 @@
+# 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>
+
+meta arches["arm64"]
+
+zx_smc_call(handle zx_handle, parameters ptr[in, zx_smc_parameters], out_smc_result ptr[out, zx_smc_result])
+
+zx_smc_parameters {
+ func int32
+ padding1 int32
+ arg1 int64
+ arg2 int64
+ arg3 int64
+ arg4 int64
+ arg5 int64
+ arg6 int64
+ client_id int16
+ secure_os_id int16
+ padding2 int32
+}
+
+zx_smc_result {
+ arg0 int64
+ arg1 int64
+ arg2 int64
+ arg3 int64
+ arg6 int64
+}
diff --git a/sys/fuchsia/time.txt b/sys/fuchsia/time.txt
deleted file mode 100644
index 158891fb7..000000000
--- a/sys/fuchsia/time.txt
+++ /dev/null
@@ -1,16 +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>
-
-resource zx_time[int64]: 0, ZX_TIME_INFINITE
-
-zx_clock_read(clock_id flags[clock_id], zx_time ptr[out, intptr]) (ignore_return)
-zx_clock_get_monotonic() (ignore_return)
-
-# TODO: undocumented
-# zx_clock_adjust?
-
-syz_future_time(when intptr[0:1]) zx_time
-
-clock_id = ZX_CLOCK_MONOTONIC, ZX_CLOCK_UTC, ZX_CLOCK_THREAD