CoolFace
Datasetpublic

Kureiwa/x86_64-freestanding-corpus

x86_64-freestanding-corpus 94,546 compilable and executable x86_64 code samples for freestanding, no-libc systems programming. Every row has a natural language prompt, difficulty level, and tag-based filtering. 93,986 rows (99.4%) are verified to compile with -Werror and exit cleanly when executed. ~10,017,133 tokens total. What this dataset is (and isn't) This is a domain-adaptation + SFT corpus for an existing code model, not a from-scratch pretraining set. At… See the full description on the dataset page: https://huggingface.co/datasets/Kureiwa/x86_64-freestanding-corpus.

sourceHugging Facemitupdated 1mo agoView on Hugging Face
0likes79downloads
Dataset Card

x86_64-freestanding-corpus

94,546 compilable and executable x86_64 code samples for freestanding, no-libc systems programming. Every row has a natural language prompt, difficulty level, and tag-based filtering. 93,986 rows (99.4%) are verified to compile with -Werror and exit cleanly when executed. ~10,017,133 tokens total.

What this dataset is (and isn't)

This is a domain-adaptation + SFT corpus for an existing code model, not a from-scratch pretraining set. At ~10017K tokens it is far too small for pretraining. Use it to:

  1. 1.Continued pretraining: mix at 5-15% weight with a general code corpus (The Stack v2, etc.) when continuing pretraining of a base model like Qwen2.5-Coder, DeepSeek-Coder, or CodeLlama.
  2. 2.Instruction tuning (SFT): the prompt column provides natural language instructions paired with verified code. Use directly for SFT.
  3. 3.Evaluation: hold out a subset and check pass@k against expected_stdout and assertions.

Verification

subsetrowsrun_okwith promptwith assertions
kernel_bypass5,8505,850 (100.0%)5,8500
syscall20,61920,619 (100.0%)20,6190
fundamentals58,01458,014 (100.0%)58,0143,476
advanced4,6004,200 (91.3%)4,6000
quirks5,4635,303 (97.1%)5,463240
total94,54693,986 (99.4%)

Build verification: every row compiled with gcc 14.2.0, g++ 14.2.0, nasm 2.16.01, ld 2.44. Run verification: every runnable row was executed as a static binary and exited cleanly.

The only rows with verified_run=False are UEFI scenarios (runtime=uefi) which need UEFI firmware to execute. These are build-verified and correct code.

Subsets

kernel_bypass (5,850 rows)

Ring-3-safe code that bypasses the kernel using userspace-accessible CPU instructions (rdtsc, cpuid, rdpmc, wrpkru, atomics, fences, fxsave, sse).

scenariorows
cmpxchg_atomic1270
cpuid_features120
cpuid_topology120
cpuid_vendor120
fldcw_fpu120
fxrstor_state120
fxsave_state120
lfence_barrier120
mfence_rwmb120
pause_spin1270
rdpid120
rdpkru120
rdpmc_basic120
rdtsc_basic120
rdtscp120
sfence_wmb1270
sse_memcpy120
wrpkru120
xadd_atomic120
xchg_spinlock120

syscall (20,619 rows)

Raw syscall instruction with the x86_64 Linux ABI. No libc.

scenariorows
sys_brk1137
sys_clone685
sys_close822
sys_dup900
sys_execve972
sys_exit1000
sysfutexwait1054
sysfutexwake1139
sys_getpid1140
sys_gettimeofday1114
sys_kill722
sys_mmap1000
sys_mprotect1549
sys_munmap1140
sys_nanosleep606
sys_open1139
sys_pipe900
sys_read1000
sysrtsigaction1600
sys_write1000

fundamentals (58,014 rows)

Basic programming constructs (print, arithmetic, math, loops, sorting, strings, bit ops, recursion) implemented freestanding.

scenariorows
arith_div2917
arith_mul1282823
arith_pow3000
bit_popcount2006
loop_break3000
loop_nested2633
math_factorial3000
math_fibonacci3000
math_gcd3674
math_isprime3663
mathpowmod2793
math_sqrt3663
print_hex2843
print_int2855
print_str2746
recursion_hanoi4931
sort_bubble2400
sort_insertion1774
str_memcpy2441
str_strlen1852

advanced (4,600 rows)

Barriers, fault handlers, spectre mitigation, SIMD, UEFI, PIC, cpuid power.

scenariorows
avx2dotproduct200
avx2_memcpy200
avx2_sum200
c11atomicsacquire200
c11atomicsrelease200
c11atomicsseq_cst200
compiler_barrier200
cpuid_cstate200
cpuid_power200
got_access200
lfence_mitigation200
lfence_serial200
mfence_serial200
picriprelative200
rdtsctimingprobe200
sfence_serial200
sigfpe_handler200
sigill_handler200
sigsegv_handler200
speculation_fence200
sse4_strlen200
uefi_entry200
uefi_print200

quirks (5,463 rows)

C/C++/ASM language quirks: RAII, version-specific features, ISA instructions.

scenariorows
alignas_alignof80
anonymous_union80
atomictypequalifier80
avx2vexnasm80
binarydigitsep_c2323
bitscanbsf_bsr80
bitfield_layout80
bt_family80
builtinbitops80
builtin_expect80
caserangegcc80
cmov_branchless80
cmpxchg_cas80
comma_operator80
compound_literal80
concepts_consteval80
constexpr_math80
constexprudldecltype80
cpp14binaryliterals80
cpp14constexprloops80
cpp17_attributes80
dowhilezero_macro80
enter_leave80
enumclassoverride80
fold_ctad80
generic_dispatch80
goto_cleanup80
ifconstexprbranch80
integer_promotion80
lambdarangeforauto80
loop_jrcxz80
movenoutility80
movzx_movsx80
nullptr_c2380
offsetof_macro80
packed_attribute80
placement_new80
pragma_pack80
raiifdwrapper80
raiilockguard80
raiimmapwrapper80
raiiscopeguard80
raiiuniqueptr_munmap80
restrict_qualifier80
rotatesrolror80
sarsignedshift80
setcc_bool80
shld_shrd80
signextensionchar80
sse4_crc3280
sseintpacked80
ssescalarfp80
staticassertc1180
stdintexactwidth80
stringcmpsbmemcmp80
stringlodsbtransform80
stringstosbmemset80
structured_ifconstexpr80
template_metaprog80
threadlocalc80
threadlocalcpp80
trailing_move80
truefalsec2380
typepununion80
typedeffuncptr80
variadic_forward80
virtualdispatchno_rtti80
vlaruntimesizeof80
x87fpubasic80

Schema

columntypedescription
idint32unique within each subset
langstringc89/c99/c11/c17/c23/cpp98..cpp23/asmx8664
scenariostringscenario name (see tables above)
codestringfull source code
build_cmdstringexact shell command to compile
verified_runbooldid the binary exit cleanly?
promptstringnatural language instruction
expected_stdoutstringexpected stdout (empty if no output)
assertionsstringsemicolon-separated CHECK() expressions
difficultystringeasy / medium / hard
tagsstringcomma-separated tags (syscall, atomics, simd, etc.)
tokensint32estimated token count
n_linesint32line count
ub_riskstringUB risks found by static analysis
runtimestringlinux / uefi

Usage

Load with the datasets library

python
from datasets import load_dataset

# Load a single subset
ds = load_dataset("Kureiwa/x86_64-freestanding-corpus", "fundamentals")
for row in ds["train"]:
    print(row["prompt"])
    print(row["code"][:200])
    break

# Load all subsets
for subset in ["kernel_bypass", "syscall", "fundamentals", "advanced", "quirks"]:
    ds = load_dataset("Kureiwa/x86_64-freestanding-corpus", subset)
    print(f"{subset}: {len(ds['train'])} rows")

Load with pyarrow

python
import pyarrow.parquet as pq

t = pq.read_table("data/fundamentals.parquet")
df = t.to_pandas()
print(df[["id", "lang", "scenario", "difficulty", "verified_run"]].head())

Filter for training

python
# Only run-verified rows
df = df[df["verified_run"] == True]

# Only easy difficulty
df = df[df["difficulty"] == "easy"]

# Only C99
df = df[df["lang"] == "c99"]

# Only scenarios with assertions
df = df[df["assertions"] != ""]

Compile and run a sample

bash
echo '<code from the code column>' > file.c
gcc -std=c99 -m64 -nostdlib -ffreestanding -static -no-pie -Werror file.c -o file
./file; echo "exit: $?"

Languages

langkernel_bypasssyscallfundamentalsadvancedquirkstotal
asmx86641706324161601300152025474
c11620158348443005207867
c1762015834844007047
c236201583484402237270
c8962016064844007070
c99620158348442600136011007
cpp1162010622939012005821
cpp146201062293902404861
cpp173801062293903204701
cpp20170106229390804251
cpp2317010622939004171
cpp9862010472939004606
uefi0004000400

Build commands

  • —C: gcc -std=cNN -m64 -nostdlib -ffreestanding -static -no-pie -Werror file.c -o file
  • —C++: g++ -std=c++NN -m64 -nostdlib -ffreestanding -static -no-pie -fno-exceptions -fno-rtti -Werror file.cpp -o file
  • —ASM: nasm -f elf64 file.s -o file.o && ld -nostdlib -static file.o -o file

Limitations

  • —No composition examples yet: every row is a single isolated scenario. A composition subset (multi-scenario programs, 100+ lines) is planned.
  • —Output verification is partial: expected_stdout is empty for most rows. Runtime assertions are present for ~5% of rows. Full correctness verification is planned.
  • —Entry point boilerplate: most rows use void _start(void). Variation in entry patterns is planned to prevent memorization.
  • —No multi-file examples: every row is a single file. Multi-file support is planned.

Generation method

12 GLM-5.2 sub-agents wrote hand-curated seed templates. A deterministic expander produced variants. After generation, every row was build-verified and run-verified. Failing rows were fixed or filtered out.

The kernel_bypass subset was inspired by EoSD by rui-727, which demonstrates that "kernel bypass" means using ring-3-safe userspace instructions, not ring-0 privileged instructions.

Toolchain

  • —gcc 14.2.0, g++ 14.2.0, ld 2.44
  • —nasm 2.16.01
  • —Linux x86_64

License

MIT. Generated by GLM-5.2 (Z.ai).