diff options
| author | Brad Fitzpatrick <bradfitz@golang.org> | 2019-10-08 19:19:13 +0000 |
|---|---|---|
| committer | Brad Fitzpatrick <bradfitz@golang.org> | 2019-10-09 06:14:44 +0000 |
| commit | a38a917aee626a9b9d5ce2b93964f586bf759ea0 (patch) | |
| tree | b5259bc8fc8ad6b7955a3c04aba1b21053cfb30c /src/runtime | |
| parent | 2197321db1dd997165c0091ba2bcb3b6be7633d0 (diff) | |
| download | go-a38a917aee626a9b9d5ce2b93964f586bf759ea0.tar.xz | |
all: remove the nacl port (part 1)
You were a useful port and you've served your purpose.
Thanks for all the play.
A subsequent CL will remove amd64p32 (including assembly files and
toolchain bits) and remaining bits. The amd64p32 removal will be
separated into its own CL in case we want to support the Linux x32 ABI
in the future and want our old amd64p32 support as a starting point.
Updates #30439
Change-Id: Ia3a0c7d49804adc87bf52a4dea7e3d3007f2b1cd
Reviewed-on: https://go-review.googlesource.com/c/go/+/199499
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to 'src/runtime')
47 files changed, 23 insertions, 1670 deletions
diff --git a/src/runtime/alg.go b/src/runtime/alg.go index 935d45d503..56a8212981 100644 --- a/src/runtime/alg.go +++ b/src/runtime/alg.go @@ -321,7 +321,6 @@ var hashkey [4]uintptr func alginit() { // Install AES hash algorithms if the instructions needed are present. if (GOARCH == "386" || GOARCH == "amd64") && - GOOS != "nacl" && cpu.X86.HasAES && // AESENC cpu.X86.HasSSSE3 && // PSHUFB cpu.X86.HasSSE41 { // PINSR{D,Q} diff --git a/src/runtime/asm_386.s b/src/runtime/asm_386.s index b31ea41ad4..8f0ec08f80 100644 --- a/src/runtime/asm_386.s +++ b/src/runtime/asm_386.s @@ -109,9 +109,6 @@ TEXT runtime·rt0_go(SB),NOSPLIT|NOFRAME,$0 MOVL SP, (g_stack+stack_hi)(BP) // find out information about the processor we're on -#ifdef GOOS_nacl // NaCl doesn't like PUSHFL/POPFL - JMP has_cpuid -#else // first see if CPUID instruction is supported. PUSHFL PUSHFL @@ -123,7 +120,6 @@ TEXT runtime·rt0_go(SB),NOSPLIT|NOFRAME,$0 POPFL // restore EFLAGS TESTL $(1<<21), AX JNE has_cpuid -#endif bad_proc: // show that the program requires MMX. MOVL $2, 0(SP) diff --git a/src/runtime/asm_arm.s b/src/runtime/asm_arm.s index ade39dfed8..51a50c604c 100644 --- a/src/runtime/asm_arm.s +++ b/src/runtime/asm_arm.s @@ -185,15 +185,11 @@ GLOBL runtime·mainPC(SB),RODATA,$4 TEXT runtime·breakpoint(SB),NOSPLIT,$0-0 // gdb won't skip this breakpoint instruction automatically, // so you must manually "set $pc+=4" to skip it and continue. -#ifdef GOOS_nacl - WORD $0xe125be7f // BKPT 0x5bef, NACL_INSTR_ARM_BREAKPOINT -#else #ifdef GOOS_plan9 WORD $0xD1200070 // undefined instruction used as armv5 breakpoint in Plan 9 #else WORD $0xe7f001f0 // undefined instruction that gdb understands is a software breakpoint #endif -#endif RET TEXT runtime·asminit(SB),NOSPLIT,$0-0 @@ -327,9 +323,6 @@ switch: // save our state in g->sched. Pretend to // be systemstack_switch if the G stack is scanned. MOVW $runtime·systemstack_switch(SB), R3 -#ifdef GOOS_nacl - ADD $4, R3, R3 // get past nacl-insert bic instruction -#endif ADD $4, R3, R3 // get past push {lr} MOVW R3, (g_sched+gobuf_pc)(g) MOVW R13, (g_sched+gobuf_sp)(g) @@ -887,7 +880,6 @@ TEXT runtime·usplitR0(SB),NOSPLIT,$0 SUB R1, R3, R1 RET -#ifndef GOOS_nacl // This is called from .init_array and follows the platform, not Go, ABI. TEXT runtime·addmoduledata(SB),NOSPLIT,$0-0 MOVW R9, saver9-4(SP) // The access to global variables below implicitly uses R9, which is callee-save @@ -898,7 +890,6 @@ TEXT runtime·addmoduledata(SB),NOSPLIT,$0-0 MOVW saver11-8(SP), R11 MOVW saver9-4(SP), R9 RET -#endif TEXT ·checkASM(SB),NOSPLIT,$0-1 MOVW $1, R3 @@ -935,8 +926,6 @@ ret: MOVM.IA.W (R13), [R0,R1] // Do the write. MOVW R3, (R2) - // Normally RET on nacl clobbers R12, but because this - // function has no frame it doesn't have to usual epilogue. RET flush: diff --git a/src/runtime/crash_nonunix_test.go b/src/runtime/crash_nonunix_test.go index bf349a5d89..06c197ec2b 100644 --- a/src/runtime/crash_nonunix_test.go +++ b/src/runtime/crash_nonunix_test.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build windows plan9 nacl js,wasm +// +build windows plan9 js,wasm package runtime_test diff --git a/src/runtime/debug/heapdump_test.go b/src/runtime/debug/heapdump_test.go index c986efcb32..de1ec27d21 100644 --- a/src/runtime/debug/heapdump_test.go +++ b/src/runtime/debug/heapdump_test.go @@ -13,7 +13,7 @@ import ( ) func TestWriteHeapDumpNonempty(t *testing.T) { - if runtime.GOOS == "nacl" || runtime.GOOS == "js" { + if runtime.GOOS == "js" { t.Skipf("WriteHeapDump is not available on %s.", runtime.GOOS) } f, err := ioutil.TempFile("", "heapdumptest") @@ -42,7 +42,7 @@ func objfin(x *Obj) { } func TestWriteHeapDumpFinalizers(t *testing.T) { - if runtime.GOOS == "nacl" || runtime.GOOS == "js" { + if runtime.GOOS == "js" { t.Skipf("WriteHeapDump is not available on %s.", runtime.GOOS) } f, err := ioutil.TempFile("", "heapdumptest") diff --git a/src/runtime/defs_nacl_386.go b/src/runtime/defs_nacl_386.go deleted file mode 100644 index 70dfcf2c51..0000000000 --- a/src/runtime/defs_nacl_386.go +++ /dev/null @@ -1,49 +0,0 @@ -package runtime - -const ( - // These values are referred to in the source code - // but really don't matter. Even so, use the standard numbers. - _SIGQUIT = 3 - _SIGTRAP = 5 - _SIGSEGV = 11 - _SIGPROF = 27 -) - -type timespec struct { - tv_sec int64 - tv_nsec int32 -} - -//go:nosplit -func (ts *timespec) setNsec(ns int64) { - ts.tv_sec = int64(timediv(ns, 1e9, &ts.tv_nsec)) -} - -type excregs386 struct { - eax uint32 - ecx uint32 - edx uint32 - ebx uint32 - esp uint32 - ebp uint32 - esi uint32 - edi uint32 - eip uint32 - eflags uint32 -} - -type exccontext struct { - size uint32 - portable_context_offset uint32 - portable_context_size uint32 - arch uint32 - regs_size uint32 - reserved [11]uint32 - regs excregs386 -} - -type excportablecontext struct { - pc uint32 - sp uint32 - fp uint32 -} diff --git a/src/runtime/defs_nacl_arm.go b/src/runtime/defs_nacl_arm.go deleted file mode 100644 index 89e539ea7b..0000000000 --- a/src/runtime/defs_nacl_arm.go +++ /dev/null @@ -1,56 +0,0 @@ -package runtime - -const ( - // These values are referred to in the source code - // but really don't matter. Even so, use the standard numbers. - _SIGQUIT = 3 - _SIGTRAP = 5 - _SIGSEGV = 11 - _SIGPROF = 27 -) - -type timespec struct { - tv_sec int64 - tv_nsec int32 -} - -//go:nosplit -func (ts *timespec) setNsec(ns int64) { - ts.tv_sec = int64(timediv(ns, 1e9, &ts.tv_nsec)) -} - -type excregsarm struct { - r0 uint32 - r1 uint32 - r2 uint32 - r3 uint32 - r4 uint32 - r5 uint32 - r6 uint32 - r7 uint32 - r8 uint32 - r9 uint32 // the value reported here is undefined. - r10 uint32 - r11 uint32 - r12 uint32 - sp uint32 /* r13 */ - lr uint32 /* r14 */ - pc uint32 /* r15 */ - cpsr uint32 -} - -type exccontext struct { - size uint32 - portable_context_offset uint32 - portable_context_size uint32 - arch uint32 - regs_size uint32 - reserved [11]uint32 - regs excregsarm -} - -type excportablecontext struct { - pc uint32 - sp uint32 - fp uint32 -} diff --git a/src/runtime/env_posix.go b/src/runtime/env_posix.go index 03208c7c10..f95ff68545 100644 --- a/src/runtime/env_posix.go +++ b/src/runtime/env_posix.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin dragonfly freebsd js,wasm linux nacl netbsd openbsd solaris windows +// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris windows package runtime diff --git a/src/runtime/export_mmap_test.go b/src/runtime/export_mmap_test.go index 6c4a4466de..aeaf37f64b 100644 --- a/src/runtime/export_mmap_test.go +++ b/src/runtime/export_mmap_test.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin dragonfly freebsd linux nacl netbsd openbsd solaris +// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris // Export guts for testing. diff --git a/src/runtime/internal/sys/arch_386.go b/src/runtime/internal/sys/arch_386.go index 3426fd1702..b51f70a512 100644 --- a/src/runtime/internal/sys/arch_386.go +++ b/src/runtime/internal/sys/arch_386.go @@ -7,7 +7,7 @@ package sys const ( ArchFamily = I386 BigEndian = false - DefaultPhysPageSize = GoosNacl*65536 + (1-GoosNacl)*4096 // 4k normally; 64k on NaCl + DefaultPhysPageSize = 4096 PCQuantum = 1 Int64Align = 4 MinFrameSize = 0 diff --git a/src/runtime/internal/sys/zgoos_nacl.go b/src/runtime/internal/sys/zgoos_nacl.go deleted file mode 100644 index 9e65b6f185..0000000000 --- a/src/runtime/internal/sys/zgoos_nacl.go +++ /dev/null @@ -1,24 +0,0 @@ -// Code generated by gengoos.go using 'go generate'. DO NOT EDIT. - -// +build nacl - -package sys - -const GOOS = `nacl` - -const GoosAix = 0 -const GoosAndroid = 0 -const GoosDarwin = 0 -const GoosDragonfly = 0 -const GoosFreebsd = 0 -const GoosHurd = 0 -const GoosIllumos = 0 -const GoosJs = 0 -const GoosLinux = 0 -const GoosNacl = 1 -const GoosNetbsd = 0 -const GoosOpenbsd = 0 -const GoosPlan9 = 0 -const GoosSolaris = 0 -const GoosWindows = 0 -const GoosZos = 0 diff --git a/src/runtime/lfstack_32bit.go b/src/runtime/lfstack_32bit.go index d36ca50971..f07ff1c06b 100644 --- a/src/runtime/lfstack_32bit.go +++ b/src/runtime/lfstack_32bit.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build 386 arm nacl mips mipsle +// +build 386 arm mips mipsle package runtime diff --git a/src/runtime/lock_sema.go b/src/runtime/lock_sema.go index b36c97f71e..9507d46f41 100644 --- a/src/runtime/lock_sema.go +++ b/src/runtime/lock_sema.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin nacl netbsd openbsd plan9 solaris windows +// +build aix darwin netbsd openbsd plan9 solaris windows package runtime diff --git a/src/runtime/mem_bsd.go b/src/runtime/mem_bsd.go index 08a2391610..ad23539523 100644 --- a/src/runtime/mem_bsd.go +++ b/src/runtime/mem_bsd.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build dragonfly freebsd nacl netbsd openbsd solaris +// +build dragonfly freebsd netbsd openbsd solaris package runtime diff --git a/src/runtime/mknacl.sh b/src/runtime/mknacl.sh deleted file mode 100644 index 306ae3d9c1..0000000000 --- a/src/runtime/mknacl.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env bash -# Copyright 2013 The Go Authors. All rights reserved. -# Use of this source code is governed by a BSD-style -# license that can be found in the LICENSE file. - -cat /Users/rsc/pub/native_client/src/trusted/service_runtime/include/bits/nacl_syscalls.h | - awk ' - BEGIN { - printf("// Code generated by mknacl.sh; DO NOT EDIT.\n") - } - NF==3 && $1=="#define" && $2~/^NACL_sys_/ { - name=$2 - sub(/^NACL_sys_/, "SYS_", name) - printf("#define %s %s\n", name, $3) - }' >syscall_nacl.h diff --git a/src/runtime/mmap.go b/src/runtime/mmap.go index 2868f3fd4e..9fe31cb416 100644 --- a/src/runtime/mmap.go +++ b/src/runtime/mmap.go @@ -5,7 +5,6 @@ // +build !plan9 // +build !solaris // +build !windows -// +build !nacl // +build !linux !amd64 // +build !linux !arm64 // +build !js diff --git a/src/runtime/netpoll.go b/src/runtime/netpoll.go index 73bbc5e3c7..adb072db38 100644 --- a/src/runtime/netpoll.go +++ b/src/runtime/netpoll.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin dragonfly freebsd js,wasm linux nacl netbsd openbsd solaris windows +// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris windows package runtime diff --git a/src/runtime/netpoll_fake.go b/src/runtime/netpoll_fake.go index 5b1a63a878..214538e281 100644 --- a/src/runtime/netpoll_fake.go +++ b/src/runtime/netpoll_fake.go @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// Fake network poller for NaCl and wasm/js. +// Fake network poller for wasm/js. // Should never be used, because NaCl and wasm/js network connections do not honor "SetNonblock". -// +build nacl js,wasm +// +build js,wasm package runtime diff --git a/src/runtime/os2_nacl.go b/src/runtime/os2_nacl.go deleted file mode 100644 index b84cb18bb2..0000000000 --- a/src/runtime/os2_nacl.go +++ /dev/null @@ -1,155 +0,0 @@ -// Copyright 2014 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package runtime - -const ( - _NSIG = 32 - _SI_USER = 1 - - // native_client/src/trusted/service_runtime/include/sys/errno.h - // The errors are mainly copied from Linux. - _EPERM = 1 /* Operation not permitted */ - _ENOENT = 2 /* No such file or directory */ - _ESRCH = 3 /* No such process */ - _EINTR = 4 /* Interrupted system call */ - _EIO = 5 /* I/O error */ - _ENXIO = 6 /* No such device or address */ - _E2BIG = 7 /* Argument list too long */ - _ENOEXEC = 8 /* Exec format error */ - _EBADF = 9 /* Bad file number */ - _ECHILD = 10 /* No child processes */ - _EAGAIN = 11 /* Try again */ - // _ENOMEM is defined in mem_bsd.go for nacl. - // _ENOMEM = 12 /* Out of memory */ - _EACCES = 13 /* Permission denied */ - _EFAULT = 14 /* Bad address */ - _EBUSY = 16 /* Device or resource busy */ - _EEXIST = 17 /* File exists */ - _EXDEV = 18 /* Cross-device link */ - _ENODEV = 19 /* No such device */ - _ENOTDIR = 20 /* Not a directory */ - _EISDIR = 21 /* Is a directory */ - _EINVAL = 22 /* Invalid argument */ - _ENFILE = 23 /* File table overflow */ - _EMFILE = 24 /* Too many open files */ - _ENOTTY = 25 /* Not a typewriter */ - _EFBIG = 27 /* File too large */ - _ENOSPC = 28 /* No space left on device */ - _ESPIPE = 29 /* Illegal seek */ - _EROFS = 30 /* Read-only file system */ - _EMLINK = 31 /* Too many links */ - _EPIPE = 32 /* Broken pipe */ - _ENAMETOOLONG = 36 /* File name too long */ - _ENOSYS = 38 /* Function not implemented */ - _EDQUOT = 122 /* Quota exceeded */ - _EDOM = 33 /* Math arg out of domain of func */ - _ERANGE = 34 /* Math result not representable */ - _EDEADLK = 35 /* Deadlock condition */ - _ENOLCK = 37 /* No record locks available */ - _ENOTEMPTY = 39 /* Directory not empty */ - _ELOOP = 40 /* Too many symbolic links */ - _ENOMSG = 42 /* No message of desired type */ - _EIDRM = 43 /* Identifier removed */ - _ECHRNG = 44 /* Channel number out of range */ - _EL2NSYNC = 45 /* Level 2 not synchronized */ - _EL3HLT = 46 /* Level 3 halted */ - _EL3RST = 47 /* Level 3 reset */ - _ELNRNG = 48 /* Link number out of range */ - _EUNATCH = 49 /* Protocol driver not attached */ - _ENOCSI = 50 /* No CSI structure available */ - _EL2HLT = 51 /* Level 2 halted */ - _EBADE = 52 /* Invalid exchange */ - _EBADR = 53 /* Invalid request descriptor */ - _EXFULL = 54 /* Exchange full */ - _ENOANO = 55 /* No anode */ - _EBADRQC = 56 /* Invalid request code */ - _EBADSLT = 57 /* Invalid slot */ - _EDEADLOCK = _EDEADLK /* File locking deadlock error */ - _EBFONT = 59 /* Bad font file fmt */ - _ENOSTR = 60 /* Device not a stream */ - _ENODATA = 61 /* No data (for no delay io) */ - _ETIME = 62 /* Timer expired */ - _ENOSR = 63 /* Out of streams resources */ - _ENONET = 64 /* Machine is not on the network */ - _ENOPKG = 65 /* Package not installed */ - _EREMOTE = 66 /* The object is remote */ - _ENOLINK = 67 /* The link has been severed */ - _EADV = 68 /* Advertise error */ - _ESRMNT = 69 /* Srmount error */ - _ECOMM = 70 /* Communication error on send */ - _EPROTO = 71 /* Protocol error */ - _EMULTIHOP = 72 /* Multihop attempted */ - _EDOTDOT = 73 /* Cross mount point (not really error) */ - _EBADMSG = 74 /* Trying to read unreadable message */ - _EOVERFLOW = 75 /* Value too large for defined data type */ - _ENOTUNIQ = 76 /* Given log. name not unique */ - _EBADFD = 77 /* f.d. invalid for this operation */ - _EREMCHG = 78 /* Remote address changed */ - _ELIBACC = 79 /* Can't access a needed shared lib */ - _ELIBBAD = 80 /* Accessing a corrupted shared lib */ - _ELIBSCN = 81 /* .lib section in a.out corrupted */ - _ELIBMAX = 82 /* Attempting to link in too many libs */ - _ELIBEXEC = 83 /* Attempting to exec a shared library */ - _EILSEQ = 84 - _EUSERS = 87 - _ENOTSOCK = 88 /* Socket operation on non-socket */ - _EDESTADDRREQ = 89 /* Destination address required */ - _EMSGSIZE = 90 /* Message too long */ - _EPROTOTYPE = 91 /* Protocol wrong type for socket */ - _ENOPROTOOPT = 92 /* Protocol not available */ - _EPROTONOSUPPORT = 93 /* Unknown protocol */ - _ESOCKTNOSUPPORT = 94 /* Socket type not supported */ - _EOPNOTSUPP = 95 /* Operation not supported on transport endpoint */ - _EPFNOSUPPORT = 96 /* Protocol family not supported */ - _EAFNOSUPPORT = 97 /* Address family not supported by protocol family */ - _EADDRINUSE = 98 /* Address already in use */ - _EADDRNOTAVAIL = 99 /* Address not available */ - _ENETDOWN = 100 /* Network interface is not configured */ - _ENETUNREACH = 101 /* Network is unreachable */ - _ENETRESET = 102 - _ECONNABORTED = 103 /* Connection aborted */ - _ECONNRESET = 104 /* Connection reset by peer */ - _ENOBUFS = 105 /* No buffer space available */ - _EISCONN = 106 /* Socket is already connected */ - _ENOTCONN = 107 /* Socket is not connected */ - _ESHUTDOWN = 108 /* Can't send after socket shutdown */ - _ETOOMANYREFS = 109 - _ETIMEDOUT = 110 /* Connection timed out */ - _ECONNREFUSED = 111 /* Connection refused */ - _EHOSTDOWN = 112 /* Host is down */ - _EHOSTUNREACH = 113 /* Host is unreachable */ - _EALREADY = 114 /* Socket already connected */ - _EINPROGRESS = 115 /* Connection already in progress */ - _ESTALE = 116 - _ENOTSUP = _EOPNOTSUPP /* Not supported */ - _ENOMEDIUM = 123 /* No medium (in tape drive) */ - _ECANCELED = 125 /* Operation canceled. */ - _ELBIN = 2048 /* Inode is remote (not really error) */ - _EFTYPE = 2049 /* Inappropriate file type or format */ - _ENMFILE = 2050 /* No more files */ - _EPROCLIM = 2051 - _ENOSHARE = 2052 /* No such host or network path */ - _ECASECLASH = 2053 /* Filename exists with different case */ - _EWOULDBLOCK = _EAGAIN /* Operation would block */ - - // native_client/src/trusted/service_runtime/include/bits/mman.h. - // NOTE: DO NOT USE native_client/src/shared/imc/nacl_imc_c.h. - // Those MAP_*values are different from these. - _PROT_NONE = 0x0 - _PROT_READ = 0x1 - _PROT_WRITE = 0x2 - _PROT_EXEC = 0x4 - - _MAP_SHARED = 0x1 - _MAP_PRIVATE = 0x2 - _MAP_FIXED = 0x10 - _MAP_ANON = 0x20 - - _MADV_FREE = 0 - _SIGFPE = 8 - _FPE_INTDIV = 0 -) - -type siginfo struct{} diff --git a/src/runtime/os_nacl.go b/src/runtime/os_nacl.go deleted file mode 100644 index 8cda597ca5..0000000000 --- a/src/runtime/os_nacl.go +++ /dev/null @@ -1,333 +0,0 @@ -// Copyright 2010 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package runtime - -import "unsafe" - -type mOS struct { - waitsema int32 // semaphore for parking on locks - waitsemacount int32 - waitsemalock int32 -} - -func nacl_exception_stack(p uintptr, size int32) int32 -func nacl_exception_handler(fn uintptr, arg unsafe.Pointer) int32 -func nacl_sem_create(flag int32) int32 -func nacl_sem_wait(sem int32) int32 -func nacl_sem_post(sem int32) int32 -func nacl_mutex_create(flag int32) int32 -func nacl_mutex_lock(mutex int32) int32 -func nacl_mutex_trylock(mutex int32) int32 -func nacl_mutex_unlock(mutex int32) int32 -func nacl_cond_create(flag int32) int32 -func nacl_cond_wait(cond, n int32) int32 -func nacl_cond_signal(cond int32) int32 -func nacl_cond_broadcast(cond int32) int32 - -//go:noescape -func nacl_cond_timed_wait_abs(cond, lock int32, ts *timespec) int32 -func nacl_thread_create(fn uintptr, stk, tls, xx unsafe.Pointer) int32 - -//go:noescape -func nacl_nanosleep(ts, extra *timespec) int32 -func nanotime() int64 -func mmap(addr unsafe.Pointer, n uintptr, prot, flags, fd int32, off uint32) (p unsafe.Pointer, err int) -func exit(code int32) -func osyield() - -//go:noescape -func write(fd uintptr, p unsafe.Pointer, n int32) int32 - -//go:linkname os_sigpipe os.sigpipe -func os_sigpipe() { - throw("too many writes on closed pipe") -} - -func dieFromSignal(sig uint32) { - exit(2) -} - -func sigpanic() { - g := getg() - if !canpanic(g) { - throw("unexpected signal during runtime execution") - } - - // Native Client only invokes the exception handler for memory faults. - g.sig = _SIGSEGV - panicmem() -} - -func raiseproc(sig uint32) { -} - -// Stubs so tests can link correctly. These should never be called. -func open(name *byte, mode, perm int32) int32 -func closefd(fd int32) int32 -func read(fd int32, p unsafe.Pointer, n int32) int32 - -type sigset struct{} - -// Called to initialize a new m (including the bootstrap m). -// Called on the parent thread (main thread in case of bootstrap), can allocate memory. -func mpreinit(mp *m) { - mp.gsignal = malg(32 * 1024) - mp.gsignal.m = mp -} - -func sigtramp(ctxt byte) - -//go:nosplit -func msigsave(mp *m) { -} - -//go:nosplit -func msigrestore(sigmask sigset) { -} - -//go:nosplit -//go:nowritebarrierrec -func clearSignalHandlers() { -} - -//go:nosplit -func sigblock() { -} - -// Called to initialize a new m (including the bootstrap m). -// Called on the new thread, cannot allocate memory. -func minit() { - _g_ := getg() - - // Initialize signal handling - ret := nacl_exception_stack(_g_.m.gsignal.stack.lo, 32*1024) - if ret < 0 { - print("runtime: nacl_exception_stack: error ", -ret, "\n") - } - - ret = nacl_exception_handler(funcPC(sigtramp), nil) - if ret < 0 { - print("runtime: nacl_exception_handler: error ", -ret, "\n") - } -} - -// Called from dropm to undo the effect of an minit. -func unminit() { -} - -func osinit() { - ncpu = 1 - getg().m.procid = 2 - //nacl_exception_handler(funcPC(sigtramp), nil); - physPageSize = 65536 -} - -func signame(sig uint32) string { - if sig >= uint32(len(sigtable)) { - return "" - } - return sigtable[sig].name -} - -//go:nosplit -func crash() { - *(*int32)(nil) = 0 -} - -//go:noescape -func getRandomData([]byte) - -func goenvs() { - goenvs_unix() -} - -func initsig(preinit bool) { -} - -//go:nosplit -func usleep(us uint32) { - var ts timespec - - ts.tv_sec = int64(us / 1e6) - ts.tv_nsec = int32(us%1e6) * 1e3 - nacl_nanosleep(&ts, nil) -} - -func mstart_nacl() - -// May run with m.p==nil, so write barriers are not allowed. -//go:nowritebarrier -func newosproc(mp *m) { - stk := unsafe.Pointer(mp.g0.stack.hi) - mp.tls[0] = uintptr(unsafe.Pointer(mp.g0)) - mp.tls[1] = uintptr(unsafe.Pointer(mp)) - ret := nacl_thread_create(funcPC(mstart_nacl), stk, unsafe.Pointer(&mp.tls[2]), nil) - if ret < 0 { - print("nacl_thread_create: error ", -ret, "\n") - throw("newosproc") - } -} - -//go:noescape -func exitThread(wait *uint32) - -//go:nosplit -func semacreate(mp *m) { - if mp.waitsema != 0 { - return - } - systemstack(func() { - mu := nacl_mutex_create(0) - if mu < 0 { - print("nacl_mutex_create: error ", -mu, "\n") - throw("semacreate") - } - c := nacl_cond_create(0) - if c < 0 { - print("nacl_cond_create: error ", -c, "\n") - throw("semacreate") - } - mp.waitsema = c - mp.waitsemalock = mu - }) -} - -//go:nosplit -func semasleep(ns int64) int32 { - var ret int32 - systemstack(func() { - _g_ := getg() - if nacl_mutex_lock(_g_.m.waitsemalock) < 0 { - throw("semasleep") - } - var ts timespec - if ns >= 0 { - end := ns + nanotime() - ts.tv_sec = end / 1e9 - ts.tv_nsec = int32(end % 1e9) - } - for _g_.m.waitsemacount == 0 { - if ns < 0 { - if nacl_cond_wait(_g_.m.waitsema, _g_.m.waitsemalock) < 0 { - throw("semasleep") - } - } else { - r := nacl_cond_timed_wait_abs(_g_.m.waitsema, _g_.m.waitsemalock, &ts) - if r == -_ETIMEDOUT { - nacl_mutex_unlock(_g_.m.waitsemalock) - ret = -1 - return - } - if r < 0 { - throw("semasleep") - } - } - } - - _g_.m.waitsemacount = 0 - nacl_mutex_unlock(_g_.m.waitsemalock) - ret = 0 - }) - return ret -} - -//go:nosplit -func semawakeup(mp *m) { - systemstack(func() { - if nacl_mutex_lock(mp.waitsemalock) < 0 { - throw("semawakeup") - } - if mp.waitsemacount != 0 { - throw("semawakeup") - } - mp.waitsemacount = 1 - nacl_cond_signal(mp.waitsema) - nacl_mutex_unlock(mp.waitsemalock) - }) -} - -// This runs on a foreign stack, without an m or a g. No stack split. -//go:nosplit -//go:norace -//go:nowritebarrierrec -func badsignal(sig uintptr) { - cgocallback(unsafe.Pointer(funcPC(badsignalgo)), noescape(unsafe.Pointer(&sig)), unsafe.Sizeof(sig), 0) -} - -func badsignalgo(sig uintptr) { - if !sigsend(uint32(sig)) { - // A foreign thread received the signal sig, and the - // Go code does not want to handle it. - raisebadsignal(uint32(sig)) - } -} - -// This runs on a foreign stack, without an m or a g. No stack split. -//go:nosplit -func badsignal2() { - write(2, unsafe.Pointer(&badsignal1[0]), int32(len(badsignal1))) - exit(2) -} - -var badsignal1 = []byte("runtime: signal received on thread not created by Go.\n") - -func raisebadsignal(sig uint32) { - badsignal2() -} - -func madvise(addr unsafe.Pointer, n uintptr, flags int32) {} -func munmap(addr unsafe.Pointer, n uintptr) {} -func setProcessCPUProfiler(hz int32) {} -func setThreadCPUProfiler(hz int32) {} -func sigdisable(uint32) {} -func sigenable(uint32) {} -func sigignore(uint32) {} -func closeonexec(int32) {} - -// gsignalStack is unused on nacl. -type gsignalStack struct{} - -// nacl fake time support - time in nanoseconds since 1970 -var faketime int64 - -var writelock uint32 // test-and-set spin lock for write - -// lastfaketime stores the last faketime value written to fd 1 or 2. -var lastfaketime int64 - -// lastfaketimefd stores the fd to which lastfaketime was written. -// -// Subsequent writes to the same fd may use the same timestamp, -// but the timestamp must increase if the fd changes. -var lastfaketimefd int32 - -func walltime() (sec int64, nsec int32) - -/* -An attempt at IRT. Doesn't work. See end of sys_nacl_amd64.s. - -void (*nacl_irt_query)(void); - -int8 nacl_irt_basic_v0_1_str[] = "nacl-irt-basic-0.1"; -void *nacl_irt_basic_v0_1[6]; // exit, gettod, clock, nanosleep, sched_yield, sysconf -int32 nacl_irt_basic_v0_1_size = sizeof(nacl_irt_basic_v0_1); - -int8 nacl_irt_memory_v0_3_str[] = "nacl-irt-memory-0.3"; -void *nacl_irt_memory_v0_3[3]; // mmap, munmap, mprotect -int32 nacl_irt_memory_v0_3_size = sizeof(nacl_irt_memory_v0_3); - -int8 nacl_irt_thread_v0_1_str[] = "nacl-irt-thread-0.1"; -void *nacl_irt_thread_v0_1[3]; // thread_create, thread_exit, thread_nice -int32 nacl_irt_thread_v0_1_size = sizeof(nacl_irt_thread_v0_1); -*/ - -// The following functions are implemented in runtime assembly. -// Provide a Go declaration to go with its assembly definitions. - -//go:linkname syscall_naclWrite syscall.naclWrite -func syscall_naclWrite(fd int, b []byte) int - -//go:linkname syscall_now syscall.now -func syscall_now() (sec int64, nsec int32) diff --git a/src/runtime/os_nacl_arm.go b/src/runtime/os_nacl_arm.go deleted file mode 100644 index 8669ee75b4..0000000000 --- a/src/runtime/os_nacl_arm.go +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2014 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package runtime - -func checkgoarm() { - // TODO(minux): FP checks like in os_linux_arm.go. - - // NaCl/ARM only supports ARMv7 - if goarm != 7 { - print("runtime: NaCl requires ARMv7. Recompile using GOARM=7.\n") - exit(1) - } -} - -//go:nosplit -func cputicks() int64 { - // Currently cputicks() is used in blocking profiler and to seed runtime·fastrand(). - // runtime·nanotime() is a poor approximation of CPU ticks that is enough for the profiler. - // TODO: need more entropy to better seed fastrand. - return nanotime() -} diff --git a/src/runtime/pprof/pprof_test.go b/src/runtime/pprof/pprof_test.go index 53496371a0..ed04fe06ac 100644 --- a/src/runtime/pprof/pprof_test.go +++ b/src/runtime/pprof/pprof_test.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build !nacl,!js +// +build !js package pprof diff --git a/src/runtime/rt0_nacl_386.s b/src/runtime/rt0_nacl_386.s deleted file mode 100644 index 4c990022f1..0000000000 --- a/src/runtime/rt0_nacl_386.s +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -#include "textflag.h" - -// NaCl entry has: -// 0(FP) - arg block == SP+8 -// 4(FP) - cleanup function pointer, always 0 -// 8(FP) - envc -// 12(FP) - argc -// 16(FP) - argv, then 0, then envv, then 0, then auxv -TEXT _rt0_386_nacl(SB),NOSPLIT,$8 - MOVL argc+12(FP), AX - LEAL argv+16(FP), BX - MOVL AX, 0(SP) - MOVL BX, 4(SP) - JMP runtime·rt0_go(SB) - -TEXT main(SB),NOSPLIT,$0 - // Remove the return address from the stack. - // rt0_go doesn't expect it to be there. - ADDL $4, SP - JMP runtime·rt0_go(SB) diff --git a/src/runtime/rt0_nacl_arm.s b/src/runtime/rt0_nacl_arm.s deleted file mode 100644 index a52c0d8619..0000000000 --- a/src/runtime/rt0_nacl_arm.s +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2014 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -#include "textflag.h" - -// NaCl entry has: -// 0(FP) - 0 -// 4(FP) - cleanup function pointer, always 0 -// 8(FP) - envc -// 12(FP) - argc -// 16(FP) - argv, then 0, then envv, then 0, then auxv -TEXT _rt0_arm_nacl(SB),NOSPLIT|NOFRAME,$0 - MOVW 8(R13), R0 - MOVW $12(R13), R1 - B runtime·rt0_go(SB) diff --git a/src/runtime/runtime_mmap_test.go b/src/runtime/runtime_mmap_test.go index 6741e1da8d..bb0b747606 100644 --- a/src/runtime/runtime_mmap_test.go +++ b/src/runtime/runtime_mmap_test.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin dragonfly freebsd linux nacl netbsd openbsd solaris +// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris package runtime_test diff --git a/src/runtime/runtime_test.go b/src/runtime/runtime_test.go index 37eacfea64..ab7a03b2d1 100644 --- a/src/runtime/runtime_test.go +++ b/src/runtime/runtime_test.go @@ -193,9 +193,6 @@ func TestSetPanicOnFault(t *testing.T) { } func testSetPanicOnFault(t *testing.T, addr uintptr, nfault *int) { - if GOOS == "nacl" { - t.Skip("nacl doesn't seem to fault on high addresses") - } if GOOS == "js" { t.Skip("js does not support catching faults") } @@ -294,7 +291,7 @@ func TestTrailingZero(t *testing.T) { } func TestBadOpen(t *testing.T) { - if GOOS == "windows" || GOOS == "nacl" || GOOS == "js" { + if GOOS == "windows" || GOOS == "js" { t.Skip("skipping OS that doesn't have open/read/write/close") } // make sure we get the correct error code if open fails. Same for diff --git a/src/runtime/semasleep_test.go b/src/runtime/semasleep_test.go index 3eb7c6a6d1..9b371b0732 100644 --- a/src/runtime/semasleep_test.go +++ b/src/runtime/semasleep_test.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build !nacl,!plan9,!windows,!js +// +build !plan9,!windows,!js package runtime_test diff --git a/src/runtime/signal_386.go b/src/runtime/signal_386.go index 143deb9de7..ef97979796 100644 --- a/src/runtime/signal_386.go +++ b/src/runtime/signal_386.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build darwin dragonfly freebsd linux nacl netbsd openbsd +// +build darwin dragonfly freebsd linux netbsd openbsd package runtime diff --git a/src/runtime/signal_amd64x.go b/src/runtime/signal_amd64x.go index 9d59e262de..459499e973 100644 --- a/src/runtime/signal_amd64x.go +++ b/src/runtime/signal_amd64x.go @@ -3,7 +3,7 @@ // license that can be found in the LICENSE file. // +build amd64 amd64p32 -// +build darwin dragonfly freebsd linux nacl netbsd openbsd solaris +// +build darwin dragonfly freebsd linux netbsd openbsd solaris package runtime diff --git a/src/runtime/signal_arm.go b/src/runtime/signal_arm.go index bb597c5608..97742206c7 100644 --- a/src/runtime/signal_arm.go +++ b/src/runtime/signal_arm.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build darwin dragonfly freebsd linux nacl netbsd openbsd +// +build darwin dragonfly freebsd linux netbsd openbsd package runtime diff --git a/src/runtime/signal_nacl.go b/src/runtime/signal_nacl.go deleted file mode 100644 index ad321d8b75..0000000000 --- a/src/runtime/signal_nacl.go +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package runtime - -type sigTabT struct { - flags int32 - name string -} - -var sigtable = [...]sigTabT{ - /* 0 */ {0, "SIGNONE: no trap"}, - /* 1 */ {_SigNotify + _SigKill, "SIGHUP: terminal line hangup"}, - /* 2 */ {_SigNotify + _SigKill, "SIGINT: interrupt"}, - /* 3 */ {_SigNotify + _SigThrow, "SIGQUIT: quit"}, - /* 4 */ {_SigThrow, "SIGILL: illegal instruction"}, - /* 5 */ {_SigThrow, "SIGTRAP: trace trap"}, - /* 6 */ {_SigNotify + _SigThrow, "SIGABRT: abort"}, - /* 7 */ {_SigThrow, "SIGEMT: emulate instruction executed"}, - /* 8 */ {_SigPanic, "SIGFPE: floating-point exception"}, - /* 9 */ {0, "SIGKILL: kill"}, - /* 10 */ {_SigPanic, "SIGBUS: bus error"}, - /* 11 */ {_SigPanic, "SIGSEGV: segmentation violation"}, - /* 12 */ {_SigThrow, "SIGSYS: bad system call"}, - /* 13 */ {_SigNotify, "SIGPIPE: write to broken pipe"}, - /* 14 */ {_SigNotify, "SIGALRM: alarm clock"}, - /* 15 */ {_SigNotify + _SigKill, "SIGTERM: termination"}, - /* 16 */ {_SigNotify + _SigIgn, "SIGURG: urgent condition on socket"}, - /* 17 */ {0, "SIGSTOP: stop"}, - /* 18 */ {_SigNotify + _SigDefault + _SigIgn, "SIGTSTP: keyboard stop"}, - /* 19 */ {_SigNotify + _SigDefault + _SigIgn, "SIGCONT: continue after stop"}, - /* 20 */ {_SigNotify + _SigIgn, "SIGCHLD: child status has changed"}, - /* 21 */ {_SigNotify + _SigDefault + _SigIgn, "SIGTTIN: background read from tty"}, - /* 22 */ {_SigNotify + _SigDefault + _SigIgn, "SIGTTOU: background write to tty"}, - /* 23 */ {_SigNotify, "SIGIO: i/o now possible"}, - /* 24 */ {_SigNotify, "SIGXCPU: cpu limit exceeded"}, - /* 25 */ {_SigNotify, "SIGXFSZ: file size limit exceeded"}, - /* 26 */ {_SigNotify, "SIGVTALRM: virtual alarm clock"}, - /* 27 */ {_SigNotify, "SIGPROF: profiling alarm clock"}, - /* 28 */ {_SigNotify, "SIGWINCH: window size change"}, - /* 29 */ {_SigNotify, "SIGINFO: status request from keyboard"}, - /* 30 */ {_SigNotify, "SIGUSR1: user-defined signal 1"}, - /* 31 */ {_SigNotify, "SIGUSR2: user-defined signal 2"}, -} diff --git a/src/runtime/signal_nacl_386.go b/src/runtime/signal_nacl_386.go deleted file mode 100644 index 1a30a89c76..0000000000 --- a/src/runtime/signal_nacl_386.go +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package runtime - -import "unsafe" - -type sigctxt struct { - info *siginfo - ctxt unsafe.Pointer -} - -//go:nosplit -//go:nowritebarrierrec -func (c *sigctxt) regs() *excregs386 { return &(*exccontext)(c.ctxt).regs } - -func (c *sigctxt) eax() uint32 { return c.regs().eax } -func (c *sigctxt) ebx() uint32 { return c.regs().ebx } -func (c *sigctxt) ecx() uint32 { return c.regs().ecx } -func (c *sigctxt) edx() uint32 { return c.regs().edx } -func (c *sigctxt) edi() uint32 { return c.regs().edi } -func (c *sigctxt) esi() uint32 { return c.regs().esi } -func (c *sigctxt) ebp() uint32 { return c.regs().ebp } -func (c *sigctxt) esp() uint32 { return c.regs().esp } - -//go:nosplit -//go:nowritebarrierrec -func (c *sigctxt) eip() uint32 { return c.regs().eip } - -func (c *sigctxt) eflags() uint32 { return c.regs().eflags } -func (c *sigctxt) cs() uint32 { return ^uint32(0) } -func (c *sigctxt) fs() uint32 { return ^uint32(0) } -func (c *sigctxt) gs() uint32 { return ^uint32(0) } -func (c *sigctxt) sigcode() uint32 { return ^uint32(0) } -func (c *sigctxt) sigaddr() uint32 { return 0 } - -func (c *sigctxt) set_eip(x uint32) { c.regs().eip = x } -func (c *sigctxt) set_esp(x uint32) { c.regs().esp = x } -func (c *sigctxt) set_sigcode(x uint32) {} -func (c *sigctxt) set_sigaddr(x uint32) {} diff --git a/src/runtime/signal_nacl_arm.go b/src/runtime/signal_nacl_arm.go deleted file mode 100644 index b8312324ac..0000000000 --- a/src/runtime/signal_nacl_arm.go +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright 2014 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package runtime - -import "unsafe" - -type sigctxt struct { - info *siginfo - ctxt unsafe.Pointer -} - -//go:nosplit -//go:nowritebarrierrec -func (c *sigctxt) regs() *excregsarm { return &(*exccontext)(c.ctxt).regs } - -func (c *sigctxt) r0() uint32 { return c.regs().r0 } -func (c *sigctxt) r1() uint32 { return c.regs().r1 } -func (c *sigctxt) r2() uint32 { return c.regs().r2 } -func (c *sigctxt) r3() uint32 { return c.regs().r3 } -func (c *sigctxt) r4() uint32 { return c.regs().r4 } -func (c *sigctxt) r5() uint32 { return c.regs().r5 } -func (c *sigctxt) r6() uint32 { return c.regs().r6 } -func (c *sigctxt) r7() uint32 { return c.regs().r7 } -func (c *sigctxt) r8() uint32 { return c.regs().r8 } -func (c *sigctxt) r9() uint32 { return c.regs().r9 } -func (c *sigctxt) r10() uint32 { return c.regs().r10 } -func (c *sigctxt) fp() uint32 { return c.regs().r11 } -func (c *sigctxt) ip() uint32 { return c.regs().r12 } -func (c *sigctxt) sp() uint32 { return c.regs().sp } -func (c *sigctxt) lr() uint32 { return c.regs().lr } - -//go:nosplit -//go:nowritebarrierrec -func (c *sigctxt) pc() uint32 { return c.regs().pc } - -func (c *sigctxt) cpsr() uint32 { return c.regs().cpsr } -func (c *sigctxt) fault() uintptr { return ^uintptr(0) } -func (c *sigctxt) trap() uint32 { return ^uint32(0) } -func (c *sigctxt) error() uint32 { return ^uint32(0) } -func (c *sigctxt) oldmask() uint32 { return ^uint32(0) } - -func (c *sigctxt) sigcode() uint32 { return 0 } -func (c *sigctxt) sigaddr() uint32 { return 0 } - -func (c *sigctxt) set_pc(x uint32) { c.regs().pc = x } -func (c *sigctxt) set_sp(x uint32) { c.regs().sp = x } -func (c *sigctxt) set_lr(x uint32) { c.regs().lr = x } -func (c *sigctxt) set_r10(x uint32) { c.regs().r10 = x } - -func (c *sigctxt) set_sigcode(x uint32) {} -func (c *sigctxt) set_sigaddr(x uint32) {} diff --git a/src/runtime/signal_sighandler.go b/src/runtime/signal_sighandler.go index bec4653218..b81957ef02 100644 --- a/src/runtime/signal_sighandler.go +++ b/src/runtime/signal_sighandler.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin dragonfly freebsd linux nacl netbsd openbsd solaris +// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris package runtime diff --git a/src/runtime/sizeof_test.go b/src/runtime/sizeof_test.go index 830055e2aa..852244d425 100644 --- a/src/runtime/sizeof_test.go +++ b/src/runtime/sizeof_test.go @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build !nacl - package runtime_test import ( diff --git a/src/runtime/stubs2.go b/src/runtime/stubs2.go index 77513386b7..cf2b124812 100644 --- a/src/runtime/stubs2.go +++ b/src/runtime/stubs2.go @@ -5,7 +5,6 @@ // +build !plan9 // +build !solaris // +build !windows -// +build !nacl // +build !js // +build !darwin // +build !aix diff --git a/src/runtime/stubs3.go b/src/runtime/stubs3.go index f81372805e..95eecc7eca 100644 --- a/src/runtime/stubs3.go +++ b/src/runtime/stubs3.go @@ -4,7 +4,6 @@ // +build !plan9 // +build !solaris -// +build !nacl // +build !freebsd // +build !darwin // +build !aix diff --git a/src/runtime/sys_nacl_386.s b/src/runtime/sys_nacl_386.s deleted file mode 100644 index 8460aabce3..0000000000 --- a/src/runtime/sys_nacl_386.s +++ /dev/null @@ -1,374 +0,0 @@ -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -#include "go_asm.h" -#include "go_tls.h" -#include "textflag.h" -#include "syscall_nacl.h" - -#define NACL_SYSCALL(code) \ - MOVL $(0x10000 + ((code)<<5)), AX; CALL AX - -TEXT runtime·exit(SB),NOSPLIT,$4 - MOVL code+0(FP), AX - MOVL AX, 0(SP) - NACL_SYSCALL(SYS_exit) - JMP 0(PC) - -// func exitThread(wait *uint32) -TEXT runtime·exitThread(SB),NOSPLIT,$4-4 - MOVL wait+0(FP), AX - // SYS_thread_exit will clear *wait when the stack is free. - MOVL AX, 0(SP) - NACL_SYSCALL(SYS_thread_exit) - JMP 0(PC) - -TEXT runtime·open(SB),NOSPLIT,$12 - MOVL name+0(FP), AX - MOVL AX, 0(SP) - MOVL mode+4(FP), AX - MOVL AX, 4(SP) - MOVL perm+8(FP), AX - MOVL AX, 8(SP) - NACL_SYSCALL(SYS_open) - MOVL AX, ret+12(FP) - RET - -TEXT runtime·closefd(SB),NOSPLIT,$4 - MOVL fd+0(FP), AX - MOVL AX, 0(SP) - NACL_SYSCALL(SYS_close) - MOVL AX, ret+4(FP) - RET - -TEXT runtime·read(SB),NOSPLIT,$12 - MOVL fd+0(FP), AX - MOVL AX, 0(SP) - MOVL p+4(FP), AX - MOVL AX, 4(SP) - MOVL n+8(FP), AX - MOVL AX, 8(SP) - NACL_SYSCALL(SYS_read) - MOVL AX, ret+12(FP) - RET - -TEXT syscall·naclWrite(SB), NOSPLIT, $16-16 - MOVL arg1+0(FP), DI - MOVL arg2+4(FP), SI - MOVL arg3+8(FP), DX - MOVL DI, 0(SP) - MOVL SI, 4(SP) - MOVL DX, 8(SP) - CALL runtime·write(SB) - MOVL AX, ret+16(FP) - RET - -TEXT runtime·write(SB),NOSPLIT,$12 - MOVL fd+0(FP), AX - MOVL AX, 0(SP) - MOVL p+4(FP), AX - MOVL AX, 4(SP) - MOVL n+8(FP), AX - MOVL AX, 8(SP) - NACL_SYSCALL(SYS_write) - MOVL AX, ret+12(FP) - RET - -TEXT runtime·nacl_exception_stack(SB),NOSPLIT,$8 - MOVL p+0(FP), AX - MOVL AX, 0(SP) - MOVL size+4(FP), AX - MOVL AX, 4(SP) - NACL_SYSCALL(SYS_exception_stack) - MOVL AX, ret+8(FP) - RET - -TEXT runtime·nacl_exception_handler(SB),NOSPLIT,$8 - MOVL fn+0(FP), AX - MOVL AX, 0(SP) - MOVL arg+4(FP), AX - MOVL AX, 4(SP) - NACL_SYSCALL(SYS_exception_handler) - MOVL AX, ret+8(FP) - RET - -TEXT runtime·nacl_sem_create(SB),NOSPLIT,$4 - MOVL flag+0(FP), AX - MOVL AX, 0(SP) - NACL_SYSCALL(SYS_sem_create) - MOVL AX, ret+4(FP) - RET - -TEXT runtime·nacl_sem_wait(SB),NOSPLIT,$4 - MOVL sem+0(FP), AX - MOVL AX, 0(SP) - NACL_SYSCALL(SYS_sem_wait) - MOVL AX, ret+4(FP) - RET - -TEXT runtime·nacl_sem_post(SB),NOSPLIT,$4 - MOVL sem+0(FP), AX - MOVL AX, 0(SP) - NACL_SYSCALL(SYS_sem_post) - MOVL AX, ret+4(FP) - RET - -TEXT runtime·nacl_mutex_create(SB),NOSPLIT,$4 - MOVL flag+0(FP), AX - MOVL AX, 0(SP) - NACL_SYSCALL(SYS_mutex_create) - MOVL AX, ret+4(FP) - RET - -TEXT runtime·nacl_mutex_lock(SB),NOSPLIT,$4 - MOVL mutex+0(FP), AX - MOVL AX, 0(SP) - NACL_SYSCALL(SYS_mutex_lock) - MOVL AX, ret+4(FP) - RET - -TEXT runtime·nacl_mutex_trylock(SB),NOSPLIT,$4 - MOVL mutex+0(FP), AX - MOVL AX, 0(SP) - NACL_SYSCALL(SYS_mutex_trylock) - MOVL AX, ret+4(FP) - RET - -TEXT runtime·nacl_mutex_unlock(SB),NOSPLIT,$4 - MOVL mutex+0(FP), AX - MOVL AX, 0(SP) - NACL_SYSCALL(SYS_mutex_unlock) - MOVL AX, ret+4(FP) - RET - -TEXT runtime·nacl_cond_create(SB),NOSPLIT,$4 - MOVL flag+0(FP), AX - MOVL AX, 0(SP) - NACL_SYSCALL(SYS_cond_create) - MOVL AX, ret+4(FP) - RET - -TEXT runtime·nacl_cond_wait(SB),NOSPLIT,$8 - MOVL cond+0(FP), AX - MOVL AX, 0(SP) - MOVL n+4(FP), AX - MOVL AX, 4(SP) - NACL_SYSCALL(SYS_cond_wait) - MOVL AX, ret+8(FP) - RET - -TEXT runtime·nacl_cond_signal(SB),NOSPLIT,$4 - MOVL cond+0(FP), AX - MOVL AX, 0(SP) - NACL_SYSCALL(SYS_cond_signal) - MOVL AX, ret+4(FP) - RET - -TEXT runtime·nacl_cond_broadcast(SB),NOSPLIT,$4 - MOVL cond+0(FP), AX - MOVL AX, 0(SP) - NACL_SYSCALL(SYS_cond_broadcast) - MOVL AX, ret+4(FP) - RET - -TEXT runtime·nacl_cond_timed_wait_abs(SB),NOSPLIT,$12 - MOVL cond+0(FP), AX - MOVL AX, 0(SP) - MOVL lock+4(FP), AX - MOVL AX, 4(SP) - MOVL ts+8(FP), AX - MOVL AX, 8(SP) - NACL_SYSCALL(SYS_cond_timed_wait_abs) - MOVL AX, ret+12(FP) - RET - -TEXT runtime·nacl_thread_create(SB),NOSPLIT,$16 - MOVL fn+0(FP), AX - MOVL AX, 0(SP) - MOVL stk+4(FP), AX - MOVL AX, 4(SP) - MOVL tls+8(FP), AX - MOVL AX, 8(SP) - MOVL xx+12(FP), AX - MOVL AX, 12(SP) - NACL_SYSCALL(SYS_thread_create) - MOVL AX, ret+16(FP) - RET - -TEXT runtime·mstart_nacl(SB),NOSPLIT,$0 - JMP runtime·mstart(SB) - -TEXT runtime·nacl_nanosleep(SB),NOSPLIT,$8 - MOVL ts+0(FP), AX - MOVL AX, 0(SP) - MOVL extra+4(FP), AX - MOVL AX, 4(SP) - NACL_SYSCALL(SYS_nanosleep) - MOVL AX, ret+8(FP) - RET - -TEXT runtime·osyield(SB),NOSPLIT,$0 - NACL_SYSCALL(SYS_sched_yield) - RET - -TEXT runtime·mmap(SB),NOSPLIT,$32 - MOVL addr+0(FP), AX - MOVL AX, 0(SP) - MOVL n+4(FP), AX - MOVL AX, 4(SP) - MOVL prot+8(FP), AX - MOVL AX, 8(SP) - MOVL flags+12(FP), AX - MOVL AX, 12(SP) - MOVL fd+16(FP), AX - MOVL AX, 16(SP) - MOVL off+20(FP), AX - MOVL AX, 24(SP) - MOVL $0, 28(SP) - LEAL 24(SP), AX - MOVL AX, 20(SP) - NACL_SYSCALL(SYS_mmap) - CMPL AX, $-4095 - JNA ok - NEGL AX - MOVL $0, p+24(FP) - MOVL AX, err+28(FP) - RET -ok: - MOVL AX, p+24(FP) - MOVL $0, err+28(FP) - RET - -TEXT runtime·walltime(SB),NOSPLIT,$20 - MOVL $0, 0(SP) // real time clock - LEAL 8(SP), AX - MOVL AX, 4(SP) // timespec - NACL_SYSCALL(SYS_clock_gettime) - MOVL 8(SP), AX // low 32 sec - MOVL 12(SP), CX // high 32 sec - MOVL 16(SP), BX // nsec - - // sec is in AX, nsec in BX - MOVL AX, sec_lo+0(FP) - MOVL CX, sec_hi+4(FP) - MOVL BX, nsec+8(FP) - RET - -TEXT syscall·now(SB),NOSPLIT,$0 - JMP runtime·walltime(SB) - -TEXT runtime·nanotime(SB),NOSPLIT,$20 - MOVL $0, 0(SP) // real time clock - LEAL 8(SP), AX - MOVL AX, 4(SP) // timespec - NACL_SYSCALL(SYS_clock_gettime) - MOVL 8(SP), AX // low 32 sec - MOVL 16(SP), BX // nsec - - // sec is in AX, nsec in BX - // convert to DX:AX nsec - MOVL $1000000000, CX - MULL CX - ADDL BX, AX - ADCL $0, DX - - MOVL AX, ret_lo+0(FP) - MOVL DX, ret_hi+4(FP) - RET - -TEXT runtime·setldt(SB),NOSPLIT,$8 - MOVL base+4(FP), BX - ADDL $0x8, BX - MOVL BX, 0(SP) - NACL_SYSCALL(SYS_tls_init) - RET - -TEXT runtime·sigtramp(SB),NOSPLIT,$0 - get_tls(CX) - - // check that g exists - MOVL g(CX), DI - CMPL DI, $0 - JNE 6(PC) - MOVL $11, BX - MOVL $0, 0(SP) - MOVL $runtime·badsignal(SB), AX - CALL AX - JMP ret - - // save g - NOP SP // tell vet SP changed - stop checking offsets - MOVL DI, 20(SP) - - // g = m->gsignal - MOVL g_m(DI), BX - MOVL m_gsignal(BX), BX - MOVL BX, g(CX) - - // copy arguments for sighandler - MOVL $11, 0(SP) // signal - MOVL $0, 4(SP) // siginfo - LEAL 8(SP), AX - MOVL AX, 8(SP) // context - MOVL DI, 12(SP) // g - - CALL runtime·sighandler(SB) - - // restore g - get_tls(CX) - MOVL 20(SP), BX - MOVL BX, g(CX) - -ret: - // Enable exceptions again. - NACL_SYSCALL(SYS_exception_clear_flag) - - // NaCl has abdicated its traditional operating system responsibility - // and declined to implement 'sigreturn'. Instead the only way to return - // to the execution of our program is to restore the registers ourselves. - // Unfortunately, that is impossible to do with strict fidelity, because - // there is no way to do the final update of PC that ends the sequence - // without either (1) jumping to a register, in which case the register ends - // holding the PC value instead of its intended value or (2) storing the PC - // on the stack and using RET, which imposes the requirement that SP is - // valid and that is okay to smash the word below it. The second would - // normally be the lesser of the two evils, except that on NaCl, the linker - // must rewrite RET into "POP reg; AND $~31, reg; JMP reg", so either way - // we are going to lose a register as a result of the incoming signal. - // Similarly, there is no way to restore EFLAGS; the usual way is to use - // POPFL, but NaCl rejects that instruction. We could inspect the bits and - // execute a sequence of instructions designed to recreate those flag - // settings, but that's a lot of work. - // - // Thankfully, Go's signal handlers never try to return directly to the - // executing code, so all the registers and EFLAGS are dead and can be - // smashed. The only registers that matter are the ones that are setting - // up for the simulated call that the signal handler has created. - // Today those registers are just PC and SP, but in case additional registers - // are relevant in the future (for example DX is the Go func context register) - // we restore as many registers as possible. - // - // We smash BP, because that's what the linker smashes during RET. - // - LEAL 72(SP), BP - MOVL 0(BP), AX - MOVL 4(BP), CX - MOVL 8(BP), DX - MOVL 12(BP), BX - MOVL 16(BP), SP - // 20(BP) is saved BP, never to be seen again - MOVL 24(BP), SI - MOVL 28(BP), DI - // 36(BP) is saved EFLAGS, never to be seen again - MOVL 32(BP), BP // saved PC - JMP BP - -// func getRandomData([]byte) -TEXT runtime·getRandomData(SB),NOSPLIT,$8-12 - MOVL arg_base+0(FP), AX - MOVL AX, 0(SP) - MOVL arg_len+4(FP), AX - MOVL AX, 4(SP) - NACL_SYSCALL(SYS_get_random_bytes) - RET diff --git a/src/runtime/sys_nacl_arm.s b/src/runtime/sys_nacl_arm.s deleted file mode 100644 index 90201683b7..0000000000 --- a/src/runtime/sys_nacl_arm.s +++ /dev/null @@ -1,312 +0,0 @@ -// Copyright 2014 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -#include "go_asm.h" -#include "go_tls.h" -#include "textflag.h" -#include "syscall_nacl.h" - -#define NACL_SYSCALL(code) \ - MOVW $(0x10000 + ((code)<<5)), R8; BL (R8) - -TEXT runtime·exit(SB),NOSPLIT,$0 - MOVW code+0(FP), R0 - NACL_SYSCALL(SYS_exit) - RET - -// func exitThread(wait *uint32) -TEXT runtime·exitThread(SB),NOSPLIT,$4-4 - MOVW wait+0(FP), R0 - // SYS_thread_exit will clear *wait when the stack is free. - NACL_SYSCALL(SYS_thread_exit) - JMP 0(PC) - -TEXT runtime·open(SB),NOSPLIT,$0 - MOVW name+0(FP), R0 - MOVW name+0(FP), R1 - MOVW name+0(FP), R2 - NACL_SYSCALL(SYS_open) - MOVW R0, ret+12(FP) - RET - -TEXT runtime·closefd(SB),NOSPLIT,$0 - MOVW fd+0(FP), R0 - NACL_SYSCALL(SYS_close) - MOVW R0, ret+4(FP) - RET - -TEXT runtime·read(SB),NOSPLIT,$0 - MOVW fd+0(FP), R0 - MOVW p+4(FP), R1 - MOVW n+8(FP), R2 - NACL_SYSCALL(SYS_read) - MOVW R0, ret+12(FP) - RET - -// func naclWrite(fd int, b []byte) int -TEXT syscall·naclWrite(SB),NOSPLIT,$0 - MOVW arg1+0(FP), R0 - MOVW arg2+4(FP), R1 - MOVW arg3+8(FP), R2 - NACL_SYSCALL(SYS_write) - MOVW R0, ret+16(FP) - RET - -TEXT runtime·write(SB),NOSPLIT,$0 - MOVW fd+0(FP), R0 - MOVW p+4(FP), R1 - MOVW n+8(FP), R2 - NACL_SYSCALL(SYS_write) - MOVW R0, ret+12(FP) - RET - -TEXT runtime·nacl_exception_stack(SB),NOSPLIT,$0 - MOVW p+0(FP), R0 - MOVW size+4(FP), R1 - NACL_SYSCALL(SYS_exception_stack) - MOVW R0, ret+8(FP) - RET - -TEXT runtime·nacl_exception_handler(SB),NOSPLIT,$0 - MOVW fn+0(FP), R0 - MOVW arg+4(FP), R1 - NACL_SYSCALL(SYS_exception_handler) - MOVW R0, ret+8(FP) - RET - -TEXT runtime·nacl_sem_create(SB),NOSPLIT,$0 - MOVW flag+0(FP), R0 - NACL_SYSCALL(SYS_sem_create) - MOVW R0, ret+4(FP) - RET - -TEXT runtime·nacl_sem_wait(SB),NOSPLIT,$0 - MOVW sem+0(FP), R0 - NACL_SYSCALL(SYS_sem_wait) - MOVW R0, ret+4(FP) - RET - -TEXT runtime·nacl_sem_post(SB),NOSPLIT,$0 - MOVW sem+0(FP), R0 - NACL_SYSCALL(SYS_sem_post) - MOVW R0, ret+4(FP) - RET - -TEXT runtime·nacl_mutex_create(SB),NOSPLIT,$0 - MOVW flag+0(FP), R0 - NACL_SYSCALL(SYS_mutex_create) - MOVW R0, ret+4(FP) - RET - -TEXT runtime·nacl_mutex_lock(SB),NOSPLIT,$0 - MOVW mutex+0(FP), R0 - NACL_SYSCALL(SYS_mutex_lock) - MOVW R0, ret+4(FP) - RET - -TEXT runtime·nacl_mutex_trylock(SB),NOSPLIT,$0 - MOVW mutex+0(FP), R0 - NACL_SYSCALL(SYS_mutex_trylock) - MOVW R0, ret+4(FP) - RET - -TEXT runtime·nacl_mutex_unlock(SB),NOSPLIT,$0 - MOVW mutex+0(FP), R0 - NACL_SYSCALL(SYS_mutex_unlock) - MOVW R0, ret+4(FP) - RET - -TEXT runtime·nacl_cond_create(SB),NOSPLIT,$0 - MOVW flag+0(FP), R0 - NACL_SYSCALL(SYS_cond_create) - MOVW R0, ret+4(FP) - RET - -TEXT runtime·nacl_cond_wait(SB),NOSPLIT,$0 - MOVW cond+0(FP), R0 - MOVW n+4(FP), R1 - NACL_SYSCALL(SYS_cond_wait) - MOVW R0, ret+8(FP) - RET - -TEXT runtime·nacl_cond_signal(SB),NOSPLIT,$0 - MOVW cond+0(FP), R0 - NACL_SYSCALL(SYS_cond_signal) - MOVW R0, ret+4(FP) - RET - -TEXT runtime·nacl_cond_broadcast(SB),NOSPLIT,$0 - MOVW cond+0(FP), R0 - NACL_SYSCALL(SYS_cond_broadcast) - MOVW R0, ret+4(FP) - RET - -TEXT runtime·nacl_cond_timed_wait_abs(SB),NOSPLIT,$0 - MOVW cond+0(FP), R0 - MOVW lock+4(FP), R1 - MOVW ts+8(FP), R2 - NACL_SYSCALL(SYS_cond_timed_wait_abs) - MOVW R0, ret+12(FP) - RET - -TEXT runtime·nacl_thread_create(SB),NOSPLIT,$0 - MOVW fn+0(FP), R0 - MOVW stk+4(FP), R1 - MOVW tls+8(FP), R2 - MOVW xx+12(FP), R3 - NACL_SYSCALL(SYS_thread_create) - MOVW R0, ret+16(FP) - RET - -TEXT runtime·mstart_nacl(SB),NOSPLIT,$0 - MOVW 0(R9), R0 // TLS - MOVW -8(R0), R1 // g - MOVW -4(R0), R2 // m - MOVW R2, g_m(R1) - MOVW R1, g - B runtime·mstart(SB) - -TEXT runtime·nacl_nanosleep(SB),NOSPLIT,$0 - MOVW ts+0(FP), R0 - MOVW extra+4(FP), R1 - NACL_SYSCALL(SYS_nanosleep) - MOVW R0, ret+8(FP) - RET - -TEXT runtime·osyield(SB),NOSPLIT,$0 - NACL_SYSCALL(SYS_sched_yield) - RET - -TEXT runtime·mmap(SB),NOSPLIT,$8 - MOVW addr+0(FP), R0 - MOVW n+4(FP), R1 - MOVW prot+8(FP), R2 - MOVW flags+12(FP), R3 - MOVW fd+16(FP), R4 - // arg6:offset should be passed as a pointer (to int64) - MOVW off+20(FP), R5 - MOVW R5, 4(R13) - MOVW $0, R6 - MOVW R6, 8(R13) - MOVW $4(R13), R5 - MOVM.DB.W [R4,R5], (R13) // arg5 and arg6 are passed on stack - NACL_SYSCALL(SYS_mmap) - MOVM.IA.W (R13), [R4, R5] - CMP $-4095, R0 - MOVW $0, R1 - RSB.HI $0, R0 - MOVW.HI R0, R1 // if error, put in R1 - MOVW.HI $0, R0 - MOVW R0, p+24(FP) - MOVW R1, err+28(FP) - RET - -TEXT runtime·walltime(SB),NOSPLIT,$16 - MOVW $0, R0 // real time clock - MOVW $4(R13), R1 - NACL_SYSCALL(SYS_clock_gettime) - MOVW 4(R13), R0 // low 32-bit sec - MOVW 8(R13), R1 // high 32-bit sec - MOVW 12(R13), R2 // nsec - MOVW R0, sec_lo+0(FP) - MOVW R1, sec_hi+4(FP) - MOVW R2, nsec+8(FP) - RET - -TEXT syscall·now(SB),NOSPLIT,$0 - B runtime·walltime(SB) - -// int64 nanotime(void) so really -// void nanotime(int64 *nsec) -TEXT runtime·nanotime(SB),NOSPLIT,$16 - MOVW $0, R0 // real time clock - MOVW $4(R13), R1 - NACL_SYSCALL(SYS_clock_gettime) - MOVW 4(R13), R0 // low 32-bit sec - MOVW 8(R13), R1 // high 32-bit sec (ignored for now) - MOVW 12(R13), R2 // nsec - MOVW $1000000000, R3 - MULLU R0, R3, (R1, R0) - MOVW $0, R4 - ADD.S R2, R0 - ADC R4, R1 - MOVW R0, ret_lo+0(FP) - MOVW R1, ret_hi+4(FP) - RET - -TEXT runtime·sigtramp(SB),NOSPLIT,$80 - // load g from thread context - MOVW $ctxt+-4(FP), R0 - MOVW (16*4+10*4)(R0), g - - // check that g exists - CMP $0, g - BNE 4(PC) - MOVW $runtime·badsignal2(SB), R11 - BL (R11) - RET - - // save g - MOVW g, R3 - MOVW g, 20(R13) - - // g = m->gsignal - MOVW g_m(g), R8 - MOVW m_gsignal(R8), g - - // copy arguments for call to sighandler - MOVW $11, R0 - MOVW R0, 4(R13) // signal - MOVW $0, R0 - MOVW R0, 8(R13) // siginfo - MOVW $ctxt+-4(FP), R0 - MOVW R0, 12(R13) // context - MOVW R3, 16(R13) // g - - BL runtime·sighandler(SB) - - // restore g - MOVW 20(R13), g - - // Enable exceptions again. - NACL_SYSCALL(SYS_exception_clear_flag) - - // Restore registers as best we can. Impossible to do perfectly. - // See comment in sys_nacl_386.s for extended rationale. - MOVW $ctxt+-4(FP), R1 - ADD $64, R1 - MOVW (0*4)(R1), R0 - MOVW (2*4)(R1), R2 - MOVW (3*4)(R1), R3 - MOVW (4*4)(R1), R4 - MOVW (5*4)(R1), R5 - MOVW (6*4)(R1), R6 - MOVW (7*4)(R1), R7 - MOVW (8*4)(R1), R8 - // cannot write to R9 - MOVW (10*4)(R1), g - MOVW (11*4)(R1), R11 - MOVW (12*4)(R1), R12 - MOVW (13*4)(R1), R13 - MOVW (14*4)(R1), R14 - MOVW (15*4)(R1), R1 - B (R1) - -nog: - MOVW $0, R0 - RET - -// func getRandomData([]byte) -TEXT runtime·getRandomData(SB),NOSPLIT,$0-12 - MOVW arg_base+0(FP), R0 - MOVW arg_len+4(FP), R1 - NACL_SYSCALL(SYS_get_random_bytes) - RET - -// Likewise, this is only valid for ARMv7+, but that's okay. -TEXT ·publicationBarrier(SB),NOSPLIT|NOFRAME,$0-0 - B runtime·armPublicationBarrier(SB) - -TEXT runtime·read_tls_fallback(SB),NOSPLIT|NOFRAME,$0 - WORD $0xe7fedef0 // NACL_INSTR_ARM_ABORT_NOW (UDF #0xEDE0) diff --git a/src/runtime/syscall_nacl.h b/src/runtime/syscall_nacl.h deleted file mode 100644 index 5ee75abdd6..0000000000 --- a/src/runtime/syscall_nacl.h +++ /dev/null @@ -1,84 +0,0 @@ -// Code generated by mknacl.sh; DO NOT EDIT. -#define SYS_null 1 -#define SYS_nameservice 2 -#define SYS_dup 8 -#define SYS_dup2 9 -#define SYS_open 10 -#define SYS_close 11 -#define SYS_read 12 -#define SYS_write 13 -#define SYS_lseek 14 -#define SYS_stat 16 -#define SYS_fstat 17 -#define SYS_chmod 18 -#define SYS_isatty 19 -#define SYS_brk 20 -#define SYS_mmap 21 -#define SYS_munmap 22 -#define SYS_getdents 23 -#define SYS_mprotect 24 -#define SYS_list_mappings 25 -#define SYS_exit 30 -#define SYS_getpid 31 -#define SYS_sched_yield 32 -#define SYS_sysconf 33 -#define SYS_gettimeofday 40 -#define SYS_clock 41 -#define SYS_nanosleep 42 -#define SYS_clock_getres 43 -#define SYS_clock_gettime 44 -#define SYS_mkdir 45 -#define SYS_rmdir 46 -#define SYS_chdir 47 -#define SYS_getcwd 48 -#define SYS_unlink 49 -#define SYS_imc_makeboundsock 60 -#define SYS_imc_accept 61 -#define SYS_imc_connect 62 -#define SYS_imc_sendmsg 63 -#define SYS_imc_recvmsg 64 -#define SYS_imc_mem_obj_create 65 -#define SYS_imc_socketpair 66 -#define SYS_mutex_create 70 -#define SYS_mutex_lock 71 -#define SYS_mutex_trylock 72 -#define SYS_mutex_unlock 73 -#define SYS_cond_create 74 -#define SYS_cond_wait 75 -#define SYS_cond_signal 76 -#define SYS_cond_broadcast 77 -#define SYS_cond_timed_wait_abs 79 -#define SYS_thread_create 80 -#define SYS_thread_exit 81 -#define SYS_tls_init 82 -#define SYS_thread_nice 83 -#define SYS_tls_get 84 -#define SYS_second_tls_set 85 -#define SYS_second_tls_get 86 -#define SYS_exception_handler 87 -#define SYS_exception_stack 88 -#define SYS_exception_clear_flag 89 -#define SYS_sem_create 100 -#define SYS_sem_wait 101 -#define SYS_sem_post 102 -#define SYS_sem_get_value 103 -#define SYS_dyncode_create 104 -#define SYS_dyncode_modify 105 -#define SYS_dyncode_delete 106 -#define SYS_test_infoleak 109 -#define SYS_test_crash 110 -#define SYS_test_syscall_1 111 -#define SYS_test_syscall_2 112 -#define SYS_futex_wait_abs 120 -#define SYS_futex_wake 121 -#define SYS_pread 130 -#define SYS_pwrite 131 -#define SYS_truncate 140 -#define SYS_lstat 141 -#define SYS_link 142 -#define SYS_rename 143 -#define SYS_symlink 144 -#define SYS_access 145 -#define SYS_readlink 146 -#define SYS_utimes 147 -#define SYS_get_random_bytes 150 diff --git a/src/runtime/testdata/testprog/signal.go b/src/runtime/testdata/testprog/signal.go index 2ccbada57b..417e105c68 100644 --- a/src/runtime/testdata/testprog/signal.go +++ b/src/runtime/testdata/testprog/signal.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build !windows,!plan9,!nacl +// +build !windows,!plan9 package main diff --git a/src/runtime/testdata/testprognet/signal.go b/src/runtime/testdata/testprognet/signal.go index a1559fe616..4d2de79d97 100644 --- a/src/runtime/testdata/testprognet/signal.go +++ b/src/runtime/testdata/testprognet/signal.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build !windows,!plan9,!nacl +// +build !windows,!plan9 // This is in testprognet instead of testprog because testprog // must not import anything (like net, but also like os/signal) diff --git a/src/runtime/time.go b/src/runtime/time.go index ac2a9aae8f..d667d11244 100644 --- a/src/runtime/time.go +++ b/src/runtime/time.go @@ -13,8 +13,6 @@ import ( // Package time knows the layout of this structure. // If this struct changes, adjust ../time/sleep.go:/runtimeTimer. -// For GOOS=nacl, package syscall knows the layout of this structure. -// If this struct changes, adjust ../syscall/net_nacl.go:/runtimeTimer. type timer struct { tb *timersBucket // the bucket the timer lives in i int // heap index diff --git a/src/runtime/time_fake.go b/src/runtime/time_fake.go index bef3a65873..c64d2994a9 100644 --- a/src/runtime/time_fake.go +++ b/src/runtime/time_fake.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. // +build faketime -// +build !nacl // +build !windows // Faketime isn't currently supported on Windows. This would require: diff --git a/src/runtime/time_nofake.go b/src/runtime/time_nofake.go index 0b153b9583..1912a94e87 100644 --- a/src/runtime/time_nofake.go +++ b/src/runtime/time_nofake.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. // +build !faketime -// +build !nacl package runtime diff --git a/src/runtime/tls_arm.s b/src/runtime/tls_arm.s index 350089abc6..bed7891368 100644 --- a/src/runtime/tls_arm.s +++ b/src/runtime/tls_arm.s @@ -33,11 +33,6 @@ // runtime.mcall assumes this function only clobbers R0 and R11. // Returns with g in R0. TEXT runtime·save_g(SB),NOSPLIT|NOFRAME,$0 -#ifdef GOOS_nacl - // nothing to do as nacl/arm does not use TLS at all. - MOVW g, R0 // preserve R0 across call to setg<> - RET -#else // If the host does not support MRC the linker will replace it with // a call to runtime.read_tls_fallback which jumps to __kuser_get_tls. // The replacement function saves LR in R11 over the call to read_tls_fallback. @@ -48,16 +43,11 @@ TEXT runtime·save_g(SB),NOSPLIT|NOFRAME,$0 MOVW g, 0(R0) MOVW g, R0 // preserve R0 across call to setg<> RET -#endif // load_g loads the g register from pthread-provided // thread-local memory, for use after calling externally compiled // ARM code that overwrote those registers. TEXT runtime·load_g(SB),NOSPLIT,$0 -#ifdef GOOS_nacl - // nothing to do as nacl/arm does not use TLS at all. - RET -#else // See save_g MRC 15, 0, R0, C13, C0, 3 // fetch TLS base pointer BIC $3, R0 // Darwin/ARM might return unaligned pointer @@ -65,7 +55,6 @@ TEXT runtime·load_g(SB),NOSPLIT,$0 ADD R11, R0 MOVW 0(R0), g RET -#endif // This is called from rt0_go, which runs on the system stack // using the initial stack allocated by the OS. @@ -78,7 +67,6 @@ TEXT runtime·load_g(SB),NOSPLIT,$0 // Declare a dummy word ($4, not $0) to make sure the // frame is 8 bytes and stays 8-byte-aligned. TEXT runtime·_initcgo(SB),NOSPLIT,$4 -#ifndef GOOS_nacl // if there is an _cgo_init, call it. MOVW _cgo_init(SB), R4 CMP $0, R4 @@ -93,7 +81,6 @@ TEXT runtime·_initcgo(SB),NOSPLIT,$4 MOVW $setg_gcc<>(SB), R1 // arg 1: setg MOVW g, R0 // arg 0: G BL (R4) // will clobber R0-R3 -#endif nocgo: RET diff --git a/src/runtime/vlop_arm.s b/src/runtime/vlop_arm.s index 41d285874d..3f28f03c48 100644 --- a/src/runtime/vlop_arm.s +++ b/src/runtime/vlop_arm.s @@ -40,9 +40,7 @@ #define Ra R11 // Be careful: Ra == R11 will be used by the linker for synthesized instructions. -// Note: this function does not have a frame. If it ever needs a frame, -// the RET instruction will clobber R12 on nacl, and the compiler's register -// allocator needs to know. +// Note: this function does not have a frame. TEXT runtime·udiv(SB),NOSPLIT|NOFRAME,$0 MOVBU internal∕cpu·ARM+const_offsetARMHasIDIVA(SB), Ra CMP $0, Ra |
