bits-1007 released with these changes:
Add initial support for 64-bit EFI. A BITS .iso image will now boot as either a disk image or CD image for any of 32-bit BIOS, 32-bit EFI, or 64-bit EFI. For updated installation procedures, see INSTALL.txt.
Add a GRUB patch to 16-byte align the stack for grub_main()
. The x86-64
ABI requires a 16-byte-aligned stack, which GRUB did not provide. That
caused some crashes, notably when running some SSE instructions. Fix by
aligning the stack in assembly before calling grub_main()
.
Port SMP support to support running processors in 64-bit mode:
Add CPU bringup code for 64-bit long mode. Port all remaining assembly to 64-bit, and to the 64-bit ABI.
Since long mode requires paging, pass the page-table pointer from the BSP (as set up by the firmware) to the APs. Note that the current approach to this will fail if the firmware relocates its page tables above 4GB after its initial page table setup. Also note that since all memory requires mapping via the page table, accessing memory not mapped by the BSP page table (such as a wild pointer supplied by a firmware structure or an adventurous tester) will trigger an unhandled page fault and unceremoniously die.
Increase the size of the SMP working memory to accomodate larger data structures.
Use a relative offset in the GPF handler, not an absolute offset; that avoids the need for a 64-bit offset.
Port IDT parsing and setup from assembly to C.
Port many assembly functions to use inline assembly, eliminating their calling-convention-specific prologue and epilogue code, to simplify the 64-bit port, and make the assembly more maintainable (by having less of it):
cpuid
pause
- I/O port read/write
rdtsc
cli
andsti
rdmsr
wrmsr
- infinite loop
lidt
andsidt
- getting
CS
drop_ap_lock
smp: Delete several bits of old unused code:
- Unused assembly functions
- Unused data structures
- Unused function prototypes
- The "real-mode callback" mechanism, once used to park CPUs before booting an OS, but eliminated long ago by simply leaving the CPUs in an mwait loop in memory reserved from the OS.
- A synchronization variable that the AP code no longer uses (a relic of waking the APs up via SIPI each time we have code to run, rather than waking them up once and putting them in an mwait loop waiting for work to do).
- Code that allows the function called via SIPI to return, now unused because we call a function that waits forever for work to do.
Numerous cleanups to make C code 64-bit clean:
Use pointer types rather than integral types when appropriate.
Fix pointer-size and integer-size assumptions.
Fix printf format strings.
Make Python interface code 64-bit clean. Use
Py_BuildValue
andPyArg_ParseTuple
'k' conversions for pointers. Convert safely between some ACPI always-32-bit "pointers" and native pointers, with bounds checking. Consistently use "unsigned long" for an integer of the same size as a pointer.Make various config defines and typedefs portable.
Rewrite Python's file <-> fd mapping to support
sizeof(int) != sizeof(FILE *)
Abstract
FILE *
<-> integer fd conversions into functions to make them easier to replace and more maintainable.Handle overflow errors safely in
fwrite()
python: fdlibm: Explicitly define
__LITTLE_ENDIAN
fdlibm autodetected
__LITTLE_ENDIAN
based on some compiler definitions defined for 32-bit x86, but not for 64-bit x86. Define it explicitly to bypass fdlibm's faulty autodetection.
Only one change to make the Python code 64-bit clean; thanks to the wonders of a language with arbitrary-precision integers, the one and only change involves parsing data structures supplied by the (non-Python) firmware:
- efi: Parse the (completely undocumented) padding after
FirmwareRevision
in system table
Update boot support and documentation:
INSTALL.txt: Update installation instructions for EFI support
build: Build and install EFI binaries
grub-mkrescue already creates EFI binaries and embeds them in the El Torito disk image for the .iso; however, those are not easily accessible for use when creating a writable disk image, and they don't include all the necessary modules to support disks. Build images with a more complete set of modules for disk support, and ship them in
/efi/boot
in the BITS binary distribution.Add support for booting BITS .iso files as EFI disk images, via an even more hybridized hybrid .iso format.
Introduces a dependency on xorriso 1.3.0 or newer, and backports several grub-mkrescue changes from upstream GRUB.
README.Developers.txt: Document that building the EFI image requires mtools (grub-mkrescue invokes mtools to construct the EFI El Torito disk image to embed in the .iso). The previous release introduced this dependency but didn't document it.
Other changes in this release:
_bits
: Split out SMP and ACPI functions into separate_smp
and_acpi
modules, making it easier to do incremental ports of_bits
.Move test verbosity level entirely to Python
No tests use GRUB scripting anymore, so eliminate the
test_verbose
environment variable, and move the test verbosity level entirely inside the Pythontestsuite
module.build: Enable parallel builds on all available CPUs
efi: Expand variable-reading sample code to read and display variable values
Uses both
GetNextVariableName
andGetVariable
.Displays variable values as hex/ascii dumps, since they may (and usually do) contain non-ascii data, and the interpretation depends on the variable UUID and name.
python: Implement
assert()
and make it actually assert.GRUB's
assert
prints a message on assertion failure but then returns. Abort instead.Also support capturing and printing the assert expression.
smp: Verify that the SIPI target code fits in the region allocated for it
The SIPI target code has to fit within the first 2k of the allocated SIPI target page, minus the size of the data structure passed to APs. Before expanding that code further, add a check to make sure it won't silently start conflicting with the data structure.
python: Move all the C/POSIX compatibility functions from inlines in
pyconfig.h
to a separate source filetestsuite: Remove the rdmem GRUB command
No GRUB scripts use this functionality, and Python scripts have equivalent (and much more capable) functionality through bits functions.
pstate: Handle processors without turbo when testing hardware P-states
smilatency: Make the test variant that disables USB via BIOS handoff actually disable USB via BIOS handoff