MCPcopy Create free account
hub / github.com/LPC4/Full-Stack / to_flat_binary

Method to_flat_binary

crates/asm-to-binary/src/assembler/output.rs:898–911  ·  view source on GitHub ↗

Produce a raw flat binary: all sections packed in load order (non-BSS first, then BSS as zeros). No ELF headers are included. Suitable for bootloaders that copy the image directly into memory.

(&self)

Source from the content-addressed store, hash-verified

896 push_u64_le(&mut buf, sec.sh_flags);
897 push_u64_le(&mut buf, 0);
898 push_u64_le(&mut buf, sec_offsets[i]);
899 push_u64_le(&mut buf, file_size.max(size));
900 push_u32_le(&mut buf, 0);
901 push_u32_le(&mut buf, 0);
902 push_u64_le(&mut buf, sec.sh_addralign);
903 push_u64_le(&mut buf, 0);
904 }
905 let symtab_shndx = 1 + prog_secs.len() + rela_secs.len() + 2;
906 for (i, sec) in rela_secs.iter().enumerate() {
907 push_u32_le(&mut buf, rela_name_offs[i]);
908 push_u32_le(&mut buf, SHT_RELA);
909 push_u64_le(&mut buf, 0);
910 push_u64_le(&mut buf, 0);
911 push_u64_le(&mut buf, rela_offsets[i]);
912 push_u64_le(&mut buf, sec.bytes.len() as u64);
913 push_u32_le(&mut buf, symtab_shndx as u32);
914 push_u32_le(&mut buf, sec.target_index as u32);

Callers 6

start_bootMethod · 0.80
uiMethod · 0.80
setup_kernel_vmFunction · 0.80

Calls

no outgoing calls