// Copyright 2016 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 bpfimport// Assemble converts insts into raw instructions suitable for loading// into a BPF virtual machine.//// Currently, no optimization is attempted, the assembled program flow// is exactly as provided.func ( []Instruction) ([]RawInstruction, error) { := make([]RawInstruction, len())varerrorfor , := range { [], = .Assemble()if != nil {returnnil, fmt.Errorf("assembling instruction %d: %s", +1, ) } }return , nil}// Disassemble attempts to parse raw back into// Instructions. Unrecognized RawInstructions are assumed to be an// extension not implemented by this package, and are passed through// unchanged to the output. The allDecoded value reports whether insts// contains no RawInstructions.func ( []RawInstruction) ( []Instruction, bool) { = make([]Instruction, len()) = truefor , := range { [] = .Disassemble()if , := [].(RawInstruction); { = false } }return , }
The pages are generated with Goldsv0.8.2. (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds.