lc-3-2 / lc32sim

LC-3.2 simulator
0 stars 0 forks source link

Pad Sections with Zero Instead of Undefined Data #22

Closed ammrat13 closed 1 year ago

ammrat13 commented 1 year ago

The ELF specification dictates that, when memsz exceeds filesz, the "extra" bytes should be taken to be zero. Previously, the simulator was not setting those bytes to zero, instead keeping them at their randomly initialized values. This commit sets those extra bytes to zero.

Note that everything not specified in the ELF, including the heap, remains randomly initialized.

See: System V Application Binary Interface, Section 5, Pgs. 5-3 to 5-4. https://www.sco.com/developers/devspecs/gabi41.pdf

Test with: test.tar.gz

sameer-s commented 1 year ago

LGTM