diff options
| author | Laura Peskin <pesk@google.com> | 2022-11-02 14:45:03 -0700 |
|---|---|---|
| committer | Chris Palmer <snackypants@gmail.com> | 2022-11-03 10:45:57 -0700 |
| commit | e01d28e04a1df2179ae9005678f5210c61fd5596 (patch) | |
| tree | fd994743b85650f6f92117f5e825db94e0a8845c /sys | |
| parent | 16bf04fa63b3b02c6b04741e2ac2284d839a3b10 (diff) | |
sys/fuchsia: update system syscall definitions
- `zx_system_get_version` is deprecated in favor of
`zx_system_get_version_string`.
- ARM-only feature options are replaced with cross-
arch options.
- All syscalls from `system.fidl` are now defined in
`system.txt`.
Diffstat (limited to 'sys')
| -rw-r--r-- | sys/fuchsia/sys.txt | 9 | ||||
| -rw-r--r-- | sys/fuchsia/system.txt | 56 | ||||
| -rw-r--r-- | sys/fuchsia/system_amd64.const | 21 | ||||
| -rw-r--r-- | sys/fuchsia/system_arm64.const | 19 |
4 files changed, 96 insertions, 9 deletions
diff --git a/sys/fuchsia/sys.txt b/sys/fuchsia/sys.txt index add2f4dfa..b2bbd4cbc 100644 --- a/sys/fuchsia/sys.txt +++ b/sys/fuchsia/sys.txt @@ -21,14 +21,5 @@ syz_thread_self() zx_thread syz_vmar_root_self() zx_vmar syz_job_default() zx_job -# TODO: the get_system_features_options flags are only valid on ARM; -# find a way to make syzkaller generate ARM-specific code -# zx_system_features(kind int32, features flags[get_system_features_options]) -zx_system_get_num_cpus() -zx_system_get_physmem() -zx_system_get_version(version ptr[out, array[int8]], version_len len[version]) - zx_cprng_draw(buffer ptr[out, array[int8]], len len[buffer]) zx_cprng_add_entropy(buffer ptr[in, array[int8]], len len[buffer]) - -# get_system_features_options = ZX_ARM_64_ISA_FP, ZX_ARM64_FEATURE_ASIMD, ZX_ARM64_FEATURE_ISA_AES, ZX_ARM64_FEATURE_ISA_PMULL, ZX_ARM64_FEATURE_ISA_SHA1, ZX_ARM64_FEATURE_ISA_SHA2, ZX_ARM64_FEATURE_ISA_CRC32, ZX_ARM64_FEATURE_ISA_ATOMICS, ZX_ARM64_FEATURE_ISA_RDM, ZX_ARM64_FEATURE_ISA_SHA3, ZX_ARM64_FEATURE_ISA_SM3, ZX_ARM64_FEATURE_ISA_SM4, ZX_ARM64_FEATURE_ISA_DP, ZX_ARM64_FEATURE_ISA_DPB diff --git a/sys/fuchsia/system.txt b/sys/fuchsia/system.txt new file mode 100644 index 000000000..f5358829e --- /dev/null +++ b/sys/fuchsia/system.txt @@ -0,0 +1,56 @@ +# 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. + +# See https://cs.opensource.google/fuchsia/fuchsia/+/main:zircon/vdso/system.fidl + +include <zircon/syscalls.h> +include <zircon/types.h> + +zx_system_get_dcache_line_size(size ptr[out, int32]) +zx_system_get_num_cpus(count ptr[out, int32]) +zx_system_get_version_string(version ptr[out, zx_system_string_view]) +zx_system_get_page_size(size ptr[out, int32]) +zx_system_get_physmem(physmem ptr[out, int64]) +zx_system_get_features(kind flags[system_feature_opt], features ptr[out, int32]) +zx_system_get_event(root_job zx_job, kind flags[system_event_opt], event ptr[out, zx_handle]) +zx_system_set_performance_info(res zx_resource, topic flags[system_performance_opt], info ptr[in, array[int8]], count int64) +zx_system_get_performance_info(res zx_resource, topic flags[system_performance_opt], count int64, info ptr[out, array[int8]], output_count ptr[out, int64]) +# Soft-reboots the system with a new kernel and bootimage; does not return (disabled for now, probably never viable?) +zx_system_mexec(res zx_resource, kernel_vmo zx_vmo, bootimage_vmo zx_vmo) (disabled) +zx_system_mexec_payload_get(res zx_resource, buffer ptr[out, array[int8, 0:16384]]) +# TODO: add variants with specific flags and their corresponding valid args +zx_system_powerctl(res zx_resource, cmd flags[system_powerctl_opt], arg ptr[in, zx_system_powerctl_arg]) + +# System version string is a 40-char git hash with "git-" prefix and possible <=20-char suffix. +zx_system_string_view { + c_str ptr[out, array[int8, 44:64]] + length len[c_str, int8] +} + +zx_system_acpi_transition_s_state { + target_s_state int8 + sleep_type_a int8 + sleep_type_b int8 +} + +zx_system_acpi_transition_s_state_wrapper { + acpi zx_system_acpi_transition_s_state + padding array[int8, 9] +} + +zx_system_x86_power_limit { + power_limit int32 + time_window int32 + clamp int8 + enable int8 +} + +zx_system_powerctl_arg [ + acpi zx_system_acpi_transition_s_state_wrapper + x86 zx_system_x86_power_limit +] + +system_feature_opt = ZX_FEATURE_KIND_CPU, ZX_FEATURE_KIND_HW_BREAKPOINT_COUNT, ZX_FEATURE_KIND_HW_WATCHPOINT_COUNT, ZX_FEATURE_KIND_ADDRESS_TAGGING, ZX_FEATURE_KIND_VM +system_event_opt = ZX_SYSTEM_EVENT_OUT_OF_MEMORY, ZX_SYSTEM_EVENT_MEMORY_PRESSURE_CRITICAL, ZX_SYSTEM_EVENT_MEMORY_PRESSURE_WARNING, ZX_SYSTEM_EVENT_MEMORY_PRESSURE_NORMAL, ZX_SYSTEM_EVENT_IMMINENT_OUT_OF_MEMORY +system_performance_opt = ZX_CPU_PERF_SCALE, ZX_CPU_DEFAULT_PERF_SCALE +system_powerctl_opt = ZX_SYSTEM_POWERCTL_ENABLE_ALL_CPUS, ZX_SYSTEM_POWERCTL_DISABLE_ALL_CPUS_BUT_PRIMARY, ZX_SYSTEM_POWERCTL_ACPI_TRANSITION_S_STATE, ZX_SYSTEM_POWERCTL_X86_SET_PKG_PL1, ZX_SYSTEM_POWERCTL_REBOOT, ZX_SYSTEM_POWERCTL_REBOOT_BOOTLOADER, ZX_SYSTEM_POWERCTL_REBOOT_RECOVERY, ZX_SYSTEM_POWERCTL_SHUTDOWN, ZX_SYSTEM_POWERCTL_ACK_KERNEL_INITIATED_REBOOT diff --git a/sys/fuchsia/system_amd64.const b/sys/fuchsia/system_amd64.const new file mode 100644 index 000000000..1d5cb99e4 --- /dev/null +++ b/sys/fuchsia/system_amd64.const @@ -0,0 +1,21 @@ +ZX_FEATURE_KIND_HW_BREAKPOINT_COUNT = 1 +ZX_FEATURE_KIND_HW_WATCHPOINT_COUNT = 2 +ZX_FEATURE_KIND_ADDRESS_TAGGING = 3 +ZX_FEATURE_KIND_VM = 4 +ZX_SYSTEM_EVENT_OUT_OF_MEMORY = 1 +ZX_SYSTEM_EVENT_MEMORY_PRESSURE_CRITICAL = 2 +ZX_SYSTEM_EVENT_MEMORY_PRESSURE_WARNING = 3 +ZX_SYSTEM_EVENT_MEMORY_PRESSURE_NORMAL = 4 +ZX_SYSTEM_EVENT_IMMINENT_OUT_OF_MEMORY = 5 +ZX_CPU_PERF_SCALE = 1 +ZX_CPU_DEFAULT_PERF_SCALE = 2 +ZX_FEATURE_KIND_CPU = 0 +ZX_SYSTEM_POWERCTL_ENABLE_ALL_CPUS = 1 +ZX_SYSTEM_POWERCTL_DISABLE_ALL_CPUS_BUT_PRIMARY = 2 +ZX_SYSTEM_POWERCTL_ACPI_TRANSITION_S_STATE = 3 +ZX_SYSTEM_POWERCTL_X86_SET_PKG_PL1 = 4 +ZX_SYSTEM_POWERCTL_REBOOT = 5 +ZX_SYSTEM_POWERCTL_REBOOT_BOOTLOADER = 6 +ZX_SYSTEM_POWERCTL_REBOOT_RECOVERY = 7 +ZX_SYSTEM_POWERCTL_SHUTDOWN = 8 +ZX_SYSTEM_POWERCTL_ACK_KERNEL_INITIATED_REBOOT = 9
\ No newline at end of file diff --git a/sys/fuchsia/system_arm64.const b/sys/fuchsia/system_arm64.const new file mode 100644 index 000000000..4320446a4 --- /dev/null +++ b/sys/fuchsia/system_arm64.const @@ -0,0 +1,19 @@ +ZX_FEATURE_KIND_HW_BREAKPOINT_COUNT = 1 +ZX_FEATURE_KIND_HW_WATCHPOINT_COUNT = 2 +ZX_FEATURE_KIND_ADDRESS_TAGGING = 3 +ZX_FEATURE_KIND_VM = 4 +ZX_SYSTEM_EVENT_OUT_OF_MEMORY = 1 +ZX_SYSTEM_EVENT_MEMORY_PRESSURE_CRITICAL = 2 +ZX_SYSTEM_EVENT_MEMORY_PRESSURE_WARNING = 3 +ZX_SYSTEM_EVENT_MEMORY_PRESSURE_NORMAL = 4 +ZX_SYSTEM_EVENT_IMMINENT_OUT_OF_MEMORY = 5 +ZX_CPU_PERF_SCALE = 1 +ZX_CPU_DEFAULT_PERF_SCALE = 2 +ZX_FEATURE_KIND_CPU = 0 +ZX_SYSTEM_POWERCTL_ENABLE_ALL_CPUS = 1 +ZX_SYSTEM_POWERCTL_DISABLE_ALL_CPUS_BUT_PRIMARY = 2 +ZX_SYSTEM_POWERCTL_REBOOT = 5 +ZX_SYSTEM_POWERCTL_REBOOT_BOOTLOADER = 6 +ZX_SYSTEM_POWERCTL_REBOOT_RECOVERY = 7 +ZX_SYSTEM_POWERCTL_SHUTDOWN = 8 +ZX_SYSTEM_POWERCTL_ACK_KERNEL_INITIATED_REBOOT = 9
\ No newline at end of file |
