mirror of
https://github.com/golang/go
synced 2024-11-21 12:34:38 -07:00
src: Add support for 64-bit version of Plan 9
This set of changes extends the Plan 9 support to include the AMD64 architecture and should work on all versions of Plan 9. R=golang-dev, rminnich, noah.evans, rsc, minux.ma, npe CC=akskuma, golang-dev, jfflore, noah.evans https://golang.org/cl/6479052
This commit is contained in:
parent
85ce3c7241
commit
a72bebf6e1
14
include/plan9/amd64/u.h
Normal file
14
include/plan9/amd64/u.h
Normal file
@ -0,0 +1,14 @@
|
||||
// Copyright 2012 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 "/amd64/include/u.h"
|
||||
|
||||
typedef char int8;
|
||||
typedef uchar uint8;
|
||||
typedef short int16;
|
||||
typedef ushort uint16;
|
||||
typedef int int32;
|
||||
typedef uint uint32;
|
||||
typedef vlong int64;
|
||||
typedef uvlong uint64;
|
@ -310,7 +310,8 @@ patch(void)
|
||||
}
|
||||
}
|
||||
if(HEADTYPE == Hlinux || HEADTYPE == Hfreebsd
|
||||
|| HEADTYPE == Hopenbsd || HEADTYPE == Hnetbsd) {
|
||||
|| HEADTYPE == Hopenbsd || HEADTYPE == Hnetbsd
|
||||
|| HEADTYPE == Hplan9x64) {
|
||||
// ELF uses FS instead of GS.
|
||||
if(p->from.type == D_INDIR+D_GS)
|
||||
p->from.type = D_INDIR+D_FS;
|
||||
@ -444,7 +445,8 @@ dostkoff(void)
|
||||
p = appendp(p); // load g into CX
|
||||
p->as = AMOVQ;
|
||||
if(HEADTYPE == Hlinux || HEADTYPE == Hfreebsd
|
||||
|| HEADTYPE == Hopenbsd || HEADTYPE == Hnetbsd) // ELF uses FS
|
||||
|| HEADTYPE == Hopenbsd || HEADTYPE == Hnetbsd
|
||||
|| HEADTYPE == Hplan9x64) // ELF uses FS
|
||||
p->from.type = D_INDIR+D_FS;
|
||||
else
|
||||
p->from.type = D_INDIR+D_GS;
|
||||
|
@ -31,6 +31,10 @@ TEXT _rt0_amd64(SB),7,$-8
|
||||
JEQ ok
|
||||
|
||||
needtls:
|
||||
// skip TLS setup on Plan 9
|
||||
CMPL runtime·isplan9(SB), $1
|
||||
JEQ ok
|
||||
|
||||
LEAQ runtime·tls0(SB), DI
|
||||
CALL runtime·settls(SB)
|
||||
|
||||
|
@ -1,2 +1,3 @@
|
||||
// nothing to see here
|
||||
#define tos_pid 48
|
||||
#define PAGESIZE 0x1000
|
||||
|
3
src/pkg/runtime/defs_plan9_amd64.h
Normal file
3
src/pkg/runtime/defs_plan9_amd64.h
Normal file
@ -0,0 +1,3 @@
|
||||
// nothing to see here
|
||||
#define tos_pid 64
|
||||
#define PAGESIZE 0x200000ULL
|
@ -3,6 +3,7 @@
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
#include "runtime.h"
|
||||
#include "defs_GOOS_GOARCH.h"
|
||||
#include "arch_GOARCH.h"
|
||||
#include "malloc.h"
|
||||
#include "os_GOOS.h"
|
||||
@ -13,7 +14,7 @@ static Lock memlock;
|
||||
|
||||
enum
|
||||
{
|
||||
Round = 4095
|
||||
Round = PAGESIZE-1
|
||||
};
|
||||
|
||||
void*
|
||||
|
@ -9,7 +9,7 @@ int32 runtime·pwrite(int32 fd, void *buf, int32 nbytes, int64 offset);
|
||||
int32 runtime·read(int32 fd, void *buf, int32 nbytes);
|
||||
int32 runtime·close(int32 fd);
|
||||
void runtime·exits(int8* msg);
|
||||
int32 runtime·brk_(void*);
|
||||
intptr runtime·brk_(void*);
|
||||
int32 runtime·sleep(int32 ms);
|
||||
int32 runtime·rfork(int32 flags, void *stk, M *m, G *g, void (*fn)(void));
|
||||
int32 runtime·plan9_semacquire(uint32 *addr, int32 block);
|
||||
|
13
src/pkg/runtime/rt0_plan9_amd64.s
Normal file
13
src/pkg/runtime/rt0_plan9_amd64.s
Normal file
@ -0,0 +1,13 @@
|
||||
// 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.
|
||||
|
||||
TEXT _rt0_amd64_plan9(SB),7, $0
|
||||
MOVQ AX, _tos(SB)
|
||||
MOVQ $_rt0_amd64(SB), AX
|
||||
MOVQ SP, DI
|
||||
JMP AX
|
||||
|
||||
DATA runtime·isplan9(SB)/4, $1
|
||||
GLOBL runtime·isplan9(SB), $4
|
||||
GLOBL _tos(SB), $8
|
19
src/pkg/runtime/signal_plan9_amd64.c
Normal file
19
src/pkg/runtime/signal_plan9_amd64.c
Normal file
@ -0,0 +1,19 @@
|
||||
// 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.
|
||||
|
||||
#include "runtime.h"
|
||||
|
||||
void
|
||||
runtime·sigenable(uint32 sig)
|
||||
{
|
||||
USED(sig);
|
||||
}
|
||||
|
||||
void
|
||||
runtime·resetcpuprofiler(int32 hz)
|
||||
{
|
||||
// TODO: Enable profiling interrupts.
|
||||
|
||||
m->profilehz = hz;
|
||||
}
|
124
src/pkg/runtime/sys_plan9_amd64.s
Normal file
124
src/pkg/runtime/sys_plan9_amd64.s
Normal file
@ -0,0 +1,124 @@
|
||||
// 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.
|
||||
|
||||
#include "defs_GOOS_GOARCH.h"
|
||||
#include "zasm_GOOS_GOARCH.h"
|
||||
|
||||
// setldt(int entry, int address, int limit)
|
||||
TEXT runtime·setldt(SB),7,$0
|
||||
RET
|
||||
|
||||
TEXT runtime·open(SB),7,$0
|
||||
MOVQ $0x8000, AX
|
||||
MOVQ $14, BP
|
||||
SYSCALL
|
||||
RET
|
||||
|
||||
TEXT runtime·pread(SB),7,$0
|
||||
MOVQ $0x8000, AX
|
||||
MOVQ $50, BP
|
||||
SYSCALL
|
||||
RET
|
||||
|
||||
TEXT runtime·pwrite(SB),7,$0
|
||||
MOVQ $0x8000, AX
|
||||
MOVQ $51, BP
|
||||
SYSCALL
|
||||
RET
|
||||
|
||||
TEXT runtime·close(SB),7,$0
|
||||
MOVQ $0x8000, AX
|
||||
MOVQ $4, BP
|
||||
SYSCALL
|
||||
RET
|
||||
|
||||
TEXT runtime·exits(SB),7,$0
|
||||
MOVQ $0x8000, AX
|
||||
MOVQ $8, BP
|
||||
SYSCALL
|
||||
RET
|
||||
|
||||
TEXT runtime·brk_(SB),7,$0
|
||||
MOVQ $0x8000, AX
|
||||
MOVQ $24, BP
|
||||
SYSCALL
|
||||
RET
|
||||
|
||||
TEXT runtime·sleep(SB),7,$0
|
||||
MOVQ $0x8000, AX
|
||||
MOVQ $17, BP
|
||||
SYSCALL
|
||||
RET
|
||||
|
||||
TEXT runtime·plan9_semacquire(SB),7,$0
|
||||
MOVQ $0x8000, AX
|
||||
MOVQ $37, BP
|
||||
SYSCALL
|
||||
RET
|
||||
|
||||
TEXT runtime·plan9_tsemacquire(SB),7,$0
|
||||
MOVQ $0x8000, AX
|
||||
MOVQ $52, BP
|
||||
SYSCALL
|
||||
RET
|
||||
|
||||
TEXT runtime·notify(SB),7,$0
|
||||
MOVQ $0x8000, AX
|
||||
MOVQ $28, BP
|
||||
SYSCALL
|
||||
RET
|
||||
|
||||
TEXT runtime·noted(SB),7,$0
|
||||
MOVQ $0x8000, AX
|
||||
MOVQ $29, BP
|
||||
SYSCALL
|
||||
RET
|
||||
|
||||
TEXT runtime·plan9_semrelease(SB),7,$0
|
||||
MOVQ $0x8000, AX
|
||||
MOVQ $38, BP
|
||||
SYSCALL
|
||||
RET
|
||||
|
||||
TEXT runtime·rfork(SB),7,$0
|
||||
MOVQ $0x8000, AX
|
||||
MOVQ $19, BP // rfork
|
||||
SYSCALL
|
||||
|
||||
// In parent, return.
|
||||
CMPQ AX, $0
|
||||
JEQ 2(PC)
|
||||
RET
|
||||
|
||||
// In child on forked stack.
|
||||
MOVQ mm+24(SP), BX // m
|
||||
MOVQ gg+32(SP), DX // g
|
||||
MOVQ fn+40(SP), SI // fn
|
||||
|
||||
// set SP to be on the new child stack
|
||||
MOVQ stack+16(SP), CX
|
||||
MOVQ CX, SP
|
||||
|
||||
// Initialize m, g.
|
||||
get_tls(AX)
|
||||
MOVQ DX, g(AX)
|
||||
MOVQ BX, m(AX)
|
||||
|
||||
// Initialize AX from _tos->pid
|
||||
MOVQ _tos(SB), AX
|
||||
MOVQ tos_pid(AX), AX
|
||||
MOVQ AX, m_procid(BX) // save pid as m->procid
|
||||
|
||||
CALL runtime·stackcheck(SB) // smashes AX, CX
|
||||
|
||||
MOVQ 0(DX), DX // paranoia; check they are not nil
|
||||
MOVQ 0(BX), BX
|
||||
|
||||
CALL SI // fn()
|
||||
CALL runtime·exit(SB)
|
||||
RET
|
||||
|
||||
// This is needed by asm_amd64.s
|
||||
TEXT runtime·settls(SB),7,$0
|
||||
RET
|
166
src/pkg/syscall/asm_plan9_amd64.s
Normal file
166
src/pkg/syscall/asm_plan9_amd64.s
Normal file
@ -0,0 +1,166 @@
|
||||
// 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.
|
||||
|
||||
//
|
||||
// System call support for Plan 9
|
||||
//
|
||||
|
||||
//func Syscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err string)
|
||||
//func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err string)
|
||||
//func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2, err uintptr)
|
||||
//func RawSyscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2, err uintptr)
|
||||
|
||||
// Trap # in BP, args on stack above caller pc.
|
||||
// NxM requires that Plan 9 system calls be
|
||||
// marked with $0x8000 in AX.
|
||||
TEXT ·Syscall(SB),7,$0
|
||||
CALL runtime·entersyscall(SB)
|
||||
MOVQ $0x8000, AX // for NxM
|
||||
MOVQ 8(SP), BP // syscall entry
|
||||
// slide args down on top of system call number
|
||||
LEAQ 16(SP), SI
|
||||
LEAQ 8(SP), DI
|
||||
CLD
|
||||
MOVSQ
|
||||
MOVSQ
|
||||
MOVSQ
|
||||
SYSCALL
|
||||
MOVQ AX, r1+40(SP)
|
||||
MOVQ $0, r2+48(SP)
|
||||
CMPQ AX, $-1
|
||||
JNE ok3
|
||||
|
||||
SUBQ $16, SP
|
||||
CALL syscall·errstr(SB)
|
||||
MOVQ SP, SI
|
||||
ADDQ $16, SP
|
||||
JMP copyresult3
|
||||
|
||||
ok3:
|
||||
LEAQ runtime·emptystring(SB), SI
|
||||
|
||||
copyresult3:
|
||||
LEAQ err+56(SP), DI
|
||||
|
||||
CLD
|
||||
MOVSQ
|
||||
MOVSQ
|
||||
|
||||
CALL runtime·exitsyscall(SB)
|
||||
RET
|
||||
|
||||
TEXT ·Syscall6(SB),7,$0
|
||||
CALL runtime·entersyscall(SB)
|
||||
MOVQ $0x8000, AX // for NxM
|
||||
MOVQ 8(SP), BP // syscall entry
|
||||
// slide args down on top of system call number
|
||||
LEAQ 16(SP), SI
|
||||
LEAQ 8(SP), DI
|
||||
CLD
|
||||
MOVSQ
|
||||
MOVSQ
|
||||
MOVSQ
|
||||
MOVSQ
|
||||
MOVSQ
|
||||
MOVSQ
|
||||
SYSCALL
|
||||
MOVQ AX, r1+64(SP)
|
||||
MOVQ $0, r2+72(SP)
|
||||
CMPQ AX, $-1
|
||||
JNE ok4
|
||||
|
||||
SUBQ $16, SP
|
||||
CALL syscall·errstr(SB)
|
||||
MOVQ SP, SI
|
||||
ADDQ $16, SP
|
||||
JMP copyresult4
|
||||
|
||||
ok4:
|
||||
LEAQ runtime·emptystring(SB), SI
|
||||
|
||||
copyresult4:
|
||||
LEAQ err+80(SP), DI
|
||||
|
||||
CLD
|
||||
MOVSL
|
||||
MOVSL
|
||||
|
||||
CALL runtime·exitsyscall(SB)
|
||||
RET
|
||||
|
||||
TEXT ·RawSyscall(SB),7,$0
|
||||
MOVQ $0x8000, AX // for NxM
|
||||
MOVQ 8(SP), BP // syscall entry
|
||||
// slide args down on top of system call number
|
||||
LEAQ 16(SP), SI
|
||||
LEAQ 8(SP), DI
|
||||
CLD
|
||||
MOVSQ
|
||||
MOVSQ
|
||||
MOVSQ
|
||||
SYSCALL
|
||||
MOVQ AX, r1+40(SP)
|
||||
MOVQ AX, r2+48(SP)
|
||||
MOVQ AX, err+56(SP)
|
||||
RET
|
||||
|
||||
TEXT ·RawSyscall6(SB),7,$0
|
||||
MOVQ $0x8000, AX // for NxM
|
||||
MOVQ 8(SP), BP // syscall entry
|
||||
// slide args down on top of system call number
|
||||
LEAQ 16(SP), SI
|
||||
LEAQ 8(SP), DI
|
||||
CLD
|
||||
MOVSQ
|
||||
MOVSQ
|
||||
MOVSQ
|
||||
MOVSQ
|
||||
MOVSQ
|
||||
MOVSQ
|
||||
SYSCALL
|
||||
MOVQ AX, r1+64(SP)
|
||||
MOVQ AX, r2+72(SP)
|
||||
MOVQ AX, err+80(SP)
|
||||
RET
|
||||
|
||||
#define SYS_SEEK 39 /* from zsysnum_plan9_amd64.go */
|
||||
|
||||
//func seek(placeholder uintptr, fd int, offset int64, whence int) (newoffset int64, err string)
|
||||
TEXT ·seek(SB),7,$0
|
||||
LEAQ newoffset+48(SP), AX
|
||||
MOVQ AX, placeholder+8(SP)
|
||||
|
||||
MOVQ $0x8000, AX // for NxM
|
||||
MOVQ $SYS_SEEK, BP // syscall entry
|
||||
SYSCALL
|
||||
|
||||
CMPQ AX, $-1
|
||||
JNE ok6
|
||||
MOVQ AX, 48(SP) // newoffset low
|
||||
MOVQ AX, 56(SP) // newoffset high
|
||||
|
||||
SUBQ $16, SP
|
||||
CALL syscall·errstr(SB)
|
||||
MOVQ SP, SI
|
||||
ADDQ $16, SP
|
||||
JMP copyresult6
|
||||
|
||||
ok6:
|
||||
LEAQ runtime·emptystring(SB), SI
|
||||
|
||||
copyresult6:
|
||||
LEAQ err+64(SP), DI
|
||||
|
||||
CLD
|
||||
MOVSQ
|
||||
MOVSQ
|
||||
RET
|
||||
|
||||
//func exit(code int)
|
||||
// Import runtime·exit for cleanly exiting.
|
||||
TEXT ·exit(SB),7,$8
|
||||
MOVQ code+0(FP), AX
|
||||
MOVQ AX, 0(SP)
|
||||
CALL runtime·exit(SB)
|
||||
RET
|
@ -77,8 +77,6 @@ func errstr() string {
|
||||
return cstring(buf[:])
|
||||
}
|
||||
|
||||
func Getpagesize() int { return 4096 }
|
||||
|
||||
// Implemented in assembly to import from runtime.
|
||||
func exit(int)
|
||||
|
||||
|
@ -3,3 +3,5 @@
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package syscall
|
||||
|
||||
func Getpagesize() int { return 0x1000 }
|
||||
|
7
src/pkg/syscall/syscall_plan9_amd64.go
Normal file
7
src/pkg/syscall/syscall_plan9_amd64.go
Normal file
@ -0,0 +1,7 @@
|
||||
// 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 syscall
|
||||
|
||||
func Getpagesize() int { return 0x200000 }
|
39
src/pkg/syscall/zerrors_plan9_amd64.go
Normal file
39
src/pkg/syscall/zerrors_plan9_amd64.go
Normal file
@ -0,0 +1,39 @@
|
||||
// Copyright 2011 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 syscall
|
||||
|
||||
import "errors"
|
||||
|
||||
// Constants
|
||||
const (
|
||||
// Invented values to support what package os expects.
|
||||
O_CREAT = 0x02000
|
||||
O_APPEND = 0x00400
|
||||
O_NOCTTY = 0x00000
|
||||
O_NONBLOCK = 0x00000
|
||||
O_SYNC = 0x00000
|
||||
O_ASYNC = 0x00000
|
||||
|
||||
S_IFMT = 0x1f000
|
||||
S_IFIFO = 0x1000
|
||||
S_IFCHR = 0x2000
|
||||
S_IFDIR = 0x4000
|
||||
S_IFBLK = 0x6000
|
||||
S_IFREG = 0x8000
|
||||
S_IFLNK = 0xa000
|
||||
S_IFSOCK = 0xc000
|
||||
)
|
||||
|
||||
// Errors
|
||||
var (
|
||||
EINVAL = errors.New("bad arg in system call")
|
||||
ENOTDIR = errors.New("not a directory")
|
||||
ENOENT = errors.New("file does not exist")
|
||||
EEXIST = errors.New("file already exists")
|
||||
EIO = errors.New("i/o error")
|
||||
ENAMETOOLONG = errors.New("file name too long")
|
||||
EPERM = errors.New("permission denied")
|
||||
EPLAN9 = errors.New("not supported by plan 9")
|
||||
)
|
239
src/pkg/syscall/zsyscall_plan9_amd64.go
Normal file
239
src/pkg/syscall/zsyscall_plan9_amd64.go
Normal file
@ -0,0 +1,239 @@
|
||||
// mksyscall.pl -l32 -plan9 syscall_plan9.go syscall_plan9_386.go
|
||||
// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
|
||||
|
||||
package syscall
|
||||
|
||||
import "unsafe"
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func exits(msg *byte) {
|
||||
Syscall(SYS_EXITS, uintptr(unsafe.Pointer(msg)), 0, 0)
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func fd2path(fd int, buf []byte) (err error) {
|
||||
var _p0 unsafe.Pointer
|
||||
if len(buf) > 0 {
|
||||
_p0 = unsafe.Pointer(&buf[0])
|
||||
} else {
|
||||
_p0 = unsafe.Pointer(&_zero)
|
||||
}
|
||||
r0, _, e1 := Syscall(SYS_FD2PATH, uintptr(fd), uintptr(_p0), uintptr(len(buf)))
|
||||
if int(r0) == -1 {
|
||||
err = e1
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func pipe(p *[2]_C_int) (err error) {
|
||||
r0, _, e1 := Syscall(SYS_PIPE, uintptr(unsafe.Pointer(p)), 0, 0)
|
||||
if int(r0) == -1 {
|
||||
err = e1
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func await(s []byte) (n int, err error) {
|
||||
var _p0 unsafe.Pointer
|
||||
if len(s) > 0 {
|
||||
_p0 = unsafe.Pointer(&s[0])
|
||||
} else {
|
||||
_p0 = unsafe.Pointer(&_zero)
|
||||
}
|
||||
r0, _, e1 := Syscall(SYS_AWAIT, uintptr(_p0), uintptr(len(s)), 0)
|
||||
n = int(r0)
|
||||
if int(r0) == -1 {
|
||||
err = e1
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Dup(oldfd int, newfd int) (fd int, err error) {
|
||||
r0, _, e1 := Syscall(SYS_DUP, uintptr(oldfd), uintptr(newfd), 0)
|
||||
fd = int(r0)
|
||||
if int(r0) == -1 {
|
||||
err = e1
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Open(path string, mode int) (fd int, err error) {
|
||||
r0, _, e1 := Syscall(SYS_OPEN, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(mode), 0)
|
||||
fd = int(r0)
|
||||
if int(r0) == -1 {
|
||||
err = e1
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Create(path string, mode int, perm uint32) (fd int, err error) {
|
||||
r0, _, e1 := Syscall(SYS_CREATE, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(mode), uintptr(perm))
|
||||
fd = int(r0)
|
||||
if int(r0) == -1 {
|
||||
err = e1
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Remove(path string) (err error) {
|
||||
r0, _, e1 := Syscall(SYS_REMOVE, uintptr(unsafe.Pointer(StringBytePtr(path))), 0, 0)
|
||||
if int(r0) == -1 {
|
||||
err = e1
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Pread(fd int, p []byte, offset int64) (n int, err error) {
|
||||
var _p0 unsafe.Pointer
|
||||
if len(p) > 0 {
|
||||
_p0 = unsafe.Pointer(&p[0])
|
||||
} else {
|
||||
_p0 = unsafe.Pointer(&_zero)
|
||||
}
|
||||
r0, _, e1 := Syscall6(SYS_PREAD, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), uintptr(offset>>32), 0)
|
||||
n = int(r0)
|
||||
if int(r0) == -1 {
|
||||
err = e1
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Pwrite(fd int, p []byte, offset int64) (n int, err error) {
|
||||
var _p0 unsafe.Pointer
|
||||
if len(p) > 0 {
|
||||
_p0 = unsafe.Pointer(&p[0])
|
||||
} else {
|
||||
_p0 = unsafe.Pointer(&_zero)
|
||||
}
|
||||
r0, _, e1 := Syscall6(SYS_PWRITE, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), uintptr(offset>>32), 0)
|
||||
n = int(r0)
|
||||
if int(r0) == -1 {
|
||||
err = e1
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Close(fd int) (err error) {
|
||||
r0, _, e1 := Syscall(SYS_CLOSE, uintptr(fd), 0, 0)
|
||||
if int(r0) == -1 {
|
||||
err = e1
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Chdir(path string) (err error) {
|
||||
r0, _, e1 := Syscall(SYS_CHDIR, uintptr(unsafe.Pointer(StringBytePtr(path))), 0, 0)
|
||||
if int(r0) == -1 {
|
||||
err = e1
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Bind(name string, old string, flag int) (err error) {
|
||||
r0, _, e1 := Syscall(SYS_BIND, uintptr(unsafe.Pointer(StringBytePtr(name))), uintptr(unsafe.Pointer(StringBytePtr(old))), uintptr(flag))
|
||||
if int(r0) == -1 {
|
||||
err = e1
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Mount(fd int, afd int, old string, flag int, aname string) (err error) {
|
||||
r0, _, e1 := Syscall6(SYS_MOUNT, uintptr(fd), uintptr(afd), uintptr(unsafe.Pointer(StringBytePtr(old))), uintptr(flag), uintptr(unsafe.Pointer(StringBytePtr(aname))), 0)
|
||||
if int(r0) == -1 {
|
||||
err = e1
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Stat(path string, edir []byte) (n int, err error) {
|
||||
var _p0 unsafe.Pointer
|
||||
if len(edir) > 0 {
|
||||
_p0 = unsafe.Pointer(&edir[0])
|
||||
} else {
|
||||
_p0 = unsafe.Pointer(&_zero)
|
||||
}
|
||||
r0, _, e1 := Syscall(SYS_STAT, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(_p0), uintptr(len(edir)))
|
||||
n = int(r0)
|
||||
if int(r0) == -1 {
|
||||
err = e1
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Fstat(fd int, edir []byte) (n int, err error) {
|
||||
var _p0 unsafe.Pointer
|
||||
if len(edir) > 0 {
|
||||
_p0 = unsafe.Pointer(&edir[0])
|
||||
} else {
|
||||
_p0 = unsafe.Pointer(&_zero)
|
||||
}
|
||||
r0, _, e1 := Syscall(SYS_FSTAT, uintptr(fd), uintptr(_p0), uintptr(len(edir)))
|
||||
n = int(r0)
|
||||
if int(r0) == -1 {
|
||||
err = e1
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Wstat(path string, edir []byte) (err error) {
|
||||
var _p0 unsafe.Pointer
|
||||
if len(edir) > 0 {
|
||||
_p0 = unsafe.Pointer(&edir[0])
|
||||
} else {
|
||||
_p0 = unsafe.Pointer(&_zero)
|
||||
}
|
||||
r0, _, e1 := Syscall(SYS_WSTAT, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(_p0), uintptr(len(edir)))
|
||||
if int(r0) == -1 {
|
||||
err = e1
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Fwstat(fd int, edir []byte) (err error) {
|
||||
var _p0 unsafe.Pointer
|
||||
if len(edir) > 0 {
|
||||
_p0 = unsafe.Pointer(&edir[0])
|
||||
} else {
|
||||
_p0 = unsafe.Pointer(&_zero)
|
||||
}
|
||||
r0, _, e1 := Syscall(SYS_FWSTAT, uintptr(fd), uintptr(_p0), uintptr(len(edir)))
|
||||
if int(r0) == -1 {
|
||||
err = e1
|
||||
}
|
||||
return
|
||||
}
|
47
src/pkg/syscall/zsysnum_plan9_amd64.go
Normal file
47
src/pkg/syscall/zsysnum_plan9_amd64.go
Normal file
@ -0,0 +1,47 @@
|
||||
// mksysnum_plan9.sh /media/sys/src/libc/9syscall/sys.h
|
||||
// MACHINE GENERATED BY THE ABOVE COMMAND; DO NOT EDIT
|
||||
|
||||
package syscall
|
||||
|
||||
const (
|
||||
SYS_SYSR1 = 0
|
||||
SYS_BIND = 2
|
||||
SYS_CHDIR = 3
|
||||
SYS_CLOSE = 4
|
||||
SYS_DUP = 5
|
||||
SYS_ALARM = 6
|
||||
SYS_EXEC = 7
|
||||
SYS_EXITS = 8
|
||||
SYS_FAUTH = 10
|
||||
SYS_SEGBRK = 12
|
||||
SYS_OPEN = 14
|
||||
SYS_OSEEK = 16
|
||||
SYS_SLEEP = 17
|
||||
SYS_RFORK = 19
|
||||
SYS_PIPE = 21
|
||||
SYS_CREATE = 22
|
||||
SYS_FD2PATH = 23
|
||||
SYS_BRK_ = 24
|
||||
SYS_REMOVE = 25
|
||||
SYS_NOTIFY = 28
|
||||
SYS_NOTED = 29
|
||||
SYS_SEGATTACH = 30
|
||||
SYS_SEGDETACH = 31
|
||||
SYS_SEGFREE = 32
|
||||
SYS_SEGFLUSH = 33
|
||||
SYS_RENDEZVOUS = 34
|
||||
SYS_UNMOUNT = 35
|
||||
SYS_SEMACQUIRE = 37
|
||||
SYS_SEMRELEASE = 38
|
||||
SYS_SEEK = 39
|
||||
SYS_FVERSION = 40
|
||||
SYS_ERRSTR = 41
|
||||
SYS_STAT = 42
|
||||
SYS_FSTAT = 43
|
||||
SYS_WSTAT = 44
|
||||
SYS_FWSTAT = 45
|
||||
SYS_MOUNT = 46
|
||||
SYS_AWAIT = 47
|
||||
SYS_PREAD = 50
|
||||
SYS_PWRITE = 51
|
||||
)
|
75
src/pkg/syscall/ztypes_plan9_amd64.go
Normal file
75
src/pkg/syscall/ztypes_plan9_amd64.go
Normal file
@ -0,0 +1,75 @@
|
||||
// godefs -gsyscall -f -m32 types_plan9.c
|
||||
|
||||
// MACHINE GENERATED - DO NOT EDIT.
|
||||
|
||||
package syscall
|
||||
|
||||
// Constants
|
||||
const (
|
||||
O_RDONLY = 0
|
||||
O_WRONLY = 0x1
|
||||
O_RDWR = 0x2
|
||||
O_TRUNC = 0x10
|
||||
O_CLOEXEC = 0x20
|
||||
O_EXCL = 0x1000
|
||||
STATMAX = 0xffff
|
||||
ERRMAX = 0x80
|
||||
MORDER = 0x3
|
||||
MREPL = 0
|
||||
MBEFORE = 0x1
|
||||
MAFTER = 0x2
|
||||
MCREATE = 0x4
|
||||
MCACHE = 0x10
|
||||
MMASK = 0x17
|
||||
RFNAMEG = 0x1
|
||||
RFENVG = 0x2
|
||||
RFFDG = 0x4
|
||||
RFNOTEG = 0x8
|
||||
RFPROC = 0x10
|
||||
RFMEM = 0x20
|
||||
RFNOWAIT = 0x40
|
||||
RFCNAMEG = 0x400
|
||||
RFCENVG = 0x800
|
||||
RFCFDG = 0x1000
|
||||
RFREND = 0x2000
|
||||
RFNOMNT = 0x4000
|
||||
QTDIR = 0x80
|
||||
QTAPPEND = 0x40
|
||||
QTEXCL = 0x20
|
||||
QTMOUNT = 0x10
|
||||
QTAUTH = 0x8
|
||||
QTTMP = 0x4
|
||||
QTFILE = 0
|
||||
DMDIR = 0x80000000
|
||||
DMAPPEND = 0x40000000
|
||||
DMEXCL = 0x20000000
|
||||
DMMOUNT = 0x10000000
|
||||
DMAUTH = 0x8000000
|
||||
DMTMP = 0x4000000
|
||||
DMREAD = 0x4
|
||||
DMWRITE = 0x2
|
||||
DMEXEC = 0x1
|
||||
STATFIXLEN = 0x31
|
||||
)
|
||||
|
||||
// Types
|
||||
|
||||
type _C_int int32
|
||||
|
||||
type Prof struct {
|
||||
Pp *[0]byte /* sPlink */
|
||||
Next *[0]byte /* sPlink */
|
||||
Last *[0]byte /* sPlink */
|
||||
First *[0]byte /* sPlink */
|
||||
Pid uint32
|
||||
What uint32
|
||||
}
|
||||
|
||||
type Tos struct {
|
||||
Prof Prof
|
||||
Cyclefreq uint64
|
||||
Kcycles int64
|
||||
Pcycles int64
|
||||
Pid uint32
|
||||
Clock uint32
|
||||
}
|
Loading…
Reference in New Issue
Block a user