rebase: bump the golang-dependencies group with 3 updates

Bumps the golang-dependencies group with 3 updates: [golang.org/x/crypto](https://github.com/golang/crypto), [golang.org/x/net](https://github.com/golang/net) and [golang.org/x/sys](https://github.com/golang/sys).


Updates `golang.org/x/crypto` from 0.26.0 to 0.27.0
- [Commits](https://github.com/golang/crypto/compare/v0.26.0...v0.27.0)

Updates `golang.org/x/net` from 0.28.0 to 0.29.0
- [Commits](https://github.com/golang/net/compare/v0.28.0...v0.29.0)

Updates `golang.org/x/sys` from 0.24.0 to 0.25.0
- [Commits](https://github.com/golang/sys/compare/v0.24.0...v0.25.0)

---
updated-dependencies:
- dependency-name: golang.org/x/crypto
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: golang-dependencies
- dependency-name: golang.org/x/net
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: golang-dependencies
- dependency-name: golang.org/x/sys
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: golang-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
This commit is contained in:
dependabot[bot] 2024-09-09 20:04:53 +00:00 committed by mergify[bot]
parent 6c704bcd89
commit 52f39a36c3
35 changed files with 10011 additions and 2122 deletions

10
go.mod
View File

@ -25,9 +25,9 @@ require (
github.com/pkg/xattr v0.4.10 github.com/pkg/xattr v0.4.10
github.com/prometheus/client_golang v1.20.2 github.com/prometheus/client_golang v1.20.2
github.com/stretchr/testify v1.9.0 github.com/stretchr/testify v1.9.0
golang.org/x/crypto v0.26.0 golang.org/x/crypto v0.27.0
golang.org/x/net v0.28.0 golang.org/x/net v0.29.0
golang.org/x/sys v0.24.0 golang.org/x/sys v0.25.0
google.golang.org/grpc v1.66.0 google.golang.org/grpc v1.66.0
google.golang.org/protobuf v1.34.2 google.golang.org/protobuf v1.34.2
// //
@ -161,8 +161,8 @@ require (
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 // indirect golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 // indirect
golang.org/x/oauth2 v0.21.0 // indirect golang.org/x/oauth2 v0.21.0 // indirect
golang.org/x/sync v0.8.0 // indirect golang.org/x/sync v0.8.0 // indirect
golang.org/x/term v0.23.0 // indirect golang.org/x/term v0.24.0 // indirect
golang.org/x/text v0.17.0 // indirect golang.org/x/text v0.18.0 // indirect
golang.org/x/time v0.5.0 // indirect golang.org/x/time v0.5.0 // indirect
golang.org/x/tools v0.24.0 // indirect golang.org/x/tools v0.24.0 // indirect
gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect

20
go.sum
View File

@ -2440,8 +2440,8 @@ golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOM
golang.org/x/crypto v0.22.0/go.mod h1:vr6Su+7cTlO45qkww3VDJlzDn0ctJvRgYbC2NvXHt+M= golang.org/x/crypto v0.22.0/go.mod h1:vr6Su+7cTlO45qkww3VDJlzDn0ctJvRgYbC2NvXHt+M=
golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8= golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8=
golang.org/x/crypto v0.24.0/go.mod h1:Z1PMYSOR5nyMcyAVAIQSKCDwalqy85Aqn1x3Ws4L5DM= golang.org/x/crypto v0.24.0/go.mod h1:Z1PMYSOR5nyMcyAVAIQSKCDwalqy85Aqn1x3Ws4L5DM=
golang.org/x/crypto v0.26.0 h1:RrRspgV4mU+YwB4FYnuBoKsUapNIL5cohGAmSH3azsw= golang.org/x/crypto v0.27.0 h1:GXm2NjJrPaiv/h1tb2UH8QfgC/hOf/+z0p6PT8o1w7A=
golang.org/x/crypto v0.26.0/go.mod h1:GY7jblb9wI+FOo5y8/S2oY4zWP07AkOJ4+jxCqdqn54= golang.org/x/crypto v0.27.0/go.mod h1:1Xngt8kV6Dvbssa53Ziq6Eqn0HqbZi5Z6R0ZpwQzt70=
golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
@ -2603,8 +2603,8 @@ golang.org/x/net v0.23.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg=
golang.org/x/net v0.24.0/go.mod h1:2Q7sJY5mzlzWjKtYUEXSlBWCdyaioyXzRB2RtU8KVE8= golang.org/x/net v0.24.0/go.mod h1:2Q7sJY5mzlzWjKtYUEXSlBWCdyaioyXzRB2RtU8KVE8=
golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM= golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM=
golang.org/x/net v0.26.0/go.mod h1:5YKkiSynbBIh3p6iOc/vibscux0x38BZDkn8sCUPxHE= golang.org/x/net v0.26.0/go.mod h1:5YKkiSynbBIh3p6iOc/vibscux0x38BZDkn8sCUPxHE=
golang.org/x/net v0.28.0 h1:a9JDOJc5GMUJ0+UDqmLT86WiEy7iWyIhz8gz8E4e5hE= golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo=
golang.org/x/net v0.28.0/go.mod h1:yqtgsTWOOnlGLG9GFRrK3++bGOUEkNBoHZc8MEDWPNg= golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
@ -2794,8 +2794,8 @@ golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg= golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34=
golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/telemetry v0.0.0-20240208230135-b75ee8823808/go.mod h1:KG1lNk5ZFNssSZLrpVb4sMXKMpGwGXOxSG3rnu2gZQQ= golang.org/x/telemetry v0.0.0-20240208230135-b75ee8823808/go.mod h1:KG1lNk5ZFNssSZLrpVb4sMXKMpGwGXOxSG3rnu2gZQQ=
golang.org/x/telemetry v0.0.0-20240228155512-f48c80bd79b2/go.mod h1:TeRTkGYfJXctD9OcfyVLyj2J3IxLnKwHJR8f4D8a3YE= golang.org/x/telemetry v0.0.0-20240228155512-f48c80bd79b2/go.mod h1:TeRTkGYfJXctD9OcfyVLyj2J3IxLnKwHJR8f4D8a3YE=
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
@ -2822,8 +2822,8 @@ golang.org/x/term v0.18.0/go.mod h1:ILwASektA3OnRv7amZ1xhE/KTR+u50pbXfZ03+6Nx58=
golang.org/x/term v0.19.0/go.mod h1:2CuTdWZ7KHSQwUzKva0cbMg6q2DMI3Mmxp+gKJbskEk= golang.org/x/term v0.19.0/go.mod h1:2CuTdWZ7KHSQwUzKva0cbMg6q2DMI3Mmxp+gKJbskEk=
golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY= golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY=
golang.org/x/term v0.21.0/go.mod h1:ooXLefLobQVslOqselCNF4SxFAaoS6KujMbsGzSDmX0= golang.org/x/term v0.21.0/go.mod h1:ooXLefLobQVslOqselCNF4SxFAaoS6KujMbsGzSDmX0=
golang.org/x/term v0.23.0 h1:F6D4vR+EHoL9/sWAWgAR1H2DcHr4PareCbAaCo1RpuU= golang.org/x/term v0.24.0 h1:Mh5cbb+Zk2hqqXNO7S1iTjEphVL+jb8ZWaqh/g+JWkM=
golang.org/x/term v0.23.0/go.mod h1:DgV24QBUrK6jhZXl+20l6UWznPlwAHm1Q1mGHtydmSk= golang.org/x/term v0.24.0/go.mod h1:lOBK/LVxemqiMij05LGJ0tzNr8xlmwBRJ81PX6wVLH8=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
@ -2847,8 +2847,8 @@ golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI=
golang.org/x/text v0.17.0 h1:XtiM5bkSOt+ewxlOE/aE/AKEHibwj/6gvWMl9Rsh0Qc= golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224=
golang.org/x/text v0.17.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY=
golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,108 +1,93 @@
// Copyright 2012 The Go Authors. All rights reserved. // Code generated by command: go run sum_amd64_asm.go -out ../sum_amd64.s -pkg poly1305. DO NOT EDIT.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build gc && !purego //go:build gc && !purego
#include "textflag.h" // func update(state *macState, msg []byte)
#define POLY1305_ADD(msg, h0, h1, h2) \
ADDQ 0(msg), h0; \
ADCQ 8(msg), h1; \
ADCQ $1, h2; \
LEAQ 16(msg), msg
#define POLY1305_MUL(h0, h1, h2, r0, r1, t0, t1, t2, t3) \
MOVQ r0, AX; \
MULQ h0; \
MOVQ AX, t0; \
MOVQ DX, t1; \
MOVQ r0, AX; \
MULQ h1; \
ADDQ AX, t1; \
ADCQ $0, DX; \
MOVQ r0, t2; \
IMULQ h2, t2; \
ADDQ DX, t2; \
\
MOVQ r1, AX; \
MULQ h0; \
ADDQ AX, t1; \
ADCQ $0, DX; \
MOVQ DX, h0; \
MOVQ r1, t3; \
IMULQ h2, t3; \
MOVQ r1, AX; \
MULQ h1; \
ADDQ AX, t2; \
ADCQ DX, t3; \
ADDQ h0, t2; \
ADCQ $0, t3; \
\
MOVQ t0, h0; \
MOVQ t1, h1; \
MOVQ t2, h2; \
ANDQ $3, h2; \
MOVQ t2, t0; \
ANDQ $0xFFFFFFFFFFFFFFFC, t0; \
ADDQ t0, h0; \
ADCQ t3, h1; \
ADCQ $0, h2; \
SHRQ $2, t3, t2; \
SHRQ $2, t3; \
ADDQ t2, h0; \
ADCQ t3, h1; \
ADCQ $0, h2
// func update(state *[7]uint64, msg []byte)
TEXT ·update(SB), $0-32 TEXT ·update(SB), $0-32
MOVQ state+0(FP), DI MOVQ state+0(FP), DI
MOVQ msg_base+8(FP), SI MOVQ msg_base+8(FP), SI
MOVQ msg_len+16(FP), R15 MOVQ msg_len+16(FP), R15
MOVQ (DI), R8
MOVQ 0(DI), R8 // h0 MOVQ 8(DI), R9
MOVQ 8(DI), R9 // h1 MOVQ 16(DI), R10
MOVQ 16(DI), R10 // h2 MOVQ 24(DI), R11
MOVQ 24(DI), R11 // r0 MOVQ 32(DI), R12
MOVQ 32(DI), R12 // r1 CMPQ R15, $0x10
CMPQ R15, $16
JB bytes_between_0_and_15 JB bytes_between_0_and_15
loop: loop:
POLY1305_ADD(SI, R8, R9, R10) ADDQ (SI), R8
ADCQ 8(SI), R9
ADCQ $0x01, R10
LEAQ 16(SI), SI
multiply: multiply:
POLY1305_MUL(R8, R9, R10, R11, R12, BX, CX, R13, R14) MOVQ R11, AX
SUBQ $16, R15 MULQ R8
CMPQ R15, $16 MOVQ AX, BX
MOVQ DX, CX
MOVQ R11, AX
MULQ R9
ADDQ AX, CX
ADCQ $0x00, DX
MOVQ R11, R13
IMULQ R10, R13
ADDQ DX, R13
MOVQ R12, AX
MULQ R8
ADDQ AX, CX
ADCQ $0x00, DX
MOVQ DX, R8
MOVQ R12, R14
IMULQ R10, R14
MOVQ R12, AX
MULQ R9
ADDQ AX, R13
ADCQ DX, R14
ADDQ R8, R13
ADCQ $0x00, R14
MOVQ BX, R8
MOVQ CX, R9
MOVQ R13, R10
ANDQ $0x03, R10
MOVQ R13, BX
ANDQ $-4, BX
ADDQ BX, R8
ADCQ R14, R9
ADCQ $0x00, R10
SHRQ $0x02, R14, R13
SHRQ $0x02, R14
ADDQ R13, R8
ADCQ R14, R9
ADCQ $0x00, R10
SUBQ $0x10, R15
CMPQ R15, $0x10
JAE loop JAE loop
bytes_between_0_and_15: bytes_between_0_and_15:
TESTQ R15, R15 TESTQ R15, R15
JZ done JZ done
MOVQ $1, BX MOVQ $0x00000001, BX
XORQ CX, CX XORQ CX, CX
XORQ R13, R13 XORQ R13, R13
ADDQ R15, SI ADDQ R15, SI
flush_buffer: flush_buffer:
SHLQ $8, BX, CX SHLQ $0x08, BX, CX
SHLQ $8, BX SHLQ $0x08, BX
MOVB -1(SI), R13 MOVB -1(SI), R13
XORQ R13, BX XORQ R13, BX
DECQ SI DECQ SI
DECQ R15 DECQ R15
JNZ flush_buffer JNZ flush_buffer
ADDQ BX, R8 ADDQ BX, R8
ADCQ CX, R9 ADCQ CX, R9
ADCQ $0, R10 ADCQ $0x00, R10
MOVQ $16, R15 MOVQ $0x00000010, R15
JMP multiply JMP multiply
done: done:
MOVQ R8, 0(DI) MOVQ R8, (DI)
MOVQ R9, 8(DI) MOVQ R9, 8(DI)
MOVQ R10, 16(DI) MOVQ R10, 16(DI)
RET RET

View File

@ -1,36 +1,29 @@
// Copyright 2012 The Go Authors. All rights reserved. // Code generated by command: go run salsa20_amd64_asm.go -out ../salsa20_amd64.s -pkg salsa. DO NOT EDIT.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build amd64 && !purego && gc //go:build amd64 && !purego && gc
// This code was translated into a form compatible with 6a from the public // func salsa2020XORKeyStream(out *byte, in *byte, n uint64, nonce *byte, key *byte)
// domain sources in SUPERCOP: https://bench.cr.yp.to/supercop.html // Requires: SSE2
TEXT ·salsa2020XORKeyStream(SB), $456-40
// func salsa2020XORKeyStream(out, in *byte, n uint64, nonce, key *byte)
// This needs up to 64 bytes at 360(R12); hence the non-obvious frame size. // This needs up to 64 bytes at 360(R12); hence the non-obvious frame size.
TEXT ·salsa2020XORKeyStream(SB),0,$456-40 // frame = 424 + 32 byte alignment
MOVQ out+0(FP), DI MOVQ out+0(FP), DI
MOVQ in+8(FP), SI MOVQ in+8(FP), SI
MOVQ n+16(FP), DX MOVQ n+16(FP), DX
MOVQ nonce+24(FP), CX MOVQ nonce+24(FP), CX
MOVQ key+32(FP), R8 MOVQ key+32(FP), R8
MOVQ SP, R12 MOVQ SP, R12
ADDQ $31, R12 ADDQ $0x1f, R12
ANDQ $~31, R12 ANDQ $-32, R12
MOVQ DX, R9 MOVQ DX, R9
MOVQ CX, DX MOVQ CX, DX
MOVQ R8, R10 MOVQ R8, R10
CMPQ R9,$0 CMPQ R9, $0x00
JBE DONE JBE DONE
START:
MOVL 20(R10), CX MOVL 20(R10), CX
MOVL 0(R10),R8 MOVL (R10), R8
MOVL 0(DX),AX MOVL (DX), AX
MOVL 16(R10), R11 MOVL 16(R10), R11
MOVL CX,0(R12) MOVL CX, (R12)
MOVL R8, 4(R12) MOVL R8, 4(R12)
MOVL AX, 8(R12) MOVL AX, 8(R12)
MOVL R11, 12(R12) MOVL R11, 12(R12)
@ -50,77 +43,78 @@ TEXT ·salsa2020XORKeyStream(SB),0,$456-40 // frame = 424 + 32 byte alignment
MOVL CX, 36(R12) MOVL CX, 36(R12)
MOVL R8, 40(R12) MOVL R8, 40(R12)
MOVL AX, 44(R12) MOVL AX, 44(R12)
MOVQ $1634760805,DX MOVQ $0x61707865, DX
MOVQ $857760878,CX MOVQ $0x3320646e, CX
MOVQ $2036477234,R8 MOVQ $0x79622d32, R8
MOVQ $1797285236,AX MOVQ $0x6b206574, AX
MOVL DX, 48(R12) MOVL DX, 48(R12)
MOVL CX, 52(R12) MOVL CX, 52(R12)
MOVL R8, 56(R12) MOVL R8, 56(R12)
MOVL AX, 60(R12) MOVL AX, 60(R12)
CMPQ R9,$256 CMPQ R9, $0x00000100
JB BYTESBETWEEN1AND255 JB BYTESBETWEEN1AND255
MOVOA 48(R12), X0 MOVOA 48(R12), X0
PSHUFL $0X55,X0,X1 PSHUFL $0x55, X0, X1
PSHUFL $0XAA,X0,X2 PSHUFL $0xaa, X0, X2
PSHUFL $0XFF,X0,X3 PSHUFL $0xff, X0, X3
PSHUFL $0X00,X0,X0 PSHUFL $0x00, X0, X0
MOVOA X1, 64(R12) MOVOA X1, 64(R12)
MOVOA X2, 80(R12) MOVOA X2, 80(R12)
MOVOA X3, 96(R12) MOVOA X3, 96(R12)
MOVOA X0, 112(R12) MOVOA X0, 112(R12)
MOVOA 0(R12),X0 MOVOA (R12), X0
PSHUFL $0XAA,X0,X1 PSHUFL $0xaa, X0, X1
PSHUFL $0XFF,X0,X2 PSHUFL $0xff, X0, X2
PSHUFL $0X00,X0,X3 PSHUFL $0x00, X0, X3
PSHUFL $0X55,X0,X0 PSHUFL $0x55, X0, X0
MOVOA X1, 128(R12) MOVOA X1, 128(R12)
MOVOA X2, 144(R12) MOVOA X2, 144(R12)
MOVOA X3, 160(R12) MOVOA X3, 160(R12)
MOVOA X0, 176(R12) MOVOA X0, 176(R12)
MOVOA 16(R12), X0 MOVOA 16(R12), X0
PSHUFL $0XFF,X0,X1 PSHUFL $0xff, X0, X1
PSHUFL $0X55,X0,X2 PSHUFL $0x55, X0, X2
PSHUFL $0XAA,X0,X0 PSHUFL $0xaa, X0, X0
MOVOA X1, 192(R12) MOVOA X1, 192(R12)
MOVOA X2, 208(R12) MOVOA X2, 208(R12)
MOVOA X0, 224(R12) MOVOA X0, 224(R12)
MOVOA 32(R12), X0 MOVOA 32(R12), X0
PSHUFL $0X00,X0,X1 PSHUFL $0x00, X0, X1
PSHUFL $0XAA,X0,X2 PSHUFL $0xaa, X0, X2
PSHUFL $0XFF,X0,X0 PSHUFL $0xff, X0, X0
MOVOA X1, 240(R12) MOVOA X1, 240(R12)
MOVOA X2, 256(R12) MOVOA X2, 256(R12)
MOVOA X0, 272(R12) MOVOA X0, 272(R12)
BYTESATLEAST256: BYTESATLEAST256:
MOVL 16(R12), DX MOVL 16(R12), DX
MOVL 36(R12), CX MOVL 36(R12), CX
MOVL DX, 288(R12) MOVL DX, 288(R12)
MOVL CX, 304(R12) MOVL CX, 304(R12)
SHLQ $32,CX SHLQ $0x20, CX
ADDQ CX, DX ADDQ CX, DX
ADDQ $1,DX ADDQ $0x01, DX
MOVQ DX, CX MOVQ DX, CX
SHRQ $32,CX SHRQ $0x20, CX
MOVL DX, 292(R12) MOVL DX, 292(R12)
MOVL CX, 308(R12) MOVL CX, 308(R12)
ADDQ $1,DX ADDQ $0x01, DX
MOVQ DX, CX MOVQ DX, CX
SHRQ $32,CX SHRQ $0x20, CX
MOVL DX, 296(R12) MOVL DX, 296(R12)
MOVL CX, 312(R12) MOVL CX, 312(R12)
ADDQ $1,DX ADDQ $0x01, DX
MOVQ DX, CX MOVQ DX, CX
SHRQ $32,CX SHRQ $0x20, CX
MOVL DX, 300(R12) MOVL DX, 300(R12)
MOVL CX, 316(R12) MOVL CX, 316(R12)
ADDQ $1,DX ADDQ $0x01, DX
MOVQ DX, CX MOVQ DX, CX
SHRQ $32,CX SHRQ $0x20, CX
MOVL DX, 16(R12) MOVL DX, 16(R12)
MOVL CX, 36(R12) MOVL CX, 36(R12)
MOVQ R9, 352(R12) MOVQ R9, 352(R12)
MOVQ $20,DX MOVQ $0x00000014, DX
MOVOA 64(R12), X0 MOVOA 64(R12), X0
MOVOA 80(R12), X1 MOVOA 80(R12), X1
MOVOA 96(R12), X2 MOVOA 96(R12), X2
@ -137,248 +131,249 @@ TEXT ·salsa2020XORKeyStream(SB),0,$456-40 // frame = 424 + 32 byte alignment
MOVOA 160(R12), X13 MOVOA 160(R12), X13
MOVOA 240(R12), X14 MOVOA 240(R12), X14
MOVOA 288(R12), X15 MOVOA 288(R12), X15
MAINLOOP1: MAINLOOP1:
MOVOA X1, 320(R12) MOVOA X1, 320(R12)
MOVOA X2, 336(R12) MOVOA X2, 336(R12)
MOVOA X13, X1 MOVOA X13, X1
PADDL X12, X1 PADDL X12, X1
MOVOA X1, X2 MOVOA X1, X2
PSLLL $7,X1 PSLLL $0x07, X1
PXOR X1, X14 PXOR X1, X14
PSRLL $25,X2 PSRLL $0x19, X2
PXOR X2, X14 PXOR X2, X14
MOVOA X7, X1 MOVOA X7, X1
PADDL X0, X1 PADDL X0, X1
MOVOA X1, X2 MOVOA X1, X2
PSLLL $7,X1 PSLLL $0x07, X1
PXOR X1, X11 PXOR X1, X11
PSRLL $25,X2 PSRLL $0x19, X2
PXOR X2, X11 PXOR X2, X11
MOVOA X12, X1 MOVOA X12, X1
PADDL X14, X1 PADDL X14, X1
MOVOA X1, X2 MOVOA X1, X2
PSLLL $9,X1 PSLLL $0x09, X1
PXOR X1, X15 PXOR X1, X15
PSRLL $23,X2 PSRLL $0x17, X2
PXOR X2, X15 PXOR X2, X15
MOVOA X0, X1 MOVOA X0, X1
PADDL X11, X1 PADDL X11, X1
MOVOA X1, X2 MOVOA X1, X2
PSLLL $9,X1 PSLLL $0x09, X1
PXOR X1, X9 PXOR X1, X9
PSRLL $23,X2 PSRLL $0x17, X2
PXOR X2, X9 PXOR X2, X9
MOVOA X14, X1 MOVOA X14, X1
PADDL X15, X1 PADDL X15, X1
MOVOA X1, X2 MOVOA X1, X2
PSLLL $13,X1 PSLLL $0x0d, X1
PXOR X1, X13 PXOR X1, X13
PSRLL $19,X2 PSRLL $0x13, X2
PXOR X2, X13 PXOR X2, X13
MOVOA X11, X1 MOVOA X11, X1
PADDL X9, X1 PADDL X9, X1
MOVOA X1, X2 MOVOA X1, X2
PSLLL $13,X1 PSLLL $0x0d, X1
PXOR X1, X7 PXOR X1, X7
PSRLL $19,X2 PSRLL $0x13, X2
PXOR X2, X7 PXOR X2, X7
MOVOA X15, X1 MOVOA X15, X1
PADDL X13, X1 PADDL X13, X1
MOVOA X1, X2 MOVOA X1, X2
PSLLL $18,X1 PSLLL $0x12, X1
PXOR X1, X12 PXOR X1, X12
PSRLL $14,X2 PSRLL $0x0e, X2
PXOR X2, X12 PXOR X2, X12
MOVOA 320(R12), X1 MOVOA 320(R12), X1
MOVOA X12, 320(R12) MOVOA X12, 320(R12)
MOVOA X9, X2 MOVOA X9, X2
PADDL X7, X2 PADDL X7, X2
MOVOA X2, X12 MOVOA X2, X12
PSLLL $18,X2 PSLLL $0x12, X2
PXOR X2, X0 PXOR X2, X0
PSRLL $14,X12 PSRLL $0x0e, X12
PXOR X12, X0 PXOR X12, X0
MOVOA X5, X2 MOVOA X5, X2
PADDL X1, X2 PADDL X1, X2
MOVOA X2, X12 MOVOA X2, X12
PSLLL $7,X2 PSLLL $0x07, X2
PXOR X2, X3 PXOR X2, X3
PSRLL $25,X12 PSRLL $0x19, X12
PXOR X12, X3 PXOR X12, X3
MOVOA 336(R12), X2 MOVOA 336(R12), X2
MOVOA X0, 336(R12) MOVOA X0, 336(R12)
MOVOA X6, X0 MOVOA X6, X0
PADDL X2, X0 PADDL X2, X0
MOVOA X0, X12 MOVOA X0, X12
PSLLL $7,X0 PSLLL $0x07, X0
PXOR X0, X4 PXOR X0, X4
PSRLL $25,X12 PSRLL $0x19, X12
PXOR X12, X4 PXOR X12, X4
MOVOA X1, X0 MOVOA X1, X0
PADDL X3, X0 PADDL X3, X0
MOVOA X0, X12 MOVOA X0, X12
PSLLL $9,X0 PSLLL $0x09, X0
PXOR X0, X10 PXOR X0, X10
PSRLL $23,X12 PSRLL $0x17, X12
PXOR X12, X10 PXOR X12, X10
MOVOA X2, X0 MOVOA X2, X0
PADDL X4, X0 PADDL X4, X0
MOVOA X0, X12 MOVOA X0, X12
PSLLL $9,X0 PSLLL $0x09, X0
PXOR X0, X8 PXOR X0, X8
PSRLL $23,X12 PSRLL $0x17, X12
PXOR X12, X8 PXOR X12, X8
MOVOA X3, X0 MOVOA X3, X0
PADDL X10, X0 PADDL X10, X0
MOVOA X0, X12 MOVOA X0, X12
PSLLL $13,X0 PSLLL $0x0d, X0
PXOR X0, X5 PXOR X0, X5
PSRLL $19,X12 PSRLL $0x13, X12
PXOR X12, X5 PXOR X12, X5
MOVOA X4, X0 MOVOA X4, X0
PADDL X8, X0 PADDL X8, X0
MOVOA X0, X12 MOVOA X0, X12
PSLLL $13,X0 PSLLL $0x0d, X0
PXOR X0, X6 PXOR X0, X6
PSRLL $19,X12 PSRLL $0x13, X12
PXOR X12, X6 PXOR X12, X6
MOVOA X10, X0 MOVOA X10, X0
PADDL X5, X0 PADDL X5, X0
MOVOA X0, X12 MOVOA X0, X12
PSLLL $18,X0 PSLLL $0x12, X0
PXOR X0, X1 PXOR X0, X1
PSRLL $14,X12 PSRLL $0x0e, X12
PXOR X12, X1 PXOR X12, X1
MOVOA 320(R12), X0 MOVOA 320(R12), X0
MOVOA X1, 320(R12) MOVOA X1, 320(R12)
MOVOA X4, X1 MOVOA X4, X1
PADDL X0, X1 PADDL X0, X1
MOVOA X1, X12 MOVOA X1, X12
PSLLL $7,X1 PSLLL $0x07, X1
PXOR X1, X7 PXOR X1, X7
PSRLL $25,X12 PSRLL $0x19, X12
PXOR X12, X7 PXOR X12, X7
MOVOA X8, X1 MOVOA X8, X1
PADDL X6, X1 PADDL X6, X1
MOVOA X1, X12 MOVOA X1, X12
PSLLL $18,X1 PSLLL $0x12, X1
PXOR X1, X2 PXOR X1, X2
PSRLL $14,X12 PSRLL $0x0e, X12
PXOR X12, X2 PXOR X12, X2
MOVOA 336(R12), X12 MOVOA 336(R12), X12
MOVOA X2, 336(R12) MOVOA X2, 336(R12)
MOVOA X14, X1 MOVOA X14, X1
PADDL X12, X1 PADDL X12, X1
MOVOA X1, X2 MOVOA X1, X2
PSLLL $7,X1 PSLLL $0x07, X1
PXOR X1, X5 PXOR X1, X5
PSRLL $25,X2 PSRLL $0x19, X2
PXOR X2, X5 PXOR X2, X5
MOVOA X0, X1 MOVOA X0, X1
PADDL X7, X1 PADDL X7, X1
MOVOA X1, X2 MOVOA X1, X2
PSLLL $9,X1 PSLLL $0x09, X1
PXOR X1, X10 PXOR X1, X10
PSRLL $23,X2 PSRLL $0x17, X2
PXOR X2, X10 PXOR X2, X10
MOVOA X12, X1 MOVOA X12, X1
PADDL X5, X1 PADDL X5, X1
MOVOA X1, X2 MOVOA X1, X2
PSLLL $9,X1 PSLLL $0x09, X1
PXOR X1, X8 PXOR X1, X8
PSRLL $23,X2 PSRLL $0x17, X2
PXOR X2, X8 PXOR X2, X8
MOVOA X7, X1 MOVOA X7, X1
PADDL X10, X1 PADDL X10, X1
MOVOA X1, X2 MOVOA X1, X2
PSLLL $13,X1 PSLLL $0x0d, X1
PXOR X1, X4 PXOR X1, X4
PSRLL $19,X2 PSRLL $0x13, X2
PXOR X2, X4 PXOR X2, X4
MOVOA X5, X1 MOVOA X5, X1
PADDL X8, X1 PADDL X8, X1
MOVOA X1, X2 MOVOA X1, X2
PSLLL $13,X1 PSLLL $0x0d, X1
PXOR X1, X14 PXOR X1, X14
PSRLL $19,X2 PSRLL $0x13, X2
PXOR X2, X14 PXOR X2, X14
MOVOA X10, X1 MOVOA X10, X1
PADDL X4, X1 PADDL X4, X1
MOVOA X1, X2 MOVOA X1, X2
PSLLL $18,X1 PSLLL $0x12, X1
PXOR X1, X0 PXOR X1, X0
PSRLL $14,X2 PSRLL $0x0e, X2
PXOR X2, X0 PXOR X2, X0
MOVOA 320(R12), X1 MOVOA 320(R12), X1
MOVOA X0, 320(R12) MOVOA X0, 320(R12)
MOVOA X8, X0 MOVOA X8, X0
PADDL X14, X0 PADDL X14, X0
MOVOA X0, X2 MOVOA X0, X2
PSLLL $18,X0 PSLLL $0x12, X0
PXOR X0, X12 PXOR X0, X12
PSRLL $14,X2 PSRLL $0x0e, X2
PXOR X2, X12 PXOR X2, X12
MOVOA X11, X0 MOVOA X11, X0
PADDL X1, X0 PADDL X1, X0
MOVOA X0, X2 MOVOA X0, X2
PSLLL $7,X0 PSLLL $0x07, X0
PXOR X0, X6 PXOR X0, X6
PSRLL $25,X2 PSRLL $0x19, X2
PXOR X2, X6 PXOR X2, X6
MOVOA 336(R12), X2 MOVOA 336(R12), X2
MOVOA X12, 336(R12) MOVOA X12, 336(R12)
MOVOA X3, X0 MOVOA X3, X0
PADDL X2, X0 PADDL X2, X0
MOVOA X0, X12 MOVOA X0, X12
PSLLL $7,X0 PSLLL $0x07, X0
PXOR X0, X13 PXOR X0, X13
PSRLL $25,X12 PSRLL $0x19, X12
PXOR X12, X13 PXOR X12, X13
MOVOA X1, X0 MOVOA X1, X0
PADDL X6, X0 PADDL X6, X0
MOVOA X0, X12 MOVOA X0, X12
PSLLL $9,X0 PSLLL $0x09, X0
PXOR X0, X15 PXOR X0, X15
PSRLL $23,X12 PSRLL $0x17, X12
PXOR X12, X15 PXOR X12, X15
MOVOA X2, X0 MOVOA X2, X0
PADDL X13, X0 PADDL X13, X0
MOVOA X0, X12 MOVOA X0, X12
PSLLL $9,X0 PSLLL $0x09, X0
PXOR X0, X9 PXOR X0, X9
PSRLL $23,X12 PSRLL $0x17, X12
PXOR X12, X9 PXOR X12, X9
MOVOA X6, X0 MOVOA X6, X0
PADDL X15, X0 PADDL X15, X0
MOVOA X0, X12 MOVOA X0, X12
PSLLL $13,X0 PSLLL $0x0d, X0
PXOR X0, X11 PXOR X0, X11
PSRLL $19,X12 PSRLL $0x13, X12
PXOR X12, X11 PXOR X12, X11
MOVOA X13, X0 MOVOA X13, X0
PADDL X9, X0 PADDL X9, X0
MOVOA X0, X12 MOVOA X0, X12
PSLLL $13,X0 PSLLL $0x0d, X0
PXOR X0, X3 PXOR X0, X3
PSRLL $19,X12 PSRLL $0x13, X12
PXOR X12, X3 PXOR X12, X3
MOVOA X15, X0 MOVOA X15, X0
PADDL X11, X0 PADDL X11, X0
MOVOA X0, X12 MOVOA X0, X12
PSLLL $18,X0 PSLLL $0x12, X0
PXOR X0, X1 PXOR X0, X1
PSRLL $14,X12 PSRLL $0x0e, X12
PXOR X12, X1 PXOR X12, X1
MOVOA X9, X0 MOVOA X9, X0
PADDL X3, X0 PADDL X3, X0
MOVOA X0, X12 MOVOA X0, X12
PSLLL $18,X0 PSLLL $0x12, X0
PXOR X0, X2 PXOR X0, X2
PSRLL $14,X12 PSRLL $0x0e, X12
PXOR X12, X2 PXOR X12, X2
MOVOA 320(R12), X12 MOVOA 320(R12), X12
MOVOA 336(R12), X0 MOVOA 336(R12), X0
SUBQ $2,DX SUBQ $0x02, DX
JA MAINLOOP1 JA MAINLOOP1
PADDL 112(R12), X12 PADDL 112(R12), X12
PADDL 176(R12), X7 PADDL 176(R12), X7
@ -388,15 +383,15 @@ TEXT ·salsa2020XORKeyStream(SB),0,$456-40 // frame = 424 + 32 byte alignment
MOVD X7, CX MOVD X7, CX
MOVD X10, R8 MOVD X10, R8
MOVD X4, R9 MOVD X4, R9
PSHUFL $0X39,X12,X12 PSHUFL $0x39, X12, X12
PSHUFL $0X39,X7,X7 PSHUFL $0x39, X7, X7
PSHUFL $0X39,X10,X10 PSHUFL $0x39, X10, X10
PSHUFL $0X39,X4,X4 PSHUFL $0x39, X4, X4
XORL 0(SI),DX XORL (SI), DX
XORL 4(SI), CX XORL 4(SI), CX
XORL 8(SI), R8 XORL 8(SI), R8
XORL 12(SI), R9 XORL 12(SI), R9
MOVL DX,0(DI) MOVL DX, (DI)
MOVL CX, 4(DI) MOVL CX, 4(DI)
MOVL R8, 8(DI) MOVL R8, 8(DI)
MOVL R9, 12(DI) MOVL R9, 12(DI)
@ -404,10 +399,10 @@ TEXT ·salsa2020XORKeyStream(SB),0,$456-40 // frame = 424 + 32 byte alignment
MOVD X7, CX MOVD X7, CX
MOVD X10, R8 MOVD X10, R8
MOVD X4, R9 MOVD X4, R9
PSHUFL $0X39,X12,X12 PSHUFL $0x39, X12, X12
PSHUFL $0X39,X7,X7 PSHUFL $0x39, X7, X7
PSHUFL $0X39,X10,X10 PSHUFL $0x39, X10, X10
PSHUFL $0X39,X4,X4 PSHUFL $0x39, X4, X4
XORL 64(SI), DX XORL 64(SI), DX
XORL 68(SI), CX XORL 68(SI), CX
XORL 72(SI), R8 XORL 72(SI), R8
@ -420,10 +415,10 @@ TEXT ·salsa2020XORKeyStream(SB),0,$456-40 // frame = 424 + 32 byte alignment
MOVD X7, CX MOVD X7, CX
MOVD X10, R8 MOVD X10, R8
MOVD X4, R9 MOVD X4, R9
PSHUFL $0X39,X12,X12 PSHUFL $0x39, X12, X12
PSHUFL $0X39,X7,X7 PSHUFL $0x39, X7, X7
PSHUFL $0X39,X10,X10 PSHUFL $0x39, X10, X10
PSHUFL $0X39,X4,X4 PSHUFL $0x39, X4, X4
XORL 128(SI), DX XORL 128(SI), DX
XORL 132(SI), CX XORL 132(SI), CX
XORL 136(SI), R8 XORL 136(SI), R8
@ -452,10 +447,10 @@ TEXT ·salsa2020XORKeyStream(SB),0,$456-40 // frame = 424 + 32 byte alignment
MOVD X0, CX MOVD X0, CX
MOVD X5, R8 MOVD X5, R8
MOVD X8, R9 MOVD X8, R9
PSHUFL $0X39,X14,X14 PSHUFL $0x39, X14, X14
PSHUFL $0X39,X0,X0 PSHUFL $0x39, X0, X0
PSHUFL $0X39,X5,X5 PSHUFL $0x39, X5, X5
PSHUFL $0X39,X8,X8 PSHUFL $0x39, X8, X8
XORL 16(SI), DX XORL 16(SI), DX
XORL 20(SI), CX XORL 20(SI), CX
XORL 24(SI), R8 XORL 24(SI), R8
@ -468,10 +463,10 @@ TEXT ·salsa2020XORKeyStream(SB),0,$456-40 // frame = 424 + 32 byte alignment
MOVD X0, CX MOVD X0, CX
MOVD X5, R8 MOVD X5, R8
MOVD X8, R9 MOVD X8, R9
PSHUFL $0X39,X14,X14 PSHUFL $0x39, X14, X14
PSHUFL $0X39,X0,X0 PSHUFL $0x39, X0, X0
PSHUFL $0X39,X5,X5 PSHUFL $0x39, X5, X5
PSHUFL $0X39,X8,X8 PSHUFL $0x39, X8, X8
XORL 80(SI), DX XORL 80(SI), DX
XORL 84(SI), CX XORL 84(SI), CX
XORL 88(SI), R8 XORL 88(SI), R8
@ -484,10 +479,10 @@ TEXT ·salsa2020XORKeyStream(SB),0,$456-40 // frame = 424 + 32 byte alignment
MOVD X0, CX MOVD X0, CX
MOVD X5, R8 MOVD X5, R8
MOVD X8, R9 MOVD X8, R9
PSHUFL $0X39,X14,X14 PSHUFL $0x39, X14, X14
PSHUFL $0X39,X0,X0 PSHUFL $0x39, X0, X0
PSHUFL $0X39,X5,X5 PSHUFL $0x39, X5, X5
PSHUFL $0X39,X8,X8 PSHUFL $0x39, X8, X8
XORL 144(SI), DX XORL 144(SI), DX
XORL 148(SI), CX XORL 148(SI), CX
XORL 152(SI), R8 XORL 152(SI), R8
@ -516,10 +511,10 @@ TEXT ·salsa2020XORKeyStream(SB),0,$456-40 // frame = 424 + 32 byte alignment
MOVD X11, CX MOVD X11, CX
MOVD X1, R8 MOVD X1, R8
MOVD X6, R9 MOVD X6, R9
PSHUFL $0X39,X15,X15 PSHUFL $0x39, X15, X15
PSHUFL $0X39,X11,X11 PSHUFL $0x39, X11, X11
PSHUFL $0X39,X1,X1 PSHUFL $0x39, X1, X1
PSHUFL $0X39,X6,X6 PSHUFL $0x39, X6, X6
XORL 32(SI), DX XORL 32(SI), DX
XORL 36(SI), CX XORL 36(SI), CX
XORL 40(SI), R8 XORL 40(SI), R8
@ -532,10 +527,10 @@ TEXT ·salsa2020XORKeyStream(SB),0,$456-40 // frame = 424 + 32 byte alignment
MOVD X11, CX MOVD X11, CX
MOVD X1, R8 MOVD X1, R8
MOVD X6, R9 MOVD X6, R9
PSHUFL $0X39,X15,X15 PSHUFL $0x39, X15, X15
PSHUFL $0X39,X11,X11 PSHUFL $0x39, X11, X11
PSHUFL $0X39,X1,X1 PSHUFL $0x39, X1, X1
PSHUFL $0X39,X6,X6 PSHUFL $0x39, X6, X6
XORL 96(SI), DX XORL 96(SI), DX
XORL 100(SI), CX XORL 100(SI), CX
XORL 104(SI), R8 XORL 104(SI), R8
@ -548,10 +543,10 @@ TEXT ·salsa2020XORKeyStream(SB),0,$456-40 // frame = 424 + 32 byte alignment
MOVD X11, CX MOVD X11, CX
MOVD X1, R8 MOVD X1, R8
MOVD X6, R9 MOVD X6, R9
PSHUFL $0X39,X15,X15 PSHUFL $0x39, X15, X15
PSHUFL $0X39,X11,X11 PSHUFL $0x39, X11, X11
PSHUFL $0X39,X1,X1 PSHUFL $0x39, X1, X1
PSHUFL $0X39,X6,X6 PSHUFL $0x39, X6, X6
XORL 160(SI), DX XORL 160(SI), DX
XORL 164(SI), CX XORL 164(SI), CX
XORL 168(SI), R8 XORL 168(SI), R8
@ -580,10 +575,10 @@ TEXT ·salsa2020XORKeyStream(SB),0,$456-40 // frame = 424 + 32 byte alignment
MOVD X9, CX MOVD X9, CX
MOVD X3, R8 MOVD X3, R8
MOVD X2, R9 MOVD X2, R9
PSHUFL $0X39,X13,X13 PSHUFL $0x39, X13, X13
PSHUFL $0X39,X9,X9 PSHUFL $0x39, X9, X9
PSHUFL $0X39,X3,X3 PSHUFL $0x39, X3, X3
PSHUFL $0X39,X2,X2 PSHUFL $0x39, X2, X2
XORL 48(SI), DX XORL 48(SI), DX
XORL 52(SI), CX XORL 52(SI), CX
XORL 56(SI), R8 XORL 56(SI), R8
@ -596,10 +591,10 @@ TEXT ·salsa2020XORKeyStream(SB),0,$456-40 // frame = 424 + 32 byte alignment
MOVD X9, CX MOVD X9, CX
MOVD X3, R8 MOVD X3, R8
MOVD X2, R9 MOVD X2, R9
PSHUFL $0X39,X13,X13 PSHUFL $0x39, X13, X13
PSHUFL $0X39,X9,X9 PSHUFL $0x39, X9, X9
PSHUFL $0X39,X3,X3 PSHUFL $0x39, X3, X3
PSHUFL $0X39,X2,X2 PSHUFL $0x39, X2, X2
XORL 112(SI), DX XORL 112(SI), DX
XORL 116(SI), CX XORL 116(SI), CX
XORL 120(SI), R8 XORL 120(SI), R8
@ -612,10 +607,10 @@ TEXT ·salsa2020XORKeyStream(SB),0,$456-40 // frame = 424 + 32 byte alignment
MOVD X9, CX MOVD X9, CX
MOVD X3, R8 MOVD X3, R8
MOVD X2, R9 MOVD X2, R9
PSHUFL $0X39,X13,X13 PSHUFL $0x39, X13, X13
PSHUFL $0X39,X9,X9 PSHUFL $0x39, X9, X9
PSHUFL $0X39,X3,X3 PSHUFL $0x39, X3, X3
PSHUFL $0X39,X2,X2 PSHUFL $0x39, X2, X2
XORL 176(SI), DX XORL 176(SI), DX
XORL 180(SI), CX XORL 180(SI), CX
XORL 184(SI), R8 XORL 184(SI), R8
@ -637,15 +632,16 @@ TEXT ·salsa2020XORKeyStream(SB),0,$456-40 // frame = 424 + 32 byte alignment
MOVL R8, 248(DI) MOVL R8, 248(DI)
MOVL R9, 252(DI) MOVL R9, 252(DI)
MOVQ 352(R12), R9 MOVQ 352(R12), R9
SUBQ $256,R9 SUBQ $0x00000100, R9
ADDQ $256,SI ADDQ $0x00000100, SI
ADDQ $256,DI ADDQ $0x00000100, DI
CMPQ R9,$256 CMPQ R9, $0x00000100
JAE BYTESATLEAST256 JAE BYTESATLEAST256
CMPQ R9,$0 CMPQ R9, $0x00
JBE DONE JBE DONE
BYTESBETWEEN1AND255: BYTESBETWEEN1AND255:
CMPQ R9,$64 CMPQ R9, $0x40
JAE NOCOPY JAE NOCOPY
MOVQ DI, DX MOVQ DI, DX
LEAQ 360(R12), DI LEAQ 360(R12), DI
@ -653,159 +649,161 @@ TEXT ·salsa2020XORKeyStream(SB),0,$456-40 // frame = 424 + 32 byte alignment
REP; MOVSB REP; MOVSB
LEAQ 360(R12), DI LEAQ 360(R12), DI
LEAQ 360(R12), SI LEAQ 360(R12), SI
NOCOPY: NOCOPY:
MOVQ R9, 352(R12) MOVQ R9, 352(R12)
MOVOA 48(R12), X0 MOVOA 48(R12), X0
MOVOA 0(R12),X1 MOVOA (R12), X1
MOVOA 16(R12), X2 MOVOA 16(R12), X2
MOVOA 32(R12), X3 MOVOA 32(R12), X3
MOVOA X1, X4 MOVOA X1, X4
MOVQ $20,CX MOVQ $0x00000014, CX
MAINLOOP2: MAINLOOP2:
PADDL X0, X4 PADDL X0, X4
MOVOA X0, X5 MOVOA X0, X5
MOVOA X4, X6 MOVOA X4, X6
PSLLL $7,X4 PSLLL $0x07, X4
PSRLL $25,X6 PSRLL $0x19, X6
PXOR X4, X3 PXOR X4, X3
PXOR X6, X3 PXOR X6, X3
PADDL X3, X5 PADDL X3, X5
MOVOA X3, X4 MOVOA X3, X4
MOVOA X5, X6 MOVOA X5, X6
PSLLL $9,X5 PSLLL $0x09, X5
PSRLL $23,X6 PSRLL $0x17, X6
PXOR X5, X2 PXOR X5, X2
PSHUFL $0X93,X3,X3 PSHUFL $0x93, X3, X3
PXOR X6, X2 PXOR X6, X2
PADDL X2, X4 PADDL X2, X4
MOVOA X2, X5 MOVOA X2, X5
MOVOA X4, X6 MOVOA X4, X6
PSLLL $13,X4 PSLLL $0x0d, X4
PSRLL $19,X6 PSRLL $0x13, X6
PXOR X4, X1 PXOR X4, X1
PSHUFL $0X4E,X2,X2 PSHUFL $0x4e, X2, X2
PXOR X6, X1 PXOR X6, X1
PADDL X1, X5 PADDL X1, X5
MOVOA X3, X4 MOVOA X3, X4
MOVOA X5, X6 MOVOA X5, X6
PSLLL $18,X5 PSLLL $0x12, X5
PSRLL $14,X6 PSRLL $0x0e, X6
PXOR X5, X0 PXOR X5, X0
PSHUFL $0X39,X1,X1 PSHUFL $0x39, X1, X1
PXOR X6, X0 PXOR X6, X0
PADDL X0, X4 PADDL X0, X4
MOVOA X0, X5 MOVOA X0, X5
MOVOA X4, X6 MOVOA X4, X6
PSLLL $7,X4 PSLLL $0x07, X4
PSRLL $25,X6 PSRLL $0x19, X6
PXOR X4, X1 PXOR X4, X1
PXOR X6, X1 PXOR X6, X1
PADDL X1, X5 PADDL X1, X5
MOVOA X1, X4 MOVOA X1, X4
MOVOA X5, X6 MOVOA X5, X6
PSLLL $9,X5 PSLLL $0x09, X5
PSRLL $23,X6 PSRLL $0x17, X6
PXOR X5, X2 PXOR X5, X2
PSHUFL $0X93,X1,X1 PSHUFL $0x93, X1, X1
PXOR X6, X2 PXOR X6, X2
PADDL X2, X4 PADDL X2, X4
MOVOA X2, X5 MOVOA X2, X5
MOVOA X4, X6 MOVOA X4, X6
PSLLL $13,X4 PSLLL $0x0d, X4
PSRLL $19,X6 PSRLL $0x13, X6
PXOR X4, X3 PXOR X4, X3
PSHUFL $0X4E,X2,X2 PSHUFL $0x4e, X2, X2
PXOR X6, X3 PXOR X6, X3
PADDL X3, X5 PADDL X3, X5
MOVOA X1, X4 MOVOA X1, X4
MOVOA X5, X6 MOVOA X5, X6
PSLLL $18,X5 PSLLL $0x12, X5
PSRLL $14,X6 PSRLL $0x0e, X6
PXOR X5, X0 PXOR X5, X0
PSHUFL $0X39,X3,X3 PSHUFL $0x39, X3, X3
PXOR X6, X0 PXOR X6, X0
PADDL X0, X4 PADDL X0, X4
MOVOA X0, X5 MOVOA X0, X5
MOVOA X4, X6 MOVOA X4, X6
PSLLL $7,X4 PSLLL $0x07, X4
PSRLL $25,X6 PSRLL $0x19, X6
PXOR X4, X3 PXOR X4, X3
PXOR X6, X3 PXOR X6, X3
PADDL X3, X5 PADDL X3, X5
MOVOA X3, X4 MOVOA X3, X4
MOVOA X5, X6 MOVOA X5, X6
PSLLL $9,X5 PSLLL $0x09, X5
PSRLL $23,X6 PSRLL $0x17, X6
PXOR X5, X2 PXOR X5, X2
PSHUFL $0X93,X3,X3 PSHUFL $0x93, X3, X3
PXOR X6, X2 PXOR X6, X2
PADDL X2, X4 PADDL X2, X4
MOVOA X2, X5 MOVOA X2, X5
MOVOA X4, X6 MOVOA X4, X6
PSLLL $13,X4 PSLLL $0x0d, X4
PSRLL $19,X6 PSRLL $0x13, X6
PXOR X4, X1 PXOR X4, X1
PSHUFL $0X4E,X2,X2 PSHUFL $0x4e, X2, X2
PXOR X6, X1 PXOR X6, X1
PADDL X1, X5 PADDL X1, X5
MOVOA X3, X4 MOVOA X3, X4
MOVOA X5, X6 MOVOA X5, X6
PSLLL $18,X5 PSLLL $0x12, X5
PSRLL $14,X6 PSRLL $0x0e, X6
PXOR X5, X0 PXOR X5, X0
PSHUFL $0X39,X1,X1 PSHUFL $0x39, X1, X1
PXOR X6, X0 PXOR X6, X0
PADDL X0, X4 PADDL X0, X4
MOVOA X0, X5 MOVOA X0, X5
MOVOA X4, X6 MOVOA X4, X6
PSLLL $7,X4 PSLLL $0x07, X4
PSRLL $25,X6 PSRLL $0x19, X6
PXOR X4, X1 PXOR X4, X1
PXOR X6, X1 PXOR X6, X1
PADDL X1, X5 PADDL X1, X5
MOVOA X1, X4 MOVOA X1, X4
MOVOA X5, X6 MOVOA X5, X6
PSLLL $9,X5 PSLLL $0x09, X5
PSRLL $23,X6 PSRLL $0x17, X6
PXOR X5, X2 PXOR X5, X2
PSHUFL $0X93,X1,X1 PSHUFL $0x93, X1, X1
PXOR X6, X2 PXOR X6, X2
PADDL X2, X4 PADDL X2, X4
MOVOA X2, X5 MOVOA X2, X5
MOVOA X4, X6 MOVOA X4, X6
PSLLL $13,X4 PSLLL $0x0d, X4
PSRLL $19,X6 PSRLL $0x13, X6
PXOR X4, X3 PXOR X4, X3
PSHUFL $0X4E,X2,X2 PSHUFL $0x4e, X2, X2
PXOR X6, X3 PXOR X6, X3
SUBQ $4,CX SUBQ $0x04, CX
PADDL X3, X5 PADDL X3, X5
MOVOA X1, X4 MOVOA X1, X4
MOVOA X5, X6 MOVOA X5, X6
PSLLL $18,X5 PSLLL $0x12, X5
PXOR X7, X7 PXOR X7, X7
PSRLL $14,X6 PSRLL $0x0e, X6
PXOR X5, X0 PXOR X5, X0
PSHUFL $0X39,X3,X3 PSHUFL $0x39, X3, X3
PXOR X6, X0 PXOR X6, X0
JA MAINLOOP2 JA MAINLOOP2
PADDL 48(R12), X0 PADDL 48(R12), X0
PADDL 0(R12),X1 PADDL (R12), X1
PADDL 16(R12), X2 PADDL 16(R12), X2
PADDL 32(R12), X3 PADDL 32(R12), X3
MOVD X0, CX MOVD X0, CX
MOVD X1, R8 MOVD X1, R8
MOVD X2, R9 MOVD X2, R9
MOVD X3, AX MOVD X3, AX
PSHUFL $0X39,X0,X0 PSHUFL $0x39, X0, X0
PSHUFL $0X39,X1,X1 PSHUFL $0x39, X1, X1
PSHUFL $0X39,X2,X2 PSHUFL $0x39, X2, X2
PSHUFL $0X39,X3,X3 PSHUFL $0x39, X3, X3
XORL 0(SI),CX XORL (SI), CX
XORL 48(SI), R8 XORL 48(SI), R8
XORL 32(SI), R9 XORL 32(SI), R9
XORL 16(SI), AX XORL 16(SI), AX
MOVL CX,0(DI) MOVL CX, (DI)
MOVL R8, 48(DI) MOVL R8, 48(DI)
MOVL R9, 32(DI) MOVL R9, 32(DI)
MOVL AX, 16(DI) MOVL AX, 16(DI)
@ -813,10 +811,10 @@ TEXT ·salsa2020XORKeyStream(SB),0,$456-40 // frame = 424 + 32 byte alignment
MOVD X1, R8 MOVD X1, R8
MOVD X2, R9 MOVD X2, R9
MOVD X3, AX MOVD X3, AX
PSHUFL $0X39,X0,X0 PSHUFL $0x39, X0, X0
PSHUFL $0X39,X1,X1 PSHUFL $0x39, X1, X1
PSHUFL $0X39,X2,X2 PSHUFL $0x39, X2, X2
PSHUFL $0X39,X3,X3 PSHUFL $0x39, X3, X3
XORL 20(SI), CX XORL 20(SI), CX
XORL 4(SI), R8 XORL 4(SI), R8
XORL 52(SI), R9 XORL 52(SI), R9
@ -829,10 +827,10 @@ TEXT ·salsa2020XORKeyStream(SB),0,$456-40 // frame = 424 + 32 byte alignment
MOVD X1, R8 MOVD X1, R8
MOVD X2, R9 MOVD X2, R9
MOVD X3, AX MOVD X3, AX
PSHUFL $0X39,X0,X0 PSHUFL $0x39, X0, X0
PSHUFL $0X39,X1,X1 PSHUFL $0x39, X1, X1
PSHUFL $0X39,X2,X2 PSHUFL $0x39, X2, X2
PSHUFL $0X39,X3,X3 PSHUFL $0x39, X3, X3
XORL 40(SI), CX XORL 40(SI), CX
XORL 24(SI), R8 XORL 24(SI), R8
XORL 8(SI), R9 XORL 8(SI), R9
@ -856,25 +854,27 @@ TEXT ·salsa2020XORKeyStream(SB),0,$456-40 // frame = 424 + 32 byte alignment
MOVQ 352(R12), R9 MOVQ 352(R12), R9
MOVL 16(R12), CX MOVL 16(R12), CX
MOVL 36(R12), R8 MOVL 36(R12), R8
ADDQ $1,CX ADDQ $0x01, CX
SHLQ $32,R8 SHLQ $0x20, R8
ADDQ R8, CX ADDQ R8, CX
MOVQ CX, R8 MOVQ CX, R8
SHRQ $32,R8 SHRQ $0x20, R8
MOVL CX, 16(R12) MOVL CX, 16(R12)
MOVL R8, 36(R12) MOVL R8, 36(R12)
CMPQ R9,$64 CMPQ R9, $0x40
JA BYTESATLEAST65 JA BYTESATLEAST65
JAE BYTESATLEAST64 JAE BYTESATLEAST64
MOVQ DI, SI MOVQ DI, SI
MOVQ DX, DI MOVQ DX, DI
MOVQ R9, CX MOVQ R9, CX
REP; MOVSB REP; MOVSB
BYTESATLEAST64: BYTESATLEAST64:
DONE: DONE:
RET RET
BYTESATLEAST65: BYTESATLEAST65:
SUBQ $64,R9 SUBQ $0x40, R9
ADDQ $64,DI ADDQ $0x40, DI
ADDQ $64,SI ADDQ $0x40, SI
JMP BYTESBETWEEN1AND255 JMP BYTESBETWEEN1AND255

19
vendor/golang.org/x/sys/cpu/cpu.go generated vendored
View File

@ -201,6 +201,25 @@ var S390X struct {
_ CacheLinePad _ CacheLinePad
} }
// RISCV64 contains the supported CPU features and performance characteristics for riscv64
// platforms. The booleans in RISCV64, with the exception of HasFastMisaligned, indicate
// the presence of RISC-V extensions.
//
// It is safe to assume that all the RV64G extensions are supported and so they are omitted from
// this structure. As riscv64 Go programs require at least RV64G, the code that populates
// this structure cannot run successfully if some of the RV64G extensions are missing.
// The struct is padded to avoid false sharing.
var RISCV64 struct {
_ CacheLinePad
HasFastMisaligned bool // Fast misaligned accesses
HasC bool // Compressed instruction-set extension
HasV bool // Vector extension compatible with RVV 1.0
HasZba bool // Address generation instructions extension
HasZbb bool // Basic bit-manipulation extension
HasZbs bool // Single-bit instructions extension
_ CacheLinePad
}
func init() { func init() {
archInit() archInit()
initOptions() initOptions()

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
//go:build linux && !arm && !arm64 && !mips64 && !mips64le && !ppc64 && !ppc64le && !s390x //go:build linux && !arm && !arm64 && !mips64 && !mips64le && !ppc64 && !ppc64le && !s390x && !riscv64
package cpu package cpu

137
vendor/golang.org/x/sys/cpu/cpu_linux_riscv64.go generated vendored Normal file
View File

@ -0,0 +1,137 @@
// Copyright 2024 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 cpu
import (
"syscall"
"unsafe"
)
// RISC-V extension discovery code for Linux. The approach here is to first try the riscv_hwprobe
// syscall falling back to HWCAP to check for the C extension if riscv_hwprobe is not available.
//
// A note on detection of the Vector extension using HWCAP.
//
// Support for the Vector extension version 1.0 was added to the Linux kernel in release 6.5.
// Support for the riscv_hwprobe syscall was added in 6.4. It follows that if the riscv_hwprobe
// syscall is not available then neither is the Vector extension (which needs kernel support).
// The riscv_hwprobe syscall should then be all we need to detect the Vector extension.
// However, some RISC-V board manufacturers ship boards with an older kernel on top of which
// they have back-ported various versions of the Vector extension patches but not the riscv_hwprobe
// patches. These kernels advertise support for the Vector extension using HWCAP. Falling
// back to HWCAP to detect the Vector extension, if riscv_hwprobe is not available, or simply not
// bothering with riscv_hwprobe at all and just using HWCAP may then seem like an attractive option.
//
// Unfortunately, simply checking the 'V' bit in AT_HWCAP will not work as this bit is used by
// RISC-V board and cloud instance providers to mean different things. The Lichee Pi 4A board
// and the Scaleway RV1 cloud instances use the 'V' bit to advertise their support for the unratified
// 0.7.1 version of the Vector Specification. The Banana Pi BPI-F3 and the CanMV-K230 board use
// it to advertise support for 1.0 of the Vector extension. Versions 0.7.1 and 1.0 of the Vector
// extension are binary incompatible. HWCAP can then not be used in isolation to populate the
// HasV field as this field indicates that the underlying CPU is compatible with RVV 1.0.
//
// There is a way at runtime to distinguish between versions 0.7.1 and 1.0 of the Vector
// specification by issuing a RVV 1.0 vsetvli instruction and checking the vill bit of the vtype
// register. This check would allow us to safely detect version 1.0 of the Vector extension
// with HWCAP, if riscv_hwprobe were not available. However, the check cannot
// be added until the assembler supports the Vector instructions.
//
// Note the riscv_hwprobe syscall does not suffer from these ambiguities by design as all of the
// extensions it advertises support for are explicitly versioned. It's also worth noting that
// the riscv_hwprobe syscall is the only way to detect multi-letter RISC-V extensions, e.g., Zba.
// These cannot be detected using HWCAP and so riscv_hwprobe must be used to detect the majority
// of RISC-V extensions.
//
// Please see https://docs.kernel.org/arch/riscv/hwprobe.html for more information.
// golang.org/x/sys/cpu is not allowed to depend on golang.org/x/sys/unix so we must
// reproduce the constants, types and functions needed to make the riscv_hwprobe syscall
// here.
const (
// Copied from golang.org/x/sys/unix/ztypes_linux_riscv64.go.
riscv_HWPROBE_KEY_IMA_EXT_0 = 0x4
riscv_HWPROBE_IMA_C = 0x2
riscv_HWPROBE_IMA_V = 0x4
riscv_HWPROBE_EXT_ZBA = 0x8
riscv_HWPROBE_EXT_ZBB = 0x10
riscv_HWPROBE_EXT_ZBS = 0x20
riscv_HWPROBE_KEY_CPUPERF_0 = 0x5
riscv_HWPROBE_MISALIGNED_FAST = 0x3
riscv_HWPROBE_MISALIGNED_MASK = 0x7
)
const (
// sys_RISCV_HWPROBE is copied from golang.org/x/sys/unix/zsysnum_linux_riscv64.go.
sys_RISCV_HWPROBE = 258
)
// riscvHWProbePairs is copied from golang.org/x/sys/unix/ztypes_linux_riscv64.go.
type riscvHWProbePairs struct {
key int64
value uint64
}
const (
// CPU features
hwcap_RISCV_ISA_C = 1 << ('C' - 'A')
)
func doinit() {
// A slice of key/value pair structures is passed to the RISCVHWProbe syscall. The key
// field should be initialised with one of the key constants defined above, e.g.,
// RISCV_HWPROBE_KEY_IMA_EXT_0. The syscall will set the value field to the appropriate value.
// If the kernel does not recognise a key it will set the key field to -1 and the value field to 0.
pairs := []riscvHWProbePairs{
{riscv_HWPROBE_KEY_IMA_EXT_0, 0},
{riscv_HWPROBE_KEY_CPUPERF_0, 0},
}
// This call only indicates that extensions are supported if they are implemented on all cores.
if riscvHWProbe(pairs, 0) {
if pairs[0].key != -1 {
v := uint(pairs[0].value)
RISCV64.HasC = isSet(v, riscv_HWPROBE_IMA_C)
RISCV64.HasV = isSet(v, riscv_HWPROBE_IMA_V)
RISCV64.HasZba = isSet(v, riscv_HWPROBE_EXT_ZBA)
RISCV64.HasZbb = isSet(v, riscv_HWPROBE_EXT_ZBB)
RISCV64.HasZbs = isSet(v, riscv_HWPROBE_EXT_ZBS)
}
if pairs[1].key != -1 {
v := pairs[1].value & riscv_HWPROBE_MISALIGNED_MASK
RISCV64.HasFastMisaligned = v == riscv_HWPROBE_MISALIGNED_FAST
}
}
// Let's double check with HWCAP if the C extension does not appear to be supported.
// This may happen if we're running on a kernel older than 6.4.
if !RISCV64.HasC {
RISCV64.HasC = isSet(hwCap, hwcap_RISCV_ISA_C)
}
}
func isSet(hwc uint, value uint) bool {
return hwc&value != 0
}
// riscvHWProbe is a simplified version of the generated wrapper function found in
// golang.org/x/sys/unix/zsyscall_linux_riscv64.go. We simplify it by removing the
// cpuCount and cpus parameters which we do not need. We always want to pass 0 for
// these parameters here so the kernel only reports the extensions that are present
// on all cores.
func riscvHWProbe(pairs []riscvHWProbePairs, flags uint) bool {
var _zero uintptr
var p0 unsafe.Pointer
if len(pairs) > 0 {
p0 = unsafe.Pointer(&pairs[0])
} else {
p0 = unsafe.Pointer(&_zero)
}
_, _, e1 := syscall.Syscall6(sys_RISCV_HWPROBE, uintptr(p0), uintptr(len(pairs)), uintptr(0), uintptr(0), uintptr(flags), 0)
return e1 == 0
}

View File

@ -8,4 +8,13 @@ package cpu
const cacheLineSize = 64 const cacheLineSize = 64
func initOptions() {} func initOptions() {
options = []option{
{Name: "fastmisaligned", Feature: &RISCV64.HasFastMisaligned},
{Name: "c", Feature: &RISCV64.HasC},
{Name: "v", Feature: &RISCV64.HasV},
{Name: "zba", Feature: &RISCV64.HasZba},
{Name: "zbb", Feature: &RISCV64.HasZbb},
{Name: "zbs", Feature: &RISCV64.HasZbs},
}
}

View File

@ -552,6 +552,7 @@ ccflags="$@"
$2 !~ /^RTC_VL_(ACCURACY|BACKUP|DATA)/ && $2 !~ /^RTC_VL_(ACCURACY|BACKUP|DATA)/ &&
$2 ~ /^(NETLINK|NLM|NLMSG|NLA|IFA|IFAN|RT|RTC|RTCF|RTN|RTPROT|RTNH|ARPHRD|ETH_P|NETNSA)_/ || $2 ~ /^(NETLINK|NLM|NLMSG|NLA|IFA|IFAN|RT|RTC|RTCF|RTN|RTPROT|RTNH|ARPHRD|ETH_P|NETNSA)_/ ||
$2 ~ /^SOCK_|SK_DIAG_|SKNLGRP_$/ || $2 ~ /^SOCK_|SK_DIAG_|SKNLGRP_$/ ||
$2 ~ /^(CONNECT|SAE)_/ ||
$2 ~ /^FIORDCHK$/ || $2 ~ /^FIORDCHK$/ ||
$2 ~ /^SIOC/ || $2 ~ /^SIOC/ ||
$2 ~ /^TIOC/ || $2 ~ /^TIOC/ ||

View File

@ -566,6 +566,43 @@ func PthreadFchdir(fd int) (err error) {
return pthread_fchdir_np(fd) return pthread_fchdir_np(fd)
} }
// Connectx calls connectx(2) to initiate a connection on a socket.
//
// srcIf, srcAddr, and dstAddr are filled into a [SaEndpoints] struct and passed as the endpoints argument.
//
// - srcIf is the optional source interface index. 0 means unspecified.
// - srcAddr is the optional source address. nil means unspecified.
// - dstAddr is the destination address.
//
// On success, Connectx returns the number of bytes enqueued for transmission.
func Connectx(fd int, srcIf uint32, srcAddr, dstAddr Sockaddr, associd SaeAssocID, flags uint32, iov []Iovec, connid *SaeConnID) (n uintptr, err error) {
endpoints := SaEndpoints{
Srcif: srcIf,
}
if srcAddr != nil {
addrp, addrlen, err := srcAddr.sockaddr()
if err != nil {
return 0, err
}
endpoints.Srcaddr = (*RawSockaddr)(addrp)
endpoints.Srcaddrlen = uint32(addrlen)
}
if dstAddr != nil {
addrp, addrlen, err := dstAddr.sockaddr()
if err != nil {
return 0, err
}
endpoints.Dstaddr = (*RawSockaddr)(addrp)
endpoints.Dstaddrlen = uint32(addrlen)
}
err = connectx(fd, &endpoints, associd, flags, iov, &n, connid)
return
}
//sys connectx(fd int, endpoints *SaEndpoints, associd SaeAssocID, flags uint32, iov []Iovec, n *uintptr, connid *SaeConnID) (err error)
//sys sendfile(infd int, outfd int, offset int64, len *int64, hdtr unsafe.Pointer, flags int) (err error) //sys sendfile(infd int, outfd int, offset int64, len *int64, hdtr unsafe.Pointer, flags int) (err error)
//sys shmat(id int, addr uintptr, flag int) (ret uintptr, err error) //sys shmat(id int, addr uintptr, flag int) (ret uintptr, err error)

View File

@ -11,6 +11,7 @@ package unix
int ioctl(int, unsigned long int, uintptr_t); int ioctl(int, unsigned long int, uintptr_t);
*/ */
import "C" import "C"
import "unsafe"
func ioctl(fd int, req uint, arg uintptr) (err error) { func ioctl(fd int, req uint, arg uintptr) (err error) {
r0, er := C.ioctl(C.int(fd), C.ulong(req), C.uintptr_t(arg)) r0, er := C.ioctl(C.int(fd), C.ulong(req), C.uintptr_t(arg))

View File

@ -237,6 +237,9 @@ const (
CLOCK_UPTIME_RAW_APPROX = 0x9 CLOCK_UPTIME_RAW_APPROX = 0x9
CLONE_NOFOLLOW = 0x1 CLONE_NOFOLLOW = 0x1
CLONE_NOOWNERCOPY = 0x2 CLONE_NOOWNERCOPY = 0x2
CONNECT_DATA_AUTHENTICATED = 0x4
CONNECT_DATA_IDEMPOTENT = 0x2
CONNECT_RESUME_ON_READ_WRITE = 0x1
CR0 = 0x0 CR0 = 0x0
CR1 = 0x1000 CR1 = 0x1000
CR2 = 0x2000 CR2 = 0x2000
@ -1265,6 +1268,10 @@ const (
RTV_SSTHRESH = 0x20 RTV_SSTHRESH = 0x20
RUSAGE_CHILDREN = -0x1 RUSAGE_CHILDREN = -0x1
RUSAGE_SELF = 0x0 RUSAGE_SELF = 0x0
SAE_ASSOCID_ALL = 0xffffffff
SAE_ASSOCID_ANY = 0x0
SAE_CONNID_ALL = 0xffffffff
SAE_CONNID_ANY = 0x0
SCM_CREDS = 0x3 SCM_CREDS = 0x3
SCM_RIGHTS = 0x1 SCM_RIGHTS = 0x1
SCM_TIMESTAMP = 0x2 SCM_TIMESTAMP = 0x2

View File

@ -237,6 +237,9 @@ const (
CLOCK_UPTIME_RAW_APPROX = 0x9 CLOCK_UPTIME_RAW_APPROX = 0x9
CLONE_NOFOLLOW = 0x1 CLONE_NOFOLLOW = 0x1
CLONE_NOOWNERCOPY = 0x2 CLONE_NOOWNERCOPY = 0x2
CONNECT_DATA_AUTHENTICATED = 0x4
CONNECT_DATA_IDEMPOTENT = 0x2
CONNECT_RESUME_ON_READ_WRITE = 0x1
CR0 = 0x0 CR0 = 0x0
CR1 = 0x1000 CR1 = 0x1000
CR2 = 0x2000 CR2 = 0x2000
@ -1265,6 +1268,10 @@ const (
RTV_SSTHRESH = 0x20 RTV_SSTHRESH = 0x20
RUSAGE_CHILDREN = -0x1 RUSAGE_CHILDREN = -0x1
RUSAGE_SELF = 0x0 RUSAGE_SELF = 0x0
SAE_ASSOCID_ALL = 0xffffffff
SAE_ASSOCID_ANY = 0x0
SAE_CONNID_ALL = 0xffffffff
SAE_CONNID_ANY = 0x0
SCM_CREDS = 0x3 SCM_CREDS = 0x3
SCM_RIGHTS = 0x1 SCM_RIGHTS = 0x1
SCM_TIMESTAMP = 0x2 SCM_TIMESTAMP = 0x2

View File

@ -581,6 +581,8 @@ const (
AT_EMPTY_PATH = 0x1000 AT_EMPTY_PATH = 0x1000
AT_REMOVEDIR = 0x200 AT_REMOVEDIR = 0x200
RENAME_NOREPLACE = 1 << 0 RENAME_NOREPLACE = 1 << 0
ST_RDONLY = 1
ST_NOSUID = 2
) )
const ( const (

View File

@ -841,6 +841,26 @@ var libc_pthread_fchdir_np_trampoline_addr uintptr
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func connectx(fd int, endpoints *SaEndpoints, associd SaeAssocID, flags uint32, iov []Iovec, n *uintptr, connid *SaeConnID) (err error) {
var _p0 unsafe.Pointer
if len(iov) > 0 {
_p0 = unsafe.Pointer(&iov[0])
} else {
_p0 = unsafe.Pointer(&_zero)
}
_, _, e1 := syscall_syscall9(libc_connectx_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(endpoints)), uintptr(associd), uintptr(flags), uintptr(_p0), uintptr(len(iov)), uintptr(unsafe.Pointer(n)), uintptr(unsafe.Pointer(connid)), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
var libc_connectx_trampoline_addr uintptr
//go:cgo_import_dynamic libc_connectx connectx "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func sendfile(infd int, outfd int, offset int64, len *int64, hdtr unsafe.Pointer, flags int) (err error) { func sendfile(infd int, outfd int, offset int64, len *int64, hdtr unsafe.Pointer, flags int) (err error) {
_, _, e1 := syscall_syscall6(libc_sendfile_trampoline_addr, uintptr(infd), uintptr(outfd), uintptr(offset), uintptr(unsafe.Pointer(len)), uintptr(hdtr), uintptr(flags)) _, _, e1 := syscall_syscall6(libc_sendfile_trampoline_addr, uintptr(infd), uintptr(outfd), uintptr(offset), uintptr(unsafe.Pointer(len)), uintptr(hdtr), uintptr(flags))
if e1 != 0 { if e1 != 0 {

View File

@ -248,6 +248,11 @@ TEXT libc_pthread_fchdir_np_trampoline<>(SB),NOSPLIT,$0-0
GLOBL ·libc_pthread_fchdir_np_trampoline_addr(SB), RODATA, $8 GLOBL ·libc_pthread_fchdir_np_trampoline_addr(SB), RODATA, $8
DATA ·libc_pthread_fchdir_np_trampoline_addr(SB)/8, $libc_pthread_fchdir_np_trampoline<>(SB) DATA ·libc_pthread_fchdir_np_trampoline_addr(SB)/8, $libc_pthread_fchdir_np_trampoline<>(SB)
TEXT libc_connectx_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_connectx(SB)
GLOBL ·libc_connectx_trampoline_addr(SB), RODATA, $8
DATA ·libc_connectx_trampoline_addr(SB)/8, $libc_connectx_trampoline<>(SB)
TEXT libc_sendfile_trampoline<>(SB),NOSPLIT,$0-0 TEXT libc_sendfile_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_sendfile(SB) JMP libc_sendfile(SB)
GLOBL ·libc_sendfile_trampoline_addr(SB), RODATA, $8 GLOBL ·libc_sendfile_trampoline_addr(SB), RODATA, $8

View File

@ -841,6 +841,26 @@ var libc_pthread_fchdir_np_trampoline_addr uintptr
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func connectx(fd int, endpoints *SaEndpoints, associd SaeAssocID, flags uint32, iov []Iovec, n *uintptr, connid *SaeConnID) (err error) {
var _p0 unsafe.Pointer
if len(iov) > 0 {
_p0 = unsafe.Pointer(&iov[0])
} else {
_p0 = unsafe.Pointer(&_zero)
}
_, _, e1 := syscall_syscall9(libc_connectx_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(endpoints)), uintptr(associd), uintptr(flags), uintptr(_p0), uintptr(len(iov)), uintptr(unsafe.Pointer(n)), uintptr(unsafe.Pointer(connid)), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
var libc_connectx_trampoline_addr uintptr
//go:cgo_import_dynamic libc_connectx connectx "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func sendfile(infd int, outfd int, offset int64, len *int64, hdtr unsafe.Pointer, flags int) (err error) { func sendfile(infd int, outfd int, offset int64, len *int64, hdtr unsafe.Pointer, flags int) (err error) {
_, _, e1 := syscall_syscall6(libc_sendfile_trampoline_addr, uintptr(infd), uintptr(outfd), uintptr(offset), uintptr(unsafe.Pointer(len)), uintptr(hdtr), uintptr(flags)) _, _, e1 := syscall_syscall6(libc_sendfile_trampoline_addr, uintptr(infd), uintptr(outfd), uintptr(offset), uintptr(unsafe.Pointer(len)), uintptr(hdtr), uintptr(flags))
if e1 != 0 { if e1 != 0 {

View File

@ -248,6 +248,11 @@ TEXT libc_pthread_fchdir_np_trampoline<>(SB),NOSPLIT,$0-0
GLOBL ·libc_pthread_fchdir_np_trampoline_addr(SB), RODATA, $8 GLOBL ·libc_pthread_fchdir_np_trampoline_addr(SB), RODATA, $8
DATA ·libc_pthread_fchdir_np_trampoline_addr(SB)/8, $libc_pthread_fchdir_np_trampoline<>(SB) DATA ·libc_pthread_fchdir_np_trampoline_addr(SB)/8, $libc_pthread_fchdir_np_trampoline<>(SB)
TEXT libc_connectx_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_connectx(SB)
GLOBL ·libc_connectx_trampoline_addr(SB), RODATA, $8
DATA ·libc_connectx_trampoline_addr(SB)/8, $libc_connectx_trampoline<>(SB)
TEXT libc_sendfile_trampoline<>(SB),NOSPLIT,$0-0 TEXT libc_sendfile_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_sendfile(SB) JMP libc_sendfile(SB)
GLOBL ·libc_sendfile_trampoline_addr(SB), RODATA, $8 GLOBL ·libc_sendfile_trampoline_addr(SB), RODATA, $8

View File

@ -306,6 +306,19 @@ type XVSockPgen struct {
type _Socklen uint32 type _Socklen uint32
type SaeAssocID uint32
type SaeConnID uint32
type SaEndpoints struct {
Srcif uint32
Srcaddr *RawSockaddr
Srcaddrlen uint32
Dstaddr *RawSockaddr
Dstaddrlen uint32
_ [4]byte
}
type Xucred struct { type Xucred struct {
Version uint32 Version uint32
Uid uint32 Uid uint32

View File

@ -306,6 +306,19 @@ type XVSockPgen struct {
type _Socklen uint32 type _Socklen uint32
type SaeAssocID uint32
type SaeConnID uint32
type SaEndpoints struct {
Srcif uint32
Srcaddr *RawSockaddr
Srcaddrlen uint32
Dstaddr *RawSockaddr
Dstaddrlen uint32
_ [4]byte
}
type Xucred struct { type Xucred struct {
Version uint32 Version uint32
Uid uint32 Uid uint32

View File

@ -625,6 +625,7 @@ const (
POLLRDNORM = 0x40 POLLRDNORM = 0x40
POLLWRBAND = 0x100 POLLWRBAND = 0x100
POLLWRNORM = 0x4 POLLWRNORM = 0x4
POLLRDHUP = 0x4000
) )
type CapRights struct { type CapRights struct {

View File

@ -630,6 +630,7 @@ const (
POLLRDNORM = 0x40 POLLRDNORM = 0x40
POLLWRBAND = 0x100 POLLWRBAND = 0x100
POLLWRNORM = 0x4 POLLWRNORM = 0x4
POLLRDHUP = 0x4000
) )
type CapRights struct { type CapRights struct {

View File

@ -616,6 +616,7 @@ const (
POLLRDNORM = 0x40 POLLRDNORM = 0x40
POLLWRBAND = 0x100 POLLWRBAND = 0x100
POLLWRNORM = 0x4 POLLWRNORM = 0x4
POLLRDHUP = 0x4000
) )
type CapRights struct { type CapRights struct {

View File

@ -610,6 +610,7 @@ const (
POLLRDNORM = 0x40 POLLRDNORM = 0x40
POLLWRBAND = 0x100 POLLWRBAND = 0x100
POLLWRNORM = 0x4 POLLWRNORM = 0x4
POLLRDHUP = 0x4000
) )
type CapRights struct { type CapRights struct {

View File

@ -612,6 +612,7 @@ const (
POLLRDNORM = 0x40 POLLRDNORM = 0x40
POLLWRBAND = 0x100 POLLWRBAND = 0x100
POLLWRNORM = 0x4 POLLWRNORM = 0x4
POLLRDHUP = 0x4000
) )
type CapRights struct { type CapRights struct {

View File

@ -2486,7 +2486,7 @@ type XDPMmapOffsets struct {
type XDPUmemReg struct { type XDPUmemReg struct {
Addr uint64 Addr uint64
Len uint64 Len uint64
Chunk_size uint32 Size uint32
Headroom uint32 Headroom uint32
Flags uint32 Flags uint32
Tx_metadata_len uint32 Tx_metadata_len uint32

View File

@ -727,6 +727,37 @@ const (
RISCV_HWPROBE_EXT_ZBA = 0x8 RISCV_HWPROBE_EXT_ZBA = 0x8
RISCV_HWPROBE_EXT_ZBB = 0x10 RISCV_HWPROBE_EXT_ZBB = 0x10
RISCV_HWPROBE_EXT_ZBS = 0x20 RISCV_HWPROBE_EXT_ZBS = 0x20
RISCV_HWPROBE_EXT_ZICBOZ = 0x40
RISCV_HWPROBE_EXT_ZBC = 0x80
RISCV_HWPROBE_EXT_ZBKB = 0x100
RISCV_HWPROBE_EXT_ZBKC = 0x200
RISCV_HWPROBE_EXT_ZBKX = 0x400
RISCV_HWPROBE_EXT_ZKND = 0x800
RISCV_HWPROBE_EXT_ZKNE = 0x1000
RISCV_HWPROBE_EXT_ZKNH = 0x2000
RISCV_HWPROBE_EXT_ZKSED = 0x4000
RISCV_HWPROBE_EXT_ZKSH = 0x8000
RISCV_HWPROBE_EXT_ZKT = 0x10000
RISCV_HWPROBE_EXT_ZVBB = 0x20000
RISCV_HWPROBE_EXT_ZVBC = 0x40000
RISCV_HWPROBE_EXT_ZVKB = 0x80000
RISCV_HWPROBE_EXT_ZVKG = 0x100000
RISCV_HWPROBE_EXT_ZVKNED = 0x200000
RISCV_HWPROBE_EXT_ZVKNHA = 0x400000
RISCV_HWPROBE_EXT_ZVKNHB = 0x800000
RISCV_HWPROBE_EXT_ZVKSED = 0x1000000
RISCV_HWPROBE_EXT_ZVKSH = 0x2000000
RISCV_HWPROBE_EXT_ZVKT = 0x4000000
RISCV_HWPROBE_EXT_ZFH = 0x8000000
RISCV_HWPROBE_EXT_ZFHMIN = 0x10000000
RISCV_HWPROBE_EXT_ZIHINTNTL = 0x20000000
RISCV_HWPROBE_EXT_ZVFH = 0x40000000
RISCV_HWPROBE_EXT_ZVFHMIN = 0x80000000
RISCV_HWPROBE_EXT_ZFA = 0x100000000
RISCV_HWPROBE_EXT_ZTSO = 0x200000000
RISCV_HWPROBE_EXT_ZACAS = 0x400000000
RISCV_HWPROBE_EXT_ZICOND = 0x800000000
RISCV_HWPROBE_EXT_ZIHINTPAUSE = 0x1000000000
RISCV_HWPROBE_KEY_CPUPERF_0 = 0x5 RISCV_HWPROBE_KEY_CPUPERF_0 = 0x5
RISCV_HWPROBE_MISALIGNED_UNKNOWN = 0x0 RISCV_HWPROBE_MISALIGNED_UNKNOWN = 0x0
RISCV_HWPROBE_MISALIGNED_EMULATED = 0x1 RISCV_HWPROBE_MISALIGNED_EMULATED = 0x1
@ -734,4 +765,6 @@ const (
RISCV_HWPROBE_MISALIGNED_FAST = 0x3 RISCV_HWPROBE_MISALIGNED_FAST = 0x3
RISCV_HWPROBE_MISALIGNED_UNSUPPORTED = 0x4 RISCV_HWPROBE_MISALIGNED_UNSUPPORTED = 0x4
RISCV_HWPROBE_MISALIGNED_MASK = 0x7 RISCV_HWPROBE_MISALIGNED_MASK = 0x7
RISCV_HWPROBE_KEY_ZICBOZ_BLOCK_SIZE = 0x6
RISCV_HWPROBE_WHICH_CPUS = 0x1
) )

View File

@ -313,6 +313,10 @@ func NewCallbackCDecl(fn interface{}) uintptr {
//sys SetConsoleMode(console Handle, mode uint32) (err error) = kernel32.SetConsoleMode //sys SetConsoleMode(console Handle, mode uint32) (err error) = kernel32.SetConsoleMode
//sys GetConsoleScreenBufferInfo(console Handle, info *ConsoleScreenBufferInfo) (err error) = kernel32.GetConsoleScreenBufferInfo //sys GetConsoleScreenBufferInfo(console Handle, info *ConsoleScreenBufferInfo) (err error) = kernel32.GetConsoleScreenBufferInfo
//sys setConsoleCursorPosition(console Handle, position uint32) (err error) = kernel32.SetConsoleCursorPosition //sys setConsoleCursorPosition(console Handle, position uint32) (err error) = kernel32.SetConsoleCursorPosition
//sys GetConsoleCP() (cp uint32, err error) = kernel32.GetConsoleCP
//sys GetConsoleOutputCP() (cp uint32, err error) = kernel32.GetConsoleOutputCP
//sys SetConsoleCP(cp uint32) (err error) = kernel32.SetConsoleCP
//sys SetConsoleOutputCP(cp uint32) (err error) = kernel32.SetConsoleOutputCP
//sys WriteConsole(console Handle, buf *uint16, towrite uint32, written *uint32, reserved *byte) (err error) = kernel32.WriteConsoleW //sys WriteConsole(console Handle, buf *uint16, towrite uint32, written *uint32, reserved *byte) (err error) = kernel32.WriteConsoleW
//sys ReadConsole(console Handle, buf *uint16, toread uint32, read *uint32, inputControl *byte) (err error) = kernel32.ReadConsoleW //sys ReadConsole(console Handle, buf *uint16, toread uint32, read *uint32, inputControl *byte) (err error) = kernel32.ReadConsoleW
//sys resizePseudoConsole(pconsole Handle, size uint32) (hr error) = kernel32.ResizePseudoConsole //sys resizePseudoConsole(pconsole Handle, size uint32) (hr error) = kernel32.ResizePseudoConsole

View File

@ -1060,6 +1060,7 @@ const (
SIO_GET_EXTENSION_FUNCTION_POINTER = IOC_INOUT | IOC_WS2 | 6 SIO_GET_EXTENSION_FUNCTION_POINTER = IOC_INOUT | IOC_WS2 | 6
SIO_KEEPALIVE_VALS = IOC_IN | IOC_VENDOR | 4 SIO_KEEPALIVE_VALS = IOC_IN | IOC_VENDOR | 4
SIO_UDP_CONNRESET = IOC_IN | IOC_VENDOR | 12 SIO_UDP_CONNRESET = IOC_IN | IOC_VENDOR | 12
SIO_UDP_NETRESET = IOC_IN | IOC_VENDOR | 15
// cf. http://support.microsoft.com/default.aspx?scid=kb;en-us;257460 // cf. http://support.microsoft.com/default.aspx?scid=kb;en-us;257460

View File

@ -247,7 +247,9 @@ var (
procGetCommandLineW = modkernel32.NewProc("GetCommandLineW") procGetCommandLineW = modkernel32.NewProc("GetCommandLineW")
procGetComputerNameExW = modkernel32.NewProc("GetComputerNameExW") procGetComputerNameExW = modkernel32.NewProc("GetComputerNameExW")
procGetComputerNameW = modkernel32.NewProc("GetComputerNameW") procGetComputerNameW = modkernel32.NewProc("GetComputerNameW")
procGetConsoleCP = modkernel32.NewProc("GetConsoleCP")
procGetConsoleMode = modkernel32.NewProc("GetConsoleMode") procGetConsoleMode = modkernel32.NewProc("GetConsoleMode")
procGetConsoleOutputCP = modkernel32.NewProc("GetConsoleOutputCP")
procGetConsoleScreenBufferInfo = modkernel32.NewProc("GetConsoleScreenBufferInfo") procGetConsoleScreenBufferInfo = modkernel32.NewProc("GetConsoleScreenBufferInfo")
procGetCurrentDirectoryW = modkernel32.NewProc("GetCurrentDirectoryW") procGetCurrentDirectoryW = modkernel32.NewProc("GetCurrentDirectoryW")
procGetCurrentProcessId = modkernel32.NewProc("GetCurrentProcessId") procGetCurrentProcessId = modkernel32.NewProc("GetCurrentProcessId")
@ -347,8 +349,10 @@ var (
procSetCommMask = modkernel32.NewProc("SetCommMask") procSetCommMask = modkernel32.NewProc("SetCommMask")
procSetCommState = modkernel32.NewProc("SetCommState") procSetCommState = modkernel32.NewProc("SetCommState")
procSetCommTimeouts = modkernel32.NewProc("SetCommTimeouts") procSetCommTimeouts = modkernel32.NewProc("SetCommTimeouts")
procSetConsoleCP = modkernel32.NewProc("SetConsoleCP")
procSetConsoleCursorPosition = modkernel32.NewProc("SetConsoleCursorPosition") procSetConsoleCursorPosition = modkernel32.NewProc("SetConsoleCursorPosition")
procSetConsoleMode = modkernel32.NewProc("SetConsoleMode") procSetConsoleMode = modkernel32.NewProc("SetConsoleMode")
procSetConsoleOutputCP = modkernel32.NewProc("SetConsoleOutputCP")
procSetCurrentDirectoryW = modkernel32.NewProc("SetCurrentDirectoryW") procSetCurrentDirectoryW = modkernel32.NewProc("SetCurrentDirectoryW")
procSetDefaultDllDirectories = modkernel32.NewProc("SetDefaultDllDirectories") procSetDefaultDllDirectories = modkernel32.NewProc("SetDefaultDllDirectories")
procSetDllDirectoryW = modkernel32.NewProc("SetDllDirectoryW") procSetDllDirectoryW = modkernel32.NewProc("SetDllDirectoryW")
@ -2162,6 +2166,15 @@ func GetComputerName(buf *uint16, n *uint32) (err error) {
return return
} }
func GetConsoleCP() (cp uint32, err error) {
r0, _, e1 := syscall.Syscall(procGetConsoleCP.Addr(), 0, 0, 0, 0)
cp = uint32(r0)
if cp == 0 {
err = errnoErr(e1)
}
return
}
func GetConsoleMode(console Handle, mode *uint32) (err error) { func GetConsoleMode(console Handle, mode *uint32) (err error) {
r1, _, e1 := syscall.Syscall(procGetConsoleMode.Addr(), 2, uintptr(console), uintptr(unsafe.Pointer(mode)), 0) r1, _, e1 := syscall.Syscall(procGetConsoleMode.Addr(), 2, uintptr(console), uintptr(unsafe.Pointer(mode)), 0)
if r1 == 0 { if r1 == 0 {
@ -2170,6 +2183,15 @@ func GetConsoleMode(console Handle, mode *uint32) (err error) {
return return
} }
func GetConsoleOutputCP() (cp uint32, err error) {
r0, _, e1 := syscall.Syscall(procGetConsoleOutputCP.Addr(), 0, 0, 0, 0)
cp = uint32(r0)
if cp == 0 {
err = errnoErr(e1)
}
return
}
func GetConsoleScreenBufferInfo(console Handle, info *ConsoleScreenBufferInfo) (err error) { func GetConsoleScreenBufferInfo(console Handle, info *ConsoleScreenBufferInfo) (err error) {
r1, _, e1 := syscall.Syscall(procGetConsoleScreenBufferInfo.Addr(), 2, uintptr(console), uintptr(unsafe.Pointer(info)), 0) r1, _, e1 := syscall.Syscall(procGetConsoleScreenBufferInfo.Addr(), 2, uintptr(console), uintptr(unsafe.Pointer(info)), 0)
if r1 == 0 { if r1 == 0 {
@ -3038,6 +3060,14 @@ func SetCommTimeouts(handle Handle, timeouts *CommTimeouts) (err error) {
return return
} }
func SetConsoleCP(cp uint32) (err error) {
r1, _, e1 := syscall.Syscall(procSetConsoleCP.Addr(), 1, uintptr(cp), 0, 0)
if r1 == 0 {
err = errnoErr(e1)
}
return
}
func setConsoleCursorPosition(console Handle, position uint32) (err error) { func setConsoleCursorPosition(console Handle, position uint32) (err error) {
r1, _, e1 := syscall.Syscall(procSetConsoleCursorPosition.Addr(), 2, uintptr(console), uintptr(position), 0) r1, _, e1 := syscall.Syscall(procSetConsoleCursorPosition.Addr(), 2, uintptr(console), uintptr(position), 0)
if r1 == 0 { if r1 == 0 {
@ -3054,6 +3084,14 @@ func SetConsoleMode(console Handle, mode uint32) (err error) {
return return
} }
func SetConsoleOutputCP(cp uint32) (err error) {
r1, _, e1 := syscall.Syscall(procSetConsoleOutputCP.Addr(), 1, uintptr(cp), 0, 0)
if r1 == 0 {
err = errnoErr(e1)
}
return
}
func SetCurrentDirectory(path *uint16) (err error) { func SetCurrentDirectory(path *uint16) (err error) {
r1, _, e1 := syscall.Syscall(procSetCurrentDirectoryW.Addr(), 1, uintptr(unsafe.Pointer(path)), 0, 0) r1, _, e1 := syscall.Syscall(procSetCurrentDirectoryW.Addr(), 1, uintptr(unsafe.Pointer(path)), 0, 0)
if r1 == 0 { if r1 == 0 {

View File

@ -26,6 +26,7 @@ func makeRaw(fd int) (*State, error) {
return nil, err return nil, err
} }
raw := st &^ (windows.ENABLE_ECHO_INPUT | windows.ENABLE_PROCESSED_INPUT | windows.ENABLE_LINE_INPUT | windows.ENABLE_PROCESSED_OUTPUT) raw := st &^ (windows.ENABLE_ECHO_INPUT | windows.ENABLE_PROCESSED_INPUT | windows.ENABLE_LINE_INPUT | windows.ENABLE_PROCESSED_OUTPUT)
raw |= windows.ENABLE_VIRTUAL_TERMINAL_INPUT
if err := windows.SetConsoleMode(windows.Handle(fd), raw); err != nil { if err := windows.SetConsoleMode(windows.Handle(fd), raw); err != nil {
return nil, err return nil, err
} }

10
vendor/modules.txt vendored
View File

@ -727,7 +727,7 @@ go.uber.org/zap/internal/pool
go.uber.org/zap/internal/stacktrace go.uber.org/zap/internal/stacktrace
go.uber.org/zap/zapcore go.uber.org/zap/zapcore
go.uber.org/zap/zapgrpc go.uber.org/zap/zapgrpc
# golang.org/x/crypto v0.26.0 # golang.org/x/crypto v0.27.0
## explicit; go 1.20 ## explicit; go 1.20
golang.org/x/crypto/argon2 golang.org/x/crypto/argon2
golang.org/x/crypto/blake2b golang.org/x/crypto/blake2b
@ -752,7 +752,7 @@ golang.org/x/crypto/ssh/internal/bcrypt_pbkdf
golang.org/x/exp/constraints golang.org/x/exp/constraints
golang.org/x/exp/maps golang.org/x/exp/maps
golang.org/x/exp/slices golang.org/x/exp/slices
# golang.org/x/net v0.28.0 # golang.org/x/net v0.29.0
## explicit; go 1.18 ## explicit; go 1.18
golang.org/x/net/context golang.org/x/net/context
golang.org/x/net/html golang.org/x/net/html
@ -774,17 +774,17 @@ golang.org/x/oauth2/internal
# golang.org/x/sync v0.8.0 # golang.org/x/sync v0.8.0
## explicit; go 1.18 ## explicit; go 1.18
golang.org/x/sync/singleflight golang.org/x/sync/singleflight
# golang.org/x/sys v0.24.0 # golang.org/x/sys v0.25.0
## explicit; go 1.18 ## explicit; go 1.18
golang.org/x/sys/cpu golang.org/x/sys/cpu
golang.org/x/sys/plan9 golang.org/x/sys/plan9
golang.org/x/sys/unix golang.org/x/sys/unix
golang.org/x/sys/windows golang.org/x/sys/windows
golang.org/x/sys/windows/registry golang.org/x/sys/windows/registry
# golang.org/x/term v0.23.0 # golang.org/x/term v0.24.0
## explicit; go 1.18 ## explicit; go 1.18
golang.org/x/term golang.org/x/term
# golang.org/x/text v0.17.0 # golang.org/x/text v0.18.0
## explicit; go 1.18 ## explicit; go 1.18
golang.org/x/text/cases golang.org/x/text/cases
golang.org/x/text/encoding golang.org/x/text/encoding