tock / elf2tab

Tool to create Tock Application Bundles from ELF files.
MIT License
15 stars 33 forks source link

Add padding to 4K align x86 apps #67

Closed HMiyaziwala closed 1 year ago

HMiyaziwala commented 1 year ago

This code change pads binaries to be 4K aligned for x86 applications so that allocated memory regions can be more correctly handled by an x86 MPU. x86 architectures protect memory at a 4K page granularity, and so an existing x86 MPU would have to grant an application memory outside of its binary if the app is not 4K aligned.

The change follows the pattern established by the ARM "power of two padding". This PR will affect all ELFs that have an x86 machine value.

bradjc commented 1 year ago

Please take a look at #68 and double check it meets your needs.

Since we have two different padding types now it is probably worth making it a little more clear how padding is handled.

HMiyaziwala commented 1 year ago

Please take a look at #68 and double check it meets your needs.

Since we have two different padding types now it is probably worth making it a little more clear how padding is handled.

I have checked and tested the linked PR, it does what we need. I appreciate the refactor!