ProgramGen / tasks /data /reverse /9elements__go-linux-lowlevel-hw.8b54f74 /environment /docs /README.md
ProgramGen / tasks /data /reverse /9elements__go-linux-lowlevel-hw.8b54f74 /environment /docs /README.md
|
Download tasks/data/reverse/9elements__go-linux-lowlevel-hw.8b54f74/environment/docs/README.md from Lego-X/ProgramGen: direct link, hf CLI and curl.
- Browser
- Download file 3.41 kB
-
https://huggingface.co/datasets/Lego-X/ProgramGen/resolve/main/tasks/data/reverse/9elements__go-linux-lowlevel-hw.8b54f74/environment/docs/README.md
- Command line
-
hf download hf://datasets/Lego-X/ProgramGen/tasks/data/reverse/9elements__go-linux-lowlevel-hw.8b54f74/environment/docs/README.md
-
curl -L -o README.md https://huggingface.co/datasets/Lego-X/ProgramGen/resolve/main/tasks/data/reverse/9elements__go-linux-lowlevel-hw.8b54f74/environment/docs/README.md
3.41 kB
go-linux-lowlevel-hw — Usage Documentation
Cleanroom usage docs extracted from the repository README of
9elements/go-linux-lowlevel-hw.
go-linux-lowlevel-hw provides low level access to common hardware on UNIX-like
platforms.
Description
This package provides low level access to certain hardware typically found on modern x86 PCs. Some information is only available when run as the most privileged user. Thus this library is to be used in preproduction and testing environments with relaxed kernel security.
Be warned, you could brick your system.
How to use this library
package main
import (
"github.com/9elements/go-linux-lowlevel-hw/pkg/hwapi"
)
func main() {
h := hwapi.GetAPI()
//...
}
Import path: github.com/9elements/go-linux-lowlevel-hw/pkg/hwapi
Entry point: hwapi.GetAPI() returns the API interface described below.
Interfaces
The GetAPI() call returns an interface providing the following methods
(public API reference):
// cpuid
VersionString() string
HasSMX() bool
HasVMX() bool
HasMTRR() bool
ProcessorBrandName() string
CPUSignature() uint32
CPULogCount() uint32
// e820
IsReservedInE820(start uint64, end uint64) (bool, error)
// iommu
LookupIOAddress(addr uint64, regs VTdRegisters) ([]uint64, error)
AddressRangesIsDMAProtected(first, end uint64) (bool, error)
// msr
ReadMSR(msr int64) (uint64, error)
ReadMSRAllCores(msr int64) (uint64, error)
// msr_intel
HasSMRR() (bool, error)
GetSMRRInfo() (SMRR, error)
IA32FeatureControlIsLocked() (bool, error)
IA32PlatformID() (uint64, error)
AllowsVMXInSMX() (bool, error)
TXTLeavesAreEnabled() (bool, error)
IA32DebugInterfaceEnabledOrLocked() (*IA32Debug, error)
// pci
PCIEnumerateVisibleDevices(cb func(d PCIDevice) (abort bool)) (err error)
PCIReadConfig8(d PCIDevice, off int) (uint8, error)
PCIReadConfig16(d PCIDevice, off int) (uint16, error)
PCIReadConfig32(d PCIDevice, off int) (uint32, error)
PCIWriteConfig8(d PCIDevice, off int, val uint8) error
PCIWriteConfig16(d PCIDevice, off int, val uint16) error
PCIWriteConfig32(d PCIDevice, off int, val uint32) error
PCIReadVendorID(d PCIDevice) (uint16, error)
PCIReadDeviceID(d PCIDevice) (uint16, error)
// hostbridge
ReadHostBridgeTseg() (uint32, uint32, error)
ReadHostBridgeDPR() (DMAProtectedRange, error)
// phys
ReadPhys(addr int64, data UintN) error
ReadPhysBuf(addr int64, buf []byte) error
WritePhys(addr int64, data UintN) error
// tpm
NewTPM() (*TPM, error)
NVLocked(tpmCon *TPM) (bool, error)
ReadNVPublic(tpmCon *TPM, index uint32) ([]byte, error)
NVReadValue(tpmCon *TPM, index uint32, password string, size, offhandle uint32) ([]byte, error)
ReadPCR(tpmCon *TPM, pcr uint32) ([]byte, error)
// acpi
GetACPITableDevMem(n string) ([]byte, error)
GetACPITableSysFS(n string) ([]byte, error)
// smbios
IterateOverSMBIOSTables(n uint8, callback func(s *smbios.Structure) bool) (ret bool, err error)
IterateOverSMBIOSTablesType0(callback func(t0 *SMBIOSType0) bool) (ret bool, err error)
Requirements / notes
- Go module:
github.com/9elements/go-linux-lowlevel-hw(seego.modin the repository for the exact Go version and dependencies). - Many operations (MSR reads, physical memory access, PCI config space, TPM access) require root or otherwise elevated privileges on Linux.
- Intended for preproduction and testing environments only.