Page MenuHomeFreeBSD

libsa: smbios: Use 64-bit entry point if table below 4GB on non-EFI boot
AcceptedPublic

Authored by olce on Fri, Mar 7, 4:57 PM.

Details

Summary

On amd64, boot blocks and the non-EFI loader are 32-bit compiled as
clients of BTX, so cannot access addresses beyond 4GB. However, the
64-bit entry point may refer to a structure table below 4GB, which we
want to use if the BIOS does not provide a 32-bit entry point. The
situation is similar for powerpc64.

Consequently, always compile-in support for the 64-bit entry point, but
ensure that it is not selected on 32-bit-compiled boot loaders if the
structure table it points to grows beyond 4GB (as it is then not
accessible).

PR: 284460

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 62828
Build 59712: arc lint + arc unit

Event Timeline

olce requested review of this revision.Fri, Mar 7, 4:57 PM

I have an answer to the question I left on the last revie.

stand/libsa/smbios.c
189

I'd use the pointer size here. The cheri folks have asked that we prefer that everywhere.

195

Don't you just need to test the end address?

stand/libsa/smbios.c
189

Is replacing this #ifdef by #if __SIZEOF_POINTER__ < 8 OK?

I suspect that __SIZEOF_POINTER__ includes capabilities on Cheri platforms. This makes the test above semantically imperfect (what is really wanted is the width of the address space), but it will work in practice as all Cheri platforms have 64-bit addressing. I also suspect the boot loaders are not compiled/executed in capability mode (I think this would require specific code in other existing places in the loader).

195

Mmm... yes. I just wanted to be extra paranoid in case the table is botched, but doing it that way is not very elegant, and anyway if done should apply to all cases. I'll just leave out the first test.

stand/libsa/smbios.c
189

that's the change they'd recommend to me in the past when I've done these things. True, it's imperfect here, since we're not creating a cap pointer, but it doesn't trigger their scanning scripts that look for LP32 tests. you can ask brooks or jrtc23 to see if I'm understanding their ask correctly.

markj added inline comments.
stand/libsa/smbios.c
189

In general I think using _ILP32 to test for 32-bit platforms is ok, the problem is more with using _LP64 to test for "not 32-bit", since that excludes CHERI, which is also not a 32-bit platform.

This revision is now accepted and ready to land.Sun, Mar 9, 9:22 AM