Skip to content

Latest commit

 

History

15 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

English (en-US) 简体中文 (zh-CN)

 

KNSoft.FirmwareSpec

NuGet Downloads GitHub Actions Workflow Status PR Welcome GitHub License

KNSoft.FirmwareSpec provides C/C++ definitions, explicit type metadata, and safe C/C++ and .NET decoders for firmware and processor interfaces. The native interface is compatible with MSVC and GCC.

Specification Definition Type information Sample program
SMBIOS 3.9.0 SMBIOS.h SMBIOS.TypeInfo.h SmbiosDecode.c
ACPI 6.6 ACPI.h ACPI.TypeInfo.h AcpiDecode.c
Intel CPUID (SDM v092 Leaf 01H/07H) CPUID.h CPUID.TypeInfo.h CpuidDecode.c

The shared decoder primitives in FirmwareDecode.h perform bounds, overflow, length, and checksum validation without allocation. Complex AML, OEM-defined, and architecture-specific payloads remain available as bounded raw data when a compact generic representation would lose semantics.

GitHub Action compiles and runs sample programs, artifact contains them and theirs text outputs.

Usage

NuGet package KNSoft.FirmwareSpec is out-of-the-box, install to project and include wanted header, for example:

#include <KNSoft/FirmwareSpec/SMBIOS.Decode.h>
#include <KNSoft/FirmwareSpec/ACPI.Decode.h>
#include <KNSoft/FirmwareSpec/CPUID.Decode.h>

SMBIOS definitions support compile-time version selection through SMBIOS_VERSION. See each header for its supported specification level.

The same package contains a pure .NET 10 parser. It performs no local firmware I/O, so a server can safely parse byte buffers collected by a remote endpoint:

FirmwareDecodeStatus status = SmbiosParser.TryParseWindowsRaw(data, out SmbiosTable? table);
status = AcpiParser.TryParse(data, out AcpiTable? acpiTable);
status = CpuidParser.TryParse(data, out CpuidSnapshot? snapshot);

SmbiosParser.TryParseWindowsRaw accepts the RAW_SMBIOS_DATA buffer returned by Windows. AcpiParser.TryParse accepts one complete ACPI table. CPUID is transported as consecutive 24-byte little-endian records containing Leaf, SubLeaf, EAX, EBX, ECX, and EDX; CPUID is executed only by the collector, never by the parser.

Caution

In beta stage, may contains some bugs and various issues, should be used with caution.

You could report issue or send PR to make this project better.

License

KNSoft.FirmwareSpec is licensed under the MIT license.

About

C/C++ definitions of multiple firmware specifications with corresponding type information

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages