This is a port from amd64 of r258436, and is intended to make diffs (against amd64 and for future UEFI work) easier to review. Reviewed by: jhb@ Sponsored by: The FreeBSD Foundation