Skip to content

Commit 5d84637

Browse files
committed
update runtime API documentation
1 parent 192517f commit 5d84637

File tree

2 files changed

+33
-14
lines changed

2 files changed

+33
-14
lines changed

doc/README.md

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ This package is only used for documentation purposes, applications need to defin
1515
[![Go Reference](https://pkg.go.dev/badge/github.com/usbarmory/tamago/doc.svg)](https://pkg.go.dev/github.com/usbarmory/tamago/doc)
1616

1717
- [Variables](<#variables>)
18+
- [func CPUInit\(\)](<#CPUInit>)
1819
- [func GetRandomData\(b \[\]byte\)](<#GetRandomData>)
1920
- [func Hwinit0\(\)](<#Hwinit0>)
2021
- [func Hwinit1\(\)](<#Hwinit1>)
@@ -96,7 +97,7 @@ var RamStart uint
9697
For an example see package [vnet](<https://github.com/usbarmory/virtio-net/blob/main/runtime.go>).
9798

9899
```go
99-
var SocketFunc func(ctx context.Context, net string, family, sotype int, laddr, raddr net.Addr) (interface{}, error)
100+
var SocketFunc func(ctx context.Context, net string, family, sotype int, laddr, raddr net.Addr) (any, error)
100101
```
101102

102103
<a name="Task"></a>Task describes the optional [runtime.Task](<https://pkg.go.dev/runtime/#Task>) function, which can be set to provide an implementation for HW/OS threading \(see \`runtime.newosproc\`\).
@@ -109,8 +110,25 @@ For an example see package [amd64 SMP initialization](<https://github.com/usbarm
109110
var Task func(sp, mp, gp, fn unsafe.Pointer)
110111
```
111112

113+
<a name="CPUInit"></a>
114+
## func [CPUInit](<https://github.com/usbarmory/tamago/blob/master/doc/api_doc_stub.go#L51>)
115+
116+
```go
117+
func CPUInit()
118+
```
119+
120+
CPUInit, which must be linked as \`cpuinit\`¹ handles immediate startup CPU initialization as it represents the first instruction set executed.
121+
122+
It must be defined using Go's Assembler.
123+
124+
For an example see package [arm64 CPU initialization](<https://github.com/usbarmory/tamago/blob/master/arm64/init.s>).
125+
126+
```
127+
¹ TEXT cpuinit(SB),NOSPLIT|NOFRAME,$0
128+
```
129+
112130
<a name="GetRandomData"></a>
113-
## func [GetRandomData](<https://github.com/usbarmory/tamago/blob/master/doc/api_doc_stub.go#L112>)
131+
## func [GetRandomData](<https://github.com/usbarmory/tamago/blob/master/doc/api_doc_stub.go#L119>)
114132

115133
```go
116134
func GetRandomData(b []byte)
@@ -125,7 +143,7 @@ For an example see package [amd64 random number generation](<https://github.com/
125143
```
126144

127145
<a name="Hwinit0"></a>
128-
## func [Hwinit0](<https://github.com/usbarmory/tamago/blob/master/doc/api_doc_stub.go#L60>)
146+
## func [Hwinit0](<https://github.com/usbarmory/tamago/blob/master/doc/api_doc_stub.go#L67>)
129147

130148
```go
131149
func Hwinit0()
@@ -142,7 +160,7 @@ For an example see package [arm initialization](<https://github.com/usbarmory/ta
142160
```
143161

144162
<a name="Hwinit1"></a>
145-
## func [Hwinit1](<https://github.com/usbarmory/tamago/blob/master/doc/api_doc_stub.go#L72>)
163+
## func [Hwinit1](<https://github.com/usbarmory/tamago/blob/master/doc/api_doc_stub.go#L79>)
146164

147165
```go
148166
func Hwinit1()
@@ -157,7 +175,7 @@ For an example see package [microvm platform initialization](<https://github.com
157175
```
158176

159177
<a name="InitRNG"></a>
160-
## func [InitRNG](<https://github.com/usbarmory/tamago/blob/master/doc/api_doc_stub.go#L100>)
178+
## func [InitRNG](<https://github.com/usbarmory/tamago/blob/master/doc/api_doc_stub.go#L107>)
161179

162180
```go
163181
func InitRNG()
@@ -172,7 +190,7 @@ For an example see package [amd64 randon number generation](<https://github.com/
172190
```
173191

174192
<a name="Nanotime"></a>
175-
## func [Nanotime](<https://github.com/usbarmory/tamago/blob/master/doc/api_doc_stub.go#L128>)
193+
## func [Nanotime](<https://github.com/usbarmory/tamago/blob/master/doc/api_doc_stub.go#L135>)
176194

177195
```go
178196
func Nanotime() int64
@@ -189,7 +207,7 @@ For an example see package [fu540 initialization](<https://github.com/usbarmory/
189207
```
190208

191209
<a name="Printk"></a>
192-
## func [Printk](<https://github.com/usbarmory/tamago/blob/master/doc/api_doc_stub.go#L88>)
210+
## func [Printk](<https://github.com/usbarmory/tamago/blob/master/doc/api_doc_stub.go#L95>)
193211

194212
```go
195213
func Printk(c byte)

doc/api_doc_stub.go

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,17 @@ import (
3838
"unsafe"
3939
)
4040

41-
// cpuinit handles pre-runtime CPU initialization.
41+
// CPUInit, which must be linked as `cpuinit`¹ handles immediate startup CPU
42+
// initialization as it represents the first instruction set executed.
4243
//
43-
// It must be defined using Go's Assembler to retain Go's commitment to
44-
// backward compatibility, otherwise extreme care must be taken as the lack of
45-
// World start does not allow memory allocation.
44+
// It must be defined using Go's Assembler.
45+
//
46+
// For an example see package [arm64 CPU initialization].
4647
//
47-
// For an example see package [arm CPU initialization].
48+
// ¹ TEXT cpuinit(SB),NOSPLIT|NOFRAME,$0
4849
//
49-
// [arm CPU initialization]: https://github.com/usbarmory/tamago/blob/master/arm/init.s
50-
func cpuinit()
50+
// [arm64 CPU initialization]: https://github.com/usbarmory/tamago/blob/master/arm64/init.s
51+
func CPUInit()
5152

5253
// Hwinit0, which must be linked as `runtime.hwinit0`¹, takes care of the lower
5354
// level initialization triggered before runtime setup (pre World start).

0 commit comments

Comments
 (0)