Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Netdev2 #3452

Closed
wants to merge 184 commits into from
Closed

Netdev2 #3452

Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
184 commits
Select commit Hold shift + click to select a range
630419b
fresh netdev checkin preparing for PR
scottfeldman Feb 10, 2023
b276cbe
Documentation and cleanup of net package
scottfeldman Feb 10, 2023
825be63
fix goroot override paths to pickup all of net package
scottfeldman Feb 13, 2023
1c22640
gofmt -l -w -s
scottfeldman Feb 13, 2023
eacce0c
cleanup to sync with 1.19.3 Go as much as possible
scottfeldman Feb 16, 2023
f6df276
runtime: allow custom-gc SetFinalizer and clarify KeepAlive
anuraaga Feb 16, 2023
012bdfa
build: always cache LLVM source/build even if the tests fail to avoid…
deadprogram Feb 17, 2023
ebb410a
reflect: make sure null bytes are supported in tags
aykevl Jan 10, 2023
4e84531
all: refactor reflect package
aykevl Jun 23, 2022
eff7832
add missing pipe.go back; it got left out in netdev conversion
scottfeldman Feb 17, 2023
8445754
add some net package tests for smoketest
scottfeldman Feb 17, 2023
e21ab04
machine/usb/hid: add MediaKey support (#3436)
sago35 Feb 18, 2023
361ecf9
Better handling of sub-clusters in SVD (#3335)
ya-mouse Feb 18, 2023
c02cc33
runtime: implement KeepAlive using inline assembly
aykevl Feb 17, 2023
87cfe6a
build/docker: trigger all builds in tinygo ecosystem repos using GH a…
deadprogram Feb 18, 2023
f6758d2
build/linux: install wasmtime directly from github release
deadprogram Feb 18, 2023
7982d26
docker: ignore changes to CI itself to avoid breaking cache on images
deadprogram Feb 18, 2023
1125d42
build/docker: use build context from pre-saved LLVM container to avoi…
deadprogram Feb 18, 2023
9296332
fix bad qt py pin assignment
andyshinn Feb 18, 2023
cacb452
main: support qemu-user debugging
aykevl Feb 18, 2023
e066e67
machine/rp2040: change calling order for device enumeration fix to do…
deadprogram Feb 16, 2023
f41b6a3
runtime: check for heap allocations inside interrupts
aykevl Oct 25, 2020
cce9c6d
arm64: fix register save/restore to include vector registers
aykevl Feb 19, 2023
ec27d9f
ci: don't pass -v to `go test`
aykevl Feb 19, 2023
1065f06
machine/lorae5: add needed definition for UART2
deadprogram Feb 20, 2023
df459c3
move netdev from drivers
scottfeldman Feb 21, 2023
0d0c925
README: consolidate net and netdev readmes
scottfeldman Feb 21, 2023
1843bc8
remove parse_test.go because on file support
scottfeldman Feb 21, 2023
0b15c26
remove parse_test.go because on file support
scottfeldman Feb 21, 2023
4d0dfbd
rp2040: rtc delayed interrupt
ysoldak Jan 19, 2023
96b70fd
rp2040: provide better errors for invalid pins on i2c and spi (#3443)
soypat Feb 23, 2023
6df303f
machine/rp2040: correct issue with i2c pin validation
deadprogram Feb 23, 2023
ad1da7d
machine/rp2040: correct issue with spi pin validation
deadprogram Feb 23, 2023
bad7bfc
Pins D4 & D5 are I2C1. Use pins D2 & D3 for I2C0.
inindev Feb 19, 2023
cfe971d
Rearrange switch case for get pin cfg
bpoetzschke Feb 23, 2023
7b44fcd
runtime: properly turn pointer into empty interface when hashing
dgryski Feb 25, 2023
4766217
compiler: zero struct padding during map operations
dgryski Feb 25, 2023
201592d
ci: add AVR timers test
aykevl Feb 25, 2023
4881747
builder: remove non-ThinLTO build mode
aykevl Feb 26, 2023
8bf94b9
internal/task: disallow blocking inside an interrupt
aykevl Feb 22, 2023
6e1b8a5
machine/stm32, nrf: flash API (#3472)
deadprogram Feb 27, 2023
74160c0
runtime/atsamd51: enable CMCC cache for greatly improved performance …
deadprogram Feb 27, 2023
ea183e9
compiler: add llvm.ident metadata
aykevl Feb 26, 2023
cdf7856
Fail earlier if Go is not available
fgsch Feb 27, 2023
60a93e8
compiler, reflect: add map key and element type info
dgryski Feb 15, 2023
9541525
reflect: add Type.Elem() and Type.Key() for Maps
dgryski Feb 25, 2023
c0a50e9
runtime: add unsafe.pointer reflect wrappers for hashmap calls
dgryski Feb 25, 2023
d0f4702
reflect: add MapIndex()
dgryski Feb 25, 2023
f6ee470
reflect: add MapRange/MapIter
dgryski Feb 25, 2023
828c316
reflect: add SetMapIndex()
dgryski Feb 25, 2023
c4dadba
reflect: add MakeMap()
dgryski Feb 25, 2023
a2bb1d3
reflect: add MapKeys()
dgryski Feb 25, 2023
1cce1ea
reflect: uncomment some DeepEqual tests that now pass
dgryski Feb 25, 2023
517098c
transform: fix non-determinism in the interface lowering pass
aykevl Mar 2, 2023
9b86080
runtime: add sliceGrow function for reflect
dgryski Feb 26, 2023
836689f
reflect: add Append()
dgryski Feb 26, 2023
5cc5f11
reflect: add MakeSlice()
dgryski Feb 26, 2023
43a4b25
reflect: add Slice()
dgryski Feb 26, 2023
a7e3cf0
reflect: add Slice3()
dgryski Feb 26, 2023
12e3d1d
reflect: add Copy()
dgryski Feb 26, 2023
d98c0af
reflect: add Bytes()
dgryski Feb 26, 2023
4ec1e58
all: use unsafe.Add instead of unsafe.Pointer(uintptr(...) + ...)
aykevl Dec 21, 2022
ca823f9
compiler: remove unsafe.Pointer(uintptr(v) + idx) optimization
aykevl Mar 1, 2023
3a3de8a
reflect: add pointerTo()
dgryski Feb 28, 2023
e4ef6f8
reflect: allow nil rawType to call Kind()
dgryski Feb 28, 2023
960a0b7
reflect: add SetLen()
dgryski Feb 28, 2023
bbc79ee
reflect: add Zero()
dgryski Feb 28, 2023
79930a2
reflect: add Addr()
dgryski Feb 28, 2023
0ff243e
reflect: add OverflowFloat(), OverflowInt(), OverflowUint()
dgryski Feb 28, 2023
f9b6f83
reflect: ensure all ValueError panics have Kind fields
dgryski Feb 28, 2023
550d61c
Use mirrored netdever interface
scottfeldman Mar 4, 2023
1d86b3f
compiler: add debug info to []embed.files backing array
aykevl Mar 4, 2023
11a6c84
compiler: add debug information to //go:embed slice data
aykevl Mar 4, 2023
d87e3ce
compiler: add debug information to []embed.file slice global
aykevl Mar 4, 2023
313c9e3
Refactor EnableInterrupts and DisableInterrupts
waj334 Mar 4, 2023
57ecf1a
testdata: add brandondube/pctl to corpus
dgryski Mar 2, 2023
930255f
os: add IsTimeout function
paralin Mar 4, 2023
0ce539a
compiler; add position information to createConstant
aykevl Mar 5, 2023
c6ac1cc
compiler: add debug location to string values
aykevl Mar 5, 2023
1cb702a
compiler: try harder to find source locations for constants
aykevl Mar 5, 2023
8babc47
compiler: fix a race condition
aykevl Mar 6, 2023
192a559
windows: disable parallelism on Windows
aykevl Mar 6, 2023
871cd66
build/linux: switch to ubuntu-20.04 for arm builds since ubuntu-18.04…
deadprogram Mar 6, 2023
7ca45d6
machine/rp2040: correct issue with spi pin validation
sago35 Mar 7, 2023
34ba0c1
ci: build LLVM with thread support on Windows
aykevl Dec 28, 2021
fc28f51
machine/samd21: implement Flash interface (#3496)
deadprogram Mar 8, 2023
de28119
builder: detect compiler-rt size usage
aykevl Mar 5, 2023
ea97c60
builder: sizes: list interrupt vector as a pseudo-package for -size=full
aykevl Mar 5, 2023
0b47b99
builder: improve reading of DWARF variables
aykevl Mar 5, 2023
0463d34
compiler: emit correct alignment in debug info for global variables
aykevl Mar 6, 2023
3701e6e
compiler: account for alignment with -size=full
aykevl Mar 6, 2023
71be24e
transform: add debug information to internal/task.stackSize
aykevl Mar 6, 2023
45f119d
machine/atsamd51: remove extra BK0RDY clear
sago35 Mar 7, 2023
7654d86
compiler, reflect: add support for named types
dgryski Mar 1, 2023
90af41d
reflect: add Type.String()
dgryski Mar 1, 2023
2a821d2
reflect: improve Value.String()
dgryski Mar 1, 2023
c192c73
targets: bump cortex-m-qemu default stack size
dgryski Mar 1, 2023
2de64d3
compiler, reflect: add Type.PkgPath
dgryski Mar 2, 2023
6a45b73
compiler, reflect: replace package and name length with null-byte ter…
dgryski Mar 3, 2023
c221e45
get espat working with example tests
scottfeldman Mar 9, 2023
51c1579
machine/samd51: implement Flash interface
deadprogram Mar 3, 2023
0bc1973
machine/samd51: disable/restore Flash cache on write/erase
deadprogram Mar 8, 2023
7706c41
Added missing TCPAddr and UDPAddr implementations to the net package
waj334 Feb 5, 2023
4716298
os,syscall: Stat_t timespec fields are Atimespec on darwin
dgryski Mar 3, 2023
cf4a6d3
syscall: add Timespec.Unix() for wasi.
dgryski Mar 3, 2023
a608476
syscall: remove misleading comment about Stat_t fields
dgryski Mar 5, 2023
69e5c50
reflect: add support for remaining map types
dgryski Mar 4, 2023
d610322
wioterminal: fix pin definition of BCM13
sago35 Mar 11, 2023
08cf2b2
machine/rp2040: change uart to allow for a single pin
sago35 Mar 11, 2023
faa449a
arm: enable functions in RAM for go & cgo
kenbell Jan 13, 2023
60366ad
machine/rp2040: implement Flash interface
deadprogram Jan 11, 2023
5db83f1
machine/flash: refactor to keep use of pure offset relative to start
deadprogram Mar 11, 2023
e6580bf
machine/rp2040: correct Flash implementation
deadprogram Mar 11, 2023
0e94553
builder: add test to check for changes in binary size
aykevl Sep 30, 2022
a52cad3
reflect: fix Addr() indirect value/flags and add tests.
dgryski Mar 13, 2023
fb394c7
reflect: add UnsafeAddr()
dgryski Mar 10, 2023
3b27638
reflect: add stubs for Method(), CanConvert(), ArrayOf()
dgryski Mar 10, 2023
04412cb
reflect: add stub for StructOf()
dgryski Mar 11, 2023
f42d8b3
debug: stub SetGCPercent()
dgryski Mar 11, 2023
ad9f790
reflect: set Index field in Field()
dgryski Mar 7, 2023
e0aee1f
reflect: Type.AssignableTo(): you can assign anything to interface{}
dgryski Mar 11, 2023
069c397
reflect: fix off-by-one in Zero sizing
dgryski Mar 6, 2023
584a271
reflect: add type check to Value.Field()
dgryski Mar 1, 2023
a366c01
reflect: call decomposeInterface() directly in TypeOf()
dgryski Mar 12, 2023
6768af9
reflect: TypeOf(nil) should be nil
dgryski Mar 14, 2023
b044d27
reflect: move StructField.Anonymous field to match upstream location
dgryski Mar 6, 2023
94a54bc
reflect: add UnsafePointer() for Func types
dgryski Mar 10, 2023
ac36f23
reflect: MapIter.Next() needs to allocate new keys/values every time
dgryski Mar 7, 2023
0da97e2
reflect: fix IsNil() for interfaces
dgryski Mar 15, 2023
91d6ca0
reflect: add SetBytes()
dgryski Mar 15, 2023
e849901
Update src/reflect/value.go
dgryski Mar 15, 2023
c672864
reflect: loosen unaddressable array rules for Copy()
dgryski Mar 7, 2023
9f02340
reflect: fix Type.Name to return empty string for non-named types
dgryski Mar 15, 2023
fa4f361
reflect: add FieldByName(), and FieldByIndex()
dgryski Mar 1, 2023
d9c6f7c
reflect: import visiblefields code and tests from upstream
dgryski Mar 5, 2023
15109a2
reflect: disable visiblefields test for FieldByIndexErr
dgryski Mar 6, 2023
93fb897
compiler, reflect: properly handle embedded structs
dgryski Mar 6, 2023
1626b50
reflect: set PkgPath in StructField
dgryski Mar 8, 2023
344e493
compiler,reflect: fix pkgpath for struct fields
dgryski Mar 8, 2023
833c91f
builder: fix binary size rodata value
dgryski Mar 14, 2023
4f7864b
device/gba: add mostly complete hand-written register definitions
deadprogram Mar 5, 2023
383e7ae
machine, runtime/interrupt: switch to use register definitions from d…
deadprogram Mar 5, 2023
db08b5a
transform: update reflect-implements test to opaque pointers
aykevl Mar 16, 2023
0ddd656
transform: update allocs test to opaque pointers
aykevl Mar 16, 2023
f8a6e66
transform: update gc-stackslots test to opaque pointers
aykevl Mar 16, 2023
7fb2382
transform: update interface test to opaque pointers
aykevl Mar 16, 2023
e4f29ae
transform: update interrupt test to opaque pointers
aykevl Mar 16, 2023
905269b
transform: update maps test to opaque pointers
aykevl Mar 16, 2023
ec3a4da
transform: update panic test to opaque pointers
aykevl Mar 16, 2023
af247e2
transform: update stacksize test to opaque pointers
aykevl Mar 16, 2023
e0f3333
transform: update stringequal test to opaque pointers
aykevl Mar 16, 2023
4acb1a5
transform: update stringtobytes test to opaque pointers
aykevl Mar 16, 2023
6c40ee9
transform: update wasm-abi to use opaque pointers
aykevl Mar 16, 2023
c559863
machine/stm32: correct Flash implementation
deadprogram Mar 11, 2023
5b42871
compiler: support all kinds of recursive types
aykevl Mar 16, 2023
821227a
docker: correct path for GHCR dev container build
deadprogram Mar 19, 2023
7a96f0f
compiler,reflect: add reflect.Type.NumMethods()
dgryski Mar 7, 2023
569817a
refect: Type.String() should use a shortened package name
dgryski Mar 7, 2023
6a685b2
reflect: add test for Type.NumMethod()
dgryski Mar 8, 2023
0d65b4d
compiler: only define the package path once
dgryski Mar 9, 2023
f2cc98c
compiler,reflect: adjust struct layout for type info
dgryski Mar 13, 2023
876f089
compiler,reflect: sort out pkg path vs pkg name for named types
dgryski Mar 13, 2023
229f479
reflect: make sure pointerTo() works for named types
dgryski Mar 12, 2023
e0329b2
transform: fix OptimizeReflectImplements pass for new named elem offset
dgryski Mar 15, 2023
4f8127d
builder: bump sizes tests
dgryski Mar 16, 2023
24b4dc3
reflect: stub MapOf()
dgryski Mar 17, 2023
6fbe6fa
reflect: tweak Type.String() to match what encoding/json expects for …
dgryski Mar 19, 2023
8fb5877
reflect: fix isBinary() for float types
dgryski Mar 19, 2023
57b0c21
reflect: tweak Type.String() for interfaces to make encoding/xml happy
dgryski Mar 19, 2023
96113aa
fresh netdev checkin preparing for PR
scottfeldman Feb 10, 2023
c3e7083
Documentation and cleanup of net package
scottfeldman Feb 10, 2023
0a97809
fix goroot override paths to pickup all of net package
scottfeldman Feb 13, 2023
afd47d8
gofmt -l -w -s
scottfeldman Feb 13, 2023
d9a675f
cleanup to sync with 1.19.3 Go as much as possible
scottfeldman Feb 16, 2023
daedf59
add missing pipe.go back; it got left out in netdev conversion
scottfeldman Feb 17, 2023
77458af
add some net package tests for smoketest
scottfeldman Feb 17, 2023
c051302
move netdev from drivers
scottfeldman Feb 21, 2023
7aa460c
README: consolidate net and netdev readmes
scottfeldman Feb 21, 2023
ec5ddac
remove parse_test.go because on file support
scottfeldman Feb 21, 2023
16cd2cf
remove parse_test.go because on file support
scottfeldman Feb 21, 2023
9540e07
Use mirrored netdever interface
scottfeldman Mar 4, 2023
a57c7f1
pick up iprawsock additions
scottfeldman Mar 21, 2023
060c379
Merge branch 'netdev2-espat' into netdev2
scottfeldman Mar 21, 2023
140e4a6
define on one F_SETFL in syscall package
scottfeldman Mar 27, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,7 @@ TEST_PACKAGES_FAST = \
math \
math/cmplx \
net \
net/http/internal \
net/http/internal/ascii \
net/mail \
os \
Expand Down
2 changes: 2 additions & 0 deletions loader/goroot.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ func pathsToOverride(goMinor int, needsSyscallPackage bool) map[string]bool {
"": true,
"crypto/": true,
"crypto/rand/": false,
"crypto/tls/": false,
"device/": false,
"examples/": false,
"internal/": true,
Expand All @@ -237,6 +238,7 @@ func pathsToOverride(goMinor int, needsSyscallPackage bool) map[string]bool {
"internal/task/": false,
"machine/": false,
"net/": true,
"net/http/": false,
"os/": true,
"reflect/": false,
"runtime/": false,
Expand Down
12 changes: 12 additions & 0 deletions src/crypto/tls/common.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// TINYGO: The following is copied and modified from Go 1.19.3 official implementation.

// 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 tls

// ConnectionState records basic TLS details about the connection.
type ConnectionState struct {
// TINYGO: empty; TLS connection offloaded to device
}
63 changes: 63 additions & 0 deletions src/crypto/tls/tls.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
// TINYGO: The following is copied and modified from Go 1.19.3 official implementation.

// 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 tls partially implements TLS 1.2, as specified in RFC 5246,
// and TLS 1.3, as specified in RFC 8446.
package tls

// BUG(agl): The crypto/tls package only implements some countermeasures
// against Lucky13 attacks on CBC-mode encryption, and only on SHA1
// variants. See http://www.isg.rhul.ac.uk/tls/TLStiming.pdf and
// https://www.imperialviolet.org/2013/02/04/luckythirteen.html.

import (
"fmt"
"net"
)

// Client returns a new TLS client side connection
// using conn as the underlying transport.
// The config cannot be nil: users must set either ServerName or
// InsecureSkipVerify in the config.
func Client(conn net.Conn, config *Config) *net.TLSConn {
panic("tls.Client() not implemented")
return nil
}

// DialWithDialer connects to the given network address using dialer.Dial and
// then initiates a TLS handshake, returning the resulting TLS connection. Any
// timeout or deadline given in the dialer apply to connection and TLS
// handshake as a whole.
//
// DialWithDialer interprets a nil configuration as equivalent to the zero
// configuration; see the documentation of Config for the defaults.
//
// DialWithDialer uses context.Background internally; to specify the context,
// use Dialer.DialContext with NetDialer set to the desired dialer.
func DialWithDialer(dialer *net.Dialer, network, addr string, config *Config) (*net.TLSConn, error) {
switch network {
case "tcp", "tcp4":
default:
return nil, fmt.Errorf("Network %s not supported", network)
}

return net.DialTLS(addr)
}

// Dial connects to the given network address using net.Dial
// and then initiates a TLS handshake, returning the resulting
// TLS connection.
// Dial interprets a nil configuration as equivalent to
// the zero configuration; see the documentation of Config
// for the defaults.
func Dial(network, addr string, config *Config) (*net.TLSConn, error) {
return DialWithDialer(new(net.Dialer), network, addr, config)
}

// Config is a placeholder for future compatibility with
// tls.Config.
type Config struct {
}
59 changes: 59 additions & 0 deletions src/net/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
This is a port of Go's "net" package, version 1.19.3.

It offers a subset of Go's "net" package and is modified to use the netdev
driver interface. For TLS support, Go's "crypto/tls" package is modified
to use the netdev interface to offload embedded TLS to the device.

There are no new exported names added to the "net" or "net/http" packages.

The tree listings below shows the files copied from Go 1.19.3. If the file
is marked with an "*", it is copied _and_ modified to work with netdev. If
there is no "*", it is a straight copy.

src/net
├── dial.go *
├── http
│   ├── client.go *
│   ├── clone.go
│   ├── cookie.go
│   ├── fs.go
│   ├── header.go *
│   ├── http.go
│   ├── internal
│   │   ├── ascii
│   │   │   └── print.go
│   │   └── chunked.go
│   ├── jar.go
│   ├── method.go
│   ├── request.go *
│   ├── response.go *
│   ├── server.go *
│   ├── sniff.go
│   ├── status.go
│   ├── transfer.go *
│   └── transport.go *
├── ip.go
├── iprawsock.go *
├── ipsock.go *
├── mac.go
├── net.go *
├── parse.go
├── tcpsock.go *
├── tlssock.go *
└── udpsock.go *

src/crypto/tls/
├── common.go *
└── tls.go *

The modifications to "net" are to basically wrap TCPConn, UDPConn, and TLSConn
around netdev socket calls. In Go, these Conns call out to OS syscalls for the
socket operations. In TinyGo, the OS syscalls aren't available, so netdev
socket calls are substituted to support TCP/UDP/TLS connections.

The modifications to "net/http" are on the client and server side. On the
client side, the TinyGo code changes remove the back-end round-tripper code and
replaces it with direct calls to TCPConns/TLSConns. All of Go's http
request/response handling code is intact and operational in TinyGo. Same holds
true for the server side. The server side supports the normal server features
like ServeMux and Hijacker (for websockets).
Loading