github.com/nicocha30/gvisor-ligolo@v0.0.0-20230726075806-989fa2c0a413/pkg/sentry/platform/systrap/sysmsg/sysmsg_arm64.go (about) 1 // Copyright 2023 The gVisor Authors. 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 //go:build arm64 16 // +build arm64 17 18 package sysmsg 19 20 import ( 21 _ "embed" 22 "fmt" 23 "strings" 24 25 "github.com/nicocha30/gvisor-ligolo/pkg/cpuid" 26 ) 27 28 // SighandlerBlob contains the compiled code of the sysmsg signal handler. 29 // 30 //go:embed sighandler.built-in.arm64.bin 31 var SighandlerBlob []byte 32 33 // ArchState defines variables specific to the architecture being 34 // used. 35 type ArchState struct { 36 fpLen uint32 37 } 38 39 // Init initializes the arch specific state. 40 func (s *ArchState) Init() { 41 fs := cpuid.HostFeatureSet() 42 fpLenUint, _ := fs.ExtendedStateSize() 43 s.fpLen = uint32(fpLenUint) 44 } 45 46 // FpLen returns the FP state length for ARM. 47 func (s *ArchState) FpLen() int { 48 return int(s.fpLen) 49 } 50 51 func (s *ArchState) String() string { 52 var b strings.Builder 53 fmt.Fprintf(&b, "sysmsg.ArchState{") 54 fmt.Fprintf(&b, " fpLen %d", s.fpLen) 55 b.WriteString(" }") 56 57 return b.String() 58 }