diff --git a/Makefile b/Makefile index c334d41a..21a4a8ce 100644 --- a/Makefile +++ b/Makefile @@ -56,11 +56,15 @@ ifeq ("$(TARGETOS)", "fuchsia") export CGO_ENABLED=1 NOSTATIC = 1 ifeq ("$(TARGETARCH)", "amd64") - ADDCFLAGS = --target=x86_64-fuchsia -lfdio -lzircon --sysroot $(SOURCEDIR)/out/build-zircon/build-user-x86-64/sysroot -I $(SOURCEDIR)/out/build-zircon/build-user-x86-64 - export ZIRCON_BUILD_DIR=$(SOURCEDIR)/out/build-zircon/build-user-x86-64 + ADDCFLAGS = --target=x86_64-fuchsia -lfdio -lzircon --sysroot $(SOURCEDIR)/out/build-zircon/build-x64/sysroot + export GOROOT=$(SOURCEDIR)/out/debug-x64/goroot + # Required by the goroot. + export ZIRCON_BUILD_DIR=$(SOURCEDIR)/out/build-zircon/build-x64 else ifeq ("$(TARGETARCH)", "arm64") - ADDCFLAGS = --target=aarch64-fuchsia -lfdio -lzircon --sysroot $(SOURCEDIR)/out/build-zircon/build-user-arm64/sysroot -I $(SOURCEDIR)/out/build-zircon/build-user-arm64 - export ZIRCON_BUILD_DIR=$(SOURCEDIR)/out/build-zircon/build-user-arm64 + ADDCFLAGS = --target=aarch64-fuchsia -lfdio -lzircon --sysroot $(SOURCEDIR)/out/build-zircon/build-arm64/sysroot + export GOROOT=$(SOURCEDIR)/out/debug-arm64/goroot + # Required by the goroot. + export ZIRCON_BUILD_DIR=$(SOURCEDIR)/out/build-zircon/build-arm64 endif endif diff --git a/executor/common_fuchsia.h b/executor/common_fuchsia.h index 608ce91a..1c576219 100644 --- a/executor/common_fuchsia.h +++ b/executor/common_fuchsia.h @@ -55,7 +55,7 @@ static void segv_handler() { if (__atomic_load_n(&skip_segv, __ATOMIC_RELAXED)) { debug("recover: skipping\n"); - _longjmp(segv_env, 1); + longjmp(segv_env, 1); } debug("recover: exiting\n"); doexit(1); @@ -72,7 +72,7 @@ static void* ex_handler(void* arg) continue; } debug("got exception packet: type=%d status=%d tid=%llu\n", - packet.type, packet.status, packet.exception.tid); + packet.type, packet.status, static_cast(packet.exception.tid)); zx_handle_t thread; status = zx_object_get_child(zx_process_self(), packet.exception.tid, ZX_RIGHT_SAME_RIGHTS, &thread); @@ -80,16 +80,21 @@ static void* ex_handler(void* arg) debug("zx_object_get_child failed: %d\n", status); continue; } - uint32 bytes_read; - zx_x86_64_general_regs_t regs; - status = zx_thread_read_state(thread, ZX_THREAD_STATE_REGSET0, - ®s, sizeof(regs), &bytes_read); - if (status != ZX_OK || bytes_read != sizeof(regs)) { - debug("zx_thread_read_state failed: %d/%d (%d)\n", - bytes_read, (int)sizeof(regs), status); + zx_thread_state_general_regs_t regs; + status = zx_thread_read_state(thread, ZX_THREAD_STATE_GENERAL_REGS, + ®s, sizeof(regs)); + if (status != ZX_OK) { + debug("zx_thread_read_state failed: %d (%d)\n", + (int)sizeof(regs), status); } else { +#if defined(__x86_64__) regs.rip = (uint64)(void*)&segv_handler; - status = zx_thread_write_state(thread, ZX_THREAD_STATE_REGSET0, ®s, sizeof(regs)); +#elif defined(__aarch64__) + regs.pc = (uint64)(void*)&segv_handler; +#else +#error "unsupported arch" +#endif + status = zx_thread_write_state(thread, ZX_THREAD_STATE_GENERAL_REGS, ®s, sizeof(regs)); if (status != ZX_OK) debug("zx_thread_write_state failed: %d\n", status); } @@ -118,7 +123,7 @@ static void install_segv_handler() #define NONFAILING(...) \ { \ __atomic_fetch_add(&skip_segv, 1, __ATOMIC_SEQ_CST); \ - if (_setjmp(segv_env) == 0) { \ + if (sigsetjmp(segv_env, 0) == 0) { \ __VA_ARGS__; \ } \ __atomic_fetch_sub(&skip_segv, 1, __ATOMIC_SEQ_CST); \ @@ -216,26 +221,7 @@ long syz_future_time(long when) default: delta_ms = 10000; } - zx_time_t now = zx_time_get(ZX_CLOCK_MONOTONIC); + zx_time_t now = zx_clock_get(ZX_CLOCK_MONOTONIC); return now + delta_ms * 1000 * 1000; } #endif - -#if defined(SYZ_EXECUTOR) || defined(__NR_zx_channel_call_finish) || defined(zx_channel_call_noretry) -#include "kernel/lib/vdso/vdso-code.h" -#define UNEXPORTED(name) ((syscall_t)((long)&zx_handle_close - VDSO_SYSCALL_zx_handle_close + VDSO_SYSCALL_##name)) -#endif - -#if defined(SYZ_EXECUTOR) || defined(__NR_zx_channel_call_finish) -zx_status_t zx_channel_call_finish(long a0, long a1, long a2, long a3, long a4, long a5, long a6, long a7, long a8) -{ - return UNEXPORTED(zx_channel_call_finish)(a0, a1, a2, a3, a4, a5, a6, a7, a8); -} -#endif - -#if defined(SYZ_EXECUTOR) || defined(__NR_zx_channel_call_noretry) -zx_status_t zx_channel_call_noretry(long a0, long a1, long a2, long a3, long a4, long a5, long a6, long a7, long a8) -{ - return UNEXPORTED(zx_channel_call_noretry)(a0, a1, a2, a3, a4, a5, a6, a7, a8); -} -#endif diff --git a/executor/syscalls_fuchsia.h b/executor/syscalls_fuchsia.h index c7c7448c..0da680b0 100644 --- a/executor/syscalls_fuchsia.h +++ b/executor/syscalls_fuchsia.h @@ -2,11 +2,11 @@ #if defined(__x86_64__) || 0 #define GOARCH "amd64" -#define SYZ_REVISION "7b78fbcff5be58d55fce6250972288b9c5141689" +#define SYZ_REVISION "9bdbf38bbd8f8ae5ac1db5c26f4309fd7cab884b" #define SYZ_PAGE_SIZE 4096 #define SYZ_NUM_PAGES 4096 #define SYZ_DATA_OFFSET 536870912 -unsigned syscall_count = 164; +unsigned syscall_count = 159; call_t syscalls[] = { {"chdir", 0, (syscall_t)chdir}, {"chmod", 0, (syscall_t)chmod}, @@ -17,17 +17,14 @@ call_t syscalls[] = { {"dup2", 0, (syscall_t)dup2}, {"dup3", 0, (syscall_t)dup3}, {"faccessat", 0, (syscall_t)faccessat}, - {"fchdir", 0, (syscall_t)fchdir}, {"fchmod", 0, (syscall_t)fchmod}, {"fchmodat", 0, (syscall_t)fchmodat}, {"fchown", 0, (syscall_t)fchown}, {"fchownat", 0, (syscall_t)fchownat}, {"fdatasync", 0, (syscall_t)fdatasync}, - {"flock", 0, (syscall_t)flock}, {"fstat", 0, (syscall_t)fstat}, {"fsync", 0, (syscall_t)fsync}, {"ftruncate", 0, (syscall_t)ftruncate}, - {"futimesat", 0, (syscall_t)futimesat}, {"getcwd", 0, (syscall_t)getcwd}, {"getgid", 0, (syscall_t)getgid}, {"getpid", 0, (syscall_t)getpid}, @@ -72,11 +69,10 @@ call_t syscalls[] = { {"write", 0, (syscall_t)write}, {"writev", 0, (syscall_t)writev}, {"zx_channel_call", 0, (syscall_t)zx_channel_call}, - {"zx_channel_call_finish", 0, (syscall_t)zx_channel_call_finish}, - {"zx_channel_call_noretry", 0, (syscall_t)zx_channel_call_noretry}, {"zx_channel_create", 0, (syscall_t)zx_channel_create}, {"zx_channel_read", 0, (syscall_t)zx_channel_read}, {"zx_channel_write", 0, (syscall_t)zx_channel_write}, + {"zx_clock_get", 0, (syscall_t)zx_clock_get}, {"zx_cprng_add_entropy", 0, (syscall_t)zx_cprng_add_entropy}, {"zx_cprng_draw", 0, (syscall_t)zx_cprng_draw}, {"zx_event_create", 0, (syscall_t)zx_event_create}, @@ -148,7 +144,6 @@ call_t syscalls[] = { {"zx_thread_write_state$0", 0, (syscall_t)zx_thread_write_state}, {"zx_ticks_get", 0, (syscall_t)zx_ticks_get}, {"zx_ticks_per_second", 0, (syscall_t)zx_ticks_per_second}, - {"zx_time_get", 0, (syscall_t)zx_time_get}, {"zx_timer_cancel", 0, (syscall_t)zx_timer_cancel}, {"zx_timer_create", 0, (syscall_t)zx_timer_create}, {"zx_timer_set", 0, (syscall_t)zx_timer_set}, @@ -178,11 +173,11 @@ call_t syscalls[] = { #if defined(__aarch64__) || 0 #define GOARCH "arm64" -#define SYZ_REVISION "545421122ef05f52e8f98342789ed868018b192b" +#define SYZ_REVISION "ebd125b38ce1b3617ba0e9db31c2becdb3213fc2" #define SYZ_PAGE_SIZE 4096 #define SYZ_NUM_PAGES 4096 #define SYZ_DATA_OFFSET 536870912 -unsigned syscall_count = 164; +unsigned syscall_count = 159; call_t syscalls[] = { {"chdir", 0, (syscall_t)chdir}, {"chmod", 0, (syscall_t)chmod}, @@ -193,17 +188,14 @@ call_t syscalls[] = { {"dup2", 0, (syscall_t)dup2}, {"dup3", 0, (syscall_t)dup3}, {"faccessat", 0, (syscall_t)faccessat}, - {"fchdir", 0, (syscall_t)fchdir}, {"fchmod", 0, (syscall_t)fchmod}, {"fchmodat", 0, (syscall_t)fchmodat}, {"fchown", 0, (syscall_t)fchown}, {"fchownat", 0, (syscall_t)fchownat}, {"fdatasync", 0, (syscall_t)fdatasync}, - {"flock", 0, (syscall_t)flock}, {"fstat", 0, (syscall_t)fstat}, {"fsync", 0, (syscall_t)fsync}, {"ftruncate", 0, (syscall_t)ftruncate}, - {"futimesat", 0, (syscall_t)futimesat}, {"getcwd", 0, (syscall_t)getcwd}, {"getgid", 0, (syscall_t)getgid}, {"getpid", 0, (syscall_t)getpid}, @@ -248,11 +240,10 @@ call_t syscalls[] = { {"write", 0, (syscall_t)write}, {"writev", 0, (syscall_t)writev}, {"zx_channel_call", 0, (syscall_t)zx_channel_call}, - {"zx_channel_call_finish", 0, (syscall_t)zx_channel_call_finish}, - {"zx_channel_call_noretry", 0, (syscall_t)zx_channel_call_noretry}, {"zx_channel_create", 0, (syscall_t)zx_channel_create}, {"zx_channel_read", 0, (syscall_t)zx_channel_read}, {"zx_channel_write", 0, (syscall_t)zx_channel_write}, + {"zx_clock_get", 0, (syscall_t)zx_clock_get}, {"zx_cprng_add_entropy", 0, (syscall_t)zx_cprng_add_entropy}, {"zx_cprng_draw", 0, (syscall_t)zx_cprng_draw}, {"zx_event_create", 0, (syscall_t)zx_event_create}, @@ -324,7 +315,6 @@ call_t syscalls[] = { {"zx_thread_write_state$0", 0, (syscall_t)zx_thread_write_state}, {"zx_ticks_get", 0, (syscall_t)zx_ticks_get}, {"zx_ticks_per_second", 0, (syscall_t)zx_ticks_per_second}, - {"zx_time_get", 0, (syscall_t)zx_time_get}, {"zx_timer_cancel", 0, (syscall_t)zx_timer_cancel}, {"zx_timer_create", 0, (syscall_t)zx_timer_create}, {"zx_timer_set", 0, (syscall_t)zx_timer_set}, diff --git a/sys/fuchsia/amd64.go b/sys/fuchsia/amd64.go index 7ea106ec..3749c1f0 100644 --- a/sys/fuchsia/amd64.go +++ b/sys/fuchsia/amd64.go @@ -265,9 +265,6 @@ var syscalls_amd64 = []*Syscall{ &FlagsType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "open_mode", FldName: "mode", TypeSize: 8}}, Vals: []uint64{256, 128, 64, 32, 16, 8, 4, 2, 1}}, &FlagsType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "faccessat_flags", FldName: "flags", TypeSize: 8}}, Vals: []uint64{256, 512, 1024, 2048, 4096}}, }}, - {Name: "fchdir", CallName: "fchdir", Args: []Type{ - &ResourceType{TypeCommon: TypeCommon{TypeName: "fd", FldName: "fd", TypeSize: 4}}, - }}, {Name: "fchmod", CallName: "fchmod", Args: []Type{ &ResourceType{TypeCommon: TypeCommon{TypeName: "fd", FldName: "fd", TypeSize: 4}}, &FlagsType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "open_mode", FldName: "mode", TypeSize: 8}}, Vals: []uint64{256, 128, 64, 32, 16, 8, 4, 2, 1}}, @@ -292,10 +289,6 @@ var syscalls_amd64 = []*Syscall{ {Name: "fdatasync", CallName: "fdatasync", Args: []Type{ &ResourceType{TypeCommon: TypeCommon{TypeName: "fd", FldName: "fd", TypeSize: 4}}, }}, - {Name: "flock", CallName: "flock", Args: []Type{ - &ResourceType{TypeCommon: TypeCommon{TypeName: "fd", FldName: "fd", TypeSize: 4}}, - &FlagsType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "flock_op", FldName: "op", TypeSize: 8}}, Vals: []uint64{1, 2, 8, 4}}, - }}, {Name: "fstat", CallName: "fstat", Args: []Type{ &ResourceType{TypeCommon: TypeCommon{TypeName: "fd", FldName: "fd", TypeSize: 4}}, &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "statbuf", TypeSize: 8}, Type: &BufferType{TypeCommon: TypeCommon{TypeName: "array", ArgDir: 1, IsVarlen: true}}}, @@ -307,11 +300,6 @@ var syscalls_amd64 = []*Syscall{ &ResourceType{TypeCommon: TypeCommon{TypeName: "fd", FldName: "fd", TypeSize: 4}}, &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "intptr", FldName: "len", TypeSize: 8}}}, }}, - {Name: "futimesat", CallName: "futimesat", Args: []Type{ - &ResourceType{TypeCommon: TypeCommon{TypeName: "fd", FldName: "dir", TypeSize: 4}}, - &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "pathname", TypeSize: 8}, Type: &BufferType{TypeCommon: TypeCommon{TypeName: "filename", IsVarlen: true}, Kind: 3}}, - &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "times", TypeSize: 8}, Type: &StructType{Key: StructKey{Name: "itimerval"}}}, - }}, {Name: "getcwd", CallName: "getcwd", Args: []Type{ &PtrType{TypeCommon: TypeCommon{TypeName: "buffer", FldName: "buf", TypeSize: 8}, Type: &BufferType{TypeCommon: TypeCommon{ArgDir: 1, IsVarlen: true}}}, &LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "len", FldName: "size", TypeSize: 8}}, Buf: "buf"}, @@ -499,22 +487,6 @@ var syscalls_amd64 = []*Syscall{ &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "actual_handles", TypeSize: 8}, Type: &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", TypeSize: 4, ArgDir: 1}}}}, &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "read_status", TypeSize: 8}, Type: &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", TypeSize: 4, ArgDir: 1}}}}, }}, - {Name: "zx_channel_call_finish", CallName: "zx_channel_call_finish", Args: []Type{ - &ResourceType{TypeCommon: TypeCommon{TypeName: "zx_time", FldName: "deadline", TypeSize: 8}}, - &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "args", TypeSize: 8}, Type: &StructType{Key: StructKey{Name: "zx_channel_call_args"}}}, - &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "actual_bytes", TypeSize: 8}, Type: &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", TypeSize: 4, ArgDir: 1}}}}, - &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "actual_handles", TypeSize: 8}, Type: &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", TypeSize: 4, ArgDir: 1}}}}, - &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "read_status", TypeSize: 8}, Type: &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", TypeSize: 4, ArgDir: 1}}}}, - }}, - {Name: "zx_channel_call_noretry", CallName: "zx_channel_call_noretry", Args: []Type{ - &ResourceType{TypeCommon: TypeCommon{TypeName: "zx_chan", FldName: "handle", TypeSize: 4}}, - &ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "options", TypeSize: 8}}}, - &ResourceType{TypeCommon: TypeCommon{TypeName: "zx_time", FldName: "deadline", TypeSize: 8}}, - &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "args", TypeSize: 8}, Type: &StructType{Key: StructKey{Name: "zx_channel_call_args"}}}, - &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "actual_bytes", TypeSize: 8}, Type: &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", TypeSize: 4, ArgDir: 1}}}}, - &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "actual_handles", TypeSize: 8}, Type: &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", TypeSize: 4, ArgDir: 1}}}}, - &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "read_status", TypeSize: 8}, Type: &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", TypeSize: 4, ArgDir: 1}}}}, - }}, {Name: "zx_channel_create", CallName: "zx_channel_create", Args: []Type{ &ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "options", TypeSize: 8}}}, &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "out0", TypeSize: 8}, Type: &ResourceType{TypeCommon: TypeCommon{TypeName: "zx_chan", TypeSize: 4, ArgDir: 1}}}, @@ -538,6 +510,9 @@ var syscalls_amd64 = []*Syscall{ &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "handles", TypeSize: 8}, Type: &ArrayType{TypeCommon: TypeCommon{TypeName: "array", IsVarlen: true}, Type: &ResourceType{TypeCommon: TypeCommon{TypeName: "zx_handle", TypeSize: 4}}}}, &LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "len", FldName: "num_handles", TypeSize: 8}}, Buf: "handles"}, }}, + {Name: "zx_clock_get", CallName: "zx_clock_get", Args: []Type{ + &FlagsType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "clock_id", FldName: "clock_id", TypeSize: 8}}, Vals: []uint64{0, 1, 2}}, + }, Ret: &ResourceType{TypeCommon: TypeCommon{TypeName: "zx_time", FldName: "ret", TypeSize: 8, ArgDir: 1}}}, {Name: "zx_cprng_add_entropy", CallName: "zx_cprng_add_entropy", Args: []Type{ &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "buffer", TypeSize: 8}, Type: &BufferType{TypeCommon: TypeCommon{TypeName: "array", IsVarlen: true}}}, &LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "len", FldName: "len", TypeSize: 8}}, Buf: "buffer"}, @@ -943,9 +918,6 @@ var syscalls_amd64 = []*Syscall{ }}, {Name: "zx_ticks_get", CallName: "zx_ticks_get"}, {Name: "zx_ticks_per_second", CallName: "zx_ticks_per_second"}, - {Name: "zx_time_get", CallName: "zx_time_get", Args: []Type{ - &FlagsType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "clock_id", FldName: "clock_id", TypeSize: 8}}, Vals: []uint64{0, 1, 2}}, - }, Ret: &ResourceType{TypeCommon: TypeCommon{TypeName: "zx_time", FldName: "ret", TypeSize: 8, ArgDir: 1}}}, {Name: "zx_timer_cancel", CallName: "zx_timer_cancel", Args: []Type{ &ResourceType{TypeCommon: TypeCommon{TypeName: "zx_timer", FldName: "handle", TypeSize: 4}}, }}, @@ -1244,4 +1216,4 @@ var consts_amd64 = []ConstValue{ {Name: "ZX_WAIT_ASYNC_REPEATING", Value: 1}, } -const revision_amd64 = "7b78fbcff5be58d55fce6250972288b9c5141689" +const revision_amd64 = "9bdbf38bbd8f8ae5ac1db5c26f4309fd7cab884b" diff --git a/sys/fuchsia/arm64.go b/sys/fuchsia/arm64.go index d735c39c..c2b8de81 100644 --- a/sys/fuchsia/arm64.go +++ b/sys/fuchsia/arm64.go @@ -265,9 +265,6 @@ var syscalls_arm64 = []*Syscall{ &FlagsType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "open_mode", FldName: "mode", TypeSize: 8}}, Vals: []uint64{256, 128, 64, 32, 16, 8, 4, 2, 1}}, &FlagsType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "faccessat_flags", FldName: "flags", TypeSize: 8}}, Vals: []uint64{256, 512, 1024, 2048, 4096}}, }}, - {Name: "fchdir", CallName: "fchdir", Args: []Type{ - &ResourceType{TypeCommon: TypeCommon{TypeName: "fd", FldName: "fd", TypeSize: 4}}, - }}, {Name: "fchmod", CallName: "fchmod", Args: []Type{ &ResourceType{TypeCommon: TypeCommon{TypeName: "fd", FldName: "fd", TypeSize: 4}}, &FlagsType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "open_mode", FldName: "mode", TypeSize: 8}}, Vals: []uint64{256, 128, 64, 32, 16, 8, 4, 2, 1}}, @@ -292,10 +289,6 @@ var syscalls_arm64 = []*Syscall{ {Name: "fdatasync", CallName: "fdatasync", Args: []Type{ &ResourceType{TypeCommon: TypeCommon{TypeName: "fd", FldName: "fd", TypeSize: 4}}, }}, - {Name: "flock", CallName: "flock", Args: []Type{ - &ResourceType{TypeCommon: TypeCommon{TypeName: "fd", FldName: "fd", TypeSize: 4}}, - &FlagsType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "flock_op", FldName: "op", TypeSize: 8}}, Vals: []uint64{1, 2, 8, 4}}, - }}, {Name: "fstat", CallName: "fstat", Args: []Type{ &ResourceType{TypeCommon: TypeCommon{TypeName: "fd", FldName: "fd", TypeSize: 4}}, &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "statbuf", TypeSize: 8}, Type: &BufferType{TypeCommon: TypeCommon{TypeName: "array", ArgDir: 1, IsVarlen: true}}}, @@ -307,11 +300,6 @@ var syscalls_arm64 = []*Syscall{ &ResourceType{TypeCommon: TypeCommon{TypeName: "fd", FldName: "fd", TypeSize: 4}}, &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "intptr", FldName: "len", TypeSize: 8}}}, }}, - {Name: "futimesat", CallName: "futimesat", Args: []Type{ - &ResourceType{TypeCommon: TypeCommon{TypeName: "fd", FldName: "dir", TypeSize: 4}}, - &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "pathname", TypeSize: 8}, Type: &BufferType{TypeCommon: TypeCommon{TypeName: "filename", IsVarlen: true}, Kind: 3}}, - &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "times", TypeSize: 8}, Type: &StructType{Key: StructKey{Name: "itimerval"}}}, - }}, {Name: "getcwd", CallName: "getcwd", Args: []Type{ &PtrType{TypeCommon: TypeCommon{TypeName: "buffer", FldName: "buf", TypeSize: 8}, Type: &BufferType{TypeCommon: TypeCommon{ArgDir: 1, IsVarlen: true}}}, &LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "len", FldName: "size", TypeSize: 8}}, Buf: "buf"}, @@ -499,22 +487,6 @@ var syscalls_arm64 = []*Syscall{ &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "actual_handles", TypeSize: 8}, Type: &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", TypeSize: 4, ArgDir: 1}}}}, &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "read_status", TypeSize: 8}, Type: &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", TypeSize: 4, ArgDir: 1}}}}, }}, - {Name: "zx_channel_call_finish", CallName: "zx_channel_call_finish", Args: []Type{ - &ResourceType{TypeCommon: TypeCommon{TypeName: "zx_time", FldName: "deadline", TypeSize: 8}}, - &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "args", TypeSize: 8}, Type: &StructType{Key: StructKey{Name: "zx_channel_call_args"}}}, - &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "actual_bytes", TypeSize: 8}, Type: &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", TypeSize: 4, ArgDir: 1}}}}, - &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "actual_handles", TypeSize: 8}, Type: &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", TypeSize: 4, ArgDir: 1}}}}, - &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "read_status", TypeSize: 8}, Type: &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", TypeSize: 4, ArgDir: 1}}}}, - }}, - {Name: "zx_channel_call_noretry", CallName: "zx_channel_call_noretry", Args: []Type{ - &ResourceType{TypeCommon: TypeCommon{TypeName: "zx_chan", FldName: "handle", TypeSize: 4}}, - &ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "options", TypeSize: 8}}}, - &ResourceType{TypeCommon: TypeCommon{TypeName: "zx_time", FldName: "deadline", TypeSize: 8}}, - &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "args", TypeSize: 8}, Type: &StructType{Key: StructKey{Name: "zx_channel_call_args"}}}, - &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "actual_bytes", TypeSize: 8}, Type: &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", TypeSize: 4, ArgDir: 1}}}}, - &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "actual_handles", TypeSize: 8}, Type: &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", TypeSize: 4, ArgDir: 1}}}}, - &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "read_status", TypeSize: 8}, Type: &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", TypeSize: 4, ArgDir: 1}}}}, - }}, {Name: "zx_channel_create", CallName: "zx_channel_create", Args: []Type{ &ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "options", TypeSize: 8}}}, &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "out0", TypeSize: 8}, Type: &ResourceType{TypeCommon: TypeCommon{TypeName: "zx_chan", TypeSize: 4, ArgDir: 1}}}, @@ -538,6 +510,9 @@ var syscalls_arm64 = []*Syscall{ &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "handles", TypeSize: 8}, Type: &ArrayType{TypeCommon: TypeCommon{TypeName: "array", IsVarlen: true}, Type: &ResourceType{TypeCommon: TypeCommon{TypeName: "zx_handle", TypeSize: 4}}}}, &LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "len", FldName: "num_handles", TypeSize: 8}}, Buf: "handles"}, }}, + {Name: "zx_clock_get", CallName: "zx_clock_get", Args: []Type{ + &FlagsType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "clock_id", FldName: "clock_id", TypeSize: 8}}, Vals: []uint64{0, 1, 2}}, + }, Ret: &ResourceType{TypeCommon: TypeCommon{TypeName: "zx_time", FldName: "ret", TypeSize: 8, ArgDir: 1}}}, {Name: "zx_cprng_add_entropy", CallName: "zx_cprng_add_entropy", Args: []Type{ &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "buffer", TypeSize: 8}, Type: &BufferType{TypeCommon: TypeCommon{TypeName: "array", IsVarlen: true}}}, &LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "len", FldName: "len", TypeSize: 8}}, Buf: "buffer"}, @@ -943,9 +918,6 @@ var syscalls_arm64 = []*Syscall{ }}, {Name: "zx_ticks_get", CallName: "zx_ticks_get"}, {Name: "zx_ticks_per_second", CallName: "zx_ticks_per_second"}, - {Name: "zx_time_get", CallName: "zx_time_get", Args: []Type{ - &FlagsType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "clock_id", FldName: "clock_id", TypeSize: 8}}, Vals: []uint64{0, 1, 2}}, - }, Ret: &ResourceType{TypeCommon: TypeCommon{TypeName: "zx_time", FldName: "ret", TypeSize: 8, ArgDir: 1}}}, {Name: "zx_timer_cancel", CallName: "zx_timer_cancel", Args: []Type{ &ResourceType{TypeCommon: TypeCommon{TypeName: "zx_timer", FldName: "handle", TypeSize: 4}}, }}, @@ -1244,4 +1216,4 @@ var consts_arm64 = []ConstValue{ {Name: "ZX_WAIT_ASYNC_REPEATING", Value: 1}, } -const revision_arm64 = "545421122ef05f52e8f98342789ed868018b192b" +const revision_arm64 = "ebd125b38ce1b3617ba0e9db31c2becdb3213fc2" diff --git a/sys/fuchsia/channels.txt b/sys/fuchsia/channels.txt index 33ba115c..15448bf4 100644 --- a/sys/fuchsia/channels.txt +++ b/sys/fuchsia/channels.txt @@ -10,10 +10,6 @@ zx_channel_call(handle zx_chan, options const[0], deadline zx_time, args ptr[in, zx_channel_read(handle zx_chan, options flags[chan_read_options], bytes ptr[out, array[int8]], handles ptr[out, zx_handle], num_bytes len[bytes], num_handles len[handles], actual_bytes ptr[out, int32], actual_handles ptr[out, int32]) zx_channel_write(handle zx_chan, options const[0], bytes ptr[in, array[int8]], num_bytes len[bytes], handles ptr[in, array[zx_handle]], num_handles len[handles]) -# Not public: -zx_channel_call_finish(deadline zx_time, args ptr[in, zx_channel_call_args], actual_bytes ptr[out, int32], actual_handles ptr[out, int32], read_status ptr[out, int32]) -zx_channel_call_noretry(handle zx_chan, options const[0], deadline zx_time, args ptr[in, zx_channel_call_args], actual_bytes ptr[out, int32], actual_handles ptr[out, int32], read_status ptr[out, int32]) - zx_channel_call_args { wr_bytes ptr[in, array[int8]] wr_handles ptr[in, array[zx_handle]] diff --git a/sys/fuchsia/posix.txt b/sys/fuchsia/posix.txt index 40fd274b..7652a818 100644 --- a/sys/fuchsia/posix.txt +++ b/sys/fuchsia/posix.txt @@ -53,7 +53,6 @@ fchownat(dirfd fd, file ptr[in, filename], uid uid, gid gid, flags flags[at_flag faccessat(dirfd fd, pathname ptr[in, filename], mode flags[open_mode], flags flags[faccessat_flags]) utime(filename ptr[in, filename], times ptr[in, utimbuf]) utimes(filename ptr[in, filename], times ptr[in, itimerval]) -futimesat(dir fd, pathname ptr[in, filename], times ptr[in, itimerval]) utimensat(dir fd, pathname ptr[in, filename], times ptr[in, itimerval], flags flags[utimensat_flags]) link(old ptr[in, filename], new ptr[in, filename]) @@ -71,13 +70,11 @@ mkdirat(fd fd, path ptr[in, filename], mode flags[open_mode]) rmdir(path ptr[in, filename]) truncate(file ptr[in, filename], len intptr) ftruncate(fd fd, len intptr) -flock(fd fd, op flags[flock_op]) fsync(fd fd) fdatasync(fd fd) sync() getcwd(buf buffer[out], size len[buf]) chdir(dir ptr[in, filename]) -fchdir(fd fd) getgid() gid getuid() uid diff --git a/sys/fuchsia/time.txt b/sys/fuchsia/time.txt index d0ea748c..7cd8c1ea 100644 --- a/sys/fuchsia/time.txt +++ b/sys/fuchsia/time.txt @@ -6,7 +6,7 @@ include resource zx_time[int64]: 0, ZX_TIME_INFINITE zx_nanosleep(deadline zx_time) -zx_time_get(clock_id flags[clock_id]) zx_time +zx_clock_get(clock_id flags[clock_id]) zx_time zx_ticks_get() zx_ticks_per_second()