Since UEFI requires app to be run in physical address space,
we allocate memory that are identity mapped. Previous identity
mapping works as follows:
1. call vmm_alloc_contigious to obtain a VA1(virtual address) mapping to
PA1(physical address)
2. Use arch_mmu_query to obtain PA1 from VA1
3. arch_mmu_unmap VA1 <-> PA1
4. arch_mmu_map PA1 <-> PA1
Now we can return PA1 as a valid virtual address pointer, which is
mapped to physical memory. However, this has problems. LK allocates a
vmm_region_t struct for each call to vmm_alloc_* . This struct can
never be free'ed, as the associated virtual address VA1 is forever
lost. We can't even free PA1, as PA1 is not a valid argument to
vmm_free(PA1 does not have associated vmm_region_t struct).
The new approach uses pmm_alloc and vmm_reserve_space, allowing
vmm_free_region to be called.
This should cut down on the number of github builders, but having only
one per arch per toolchain per debug per ubsan. Still a lot, but working
on it.
Also means it automatically builds every project in the tree, instead of
just the curated list.
Clean up make targets list-arch and list-toolchain to be much faster and
work without needing to invoke the archtecture's arch rules.mk. This
should make it work on machines that do not have that particular
toolchain in the path.
This is setting up for using it in the github action script.
Was a bit of a hodgepodge of defines. If any of these are needed we can
add them back somewhere a bit more appropriate.
ARRAY_SIZE can use countof() defined in compiler.h
KB/MB/GB are generally duplicately defined in architecture specific
files, but not generically. I couldn't think off the top of my head of a
better place to generically put these, especially since they're used in
asm files, so just deleted it for now.
The other stuff seemed to be just unused anywhere.
LK already has events APIs. To support events protocols in UEFI spec,
I created a wrapper object for LK events. This wrapper object keeps
additional data that are necessary to support UEFI events spec:
* Notification function, or callbacks
* Argument for the notification function
* Type of this UEFI event (which specifies when the callback should be
called)
The events API is essential for supporting async I/O in UEFI. Intended
use case looks like:
* UEFI app creates an event object, attatch callback to this event
* UEFI app calls LK for asynchronous read/write on a block device, with
the newly created events object
* LK executes IO operation in background, after IO finishes, signal the
specified event object
* UEFI's callback gets executed
Two breaking changes:
* fixup_kernel_commandline was removed by upstream
* GblEfiDeviceTreeMetadata's reserve field is removed, instead a `type`
variable is inserted earlier in the struct.
Both changes come from upstream GBL, update LK accordingly
Before this change, errno was "completely un-threadsafe" as the comment
states.
This changes errno to be threadsafe by making errno a thread local
variable.
Require the platform or arch to provide it. The default was pretty
obsolete, assuming a 32bit arch with a split 50/50 mapping. May as well
make it a forced arch thing so that it's known to be correct.
Had to define it for OR1K, it was already defined for all the other
(known) architectures.
-In a few places, rearrange some of the fields of some structures to
pack more nicely in 64bit environments.
-Convert C style comments to C++ style
No functional difference.
For newer SMP and modern cpus, just doing a full fpu context switch
is simpler and cheaper than dealing with the complexity of lazy fpu
context switch logic.
Plus this old logic was broken in the recent SMP-ification of the x86
code base. A functional version of this would be far more complex.
Some of the wrapper routines (printf, fprintf, etc) were defined in
stdio.c which is not necessarily compiled with the same compiler flags
concerning floating point support.
On some architectures (arm64, x86-64) this caused the wrapper routines
to clobber the floating point registers prior to getting into the
printf_engine.
It was found that QEMU process is often under D(Disk Sleep) state
after test fails due to timeout. This suggests that I/O is sometimes
extremely slow on github CI server. Hence increase test timeout to
5s for reliability.
Added platform_setup_system_table, where platform/vendor can
make arbitrary changes to UEFI's system table, overriding
any of the UEFI protocols with custom one.
This allows other components to reference basic UEFI types. Now
different platforms can provide their own override for certain UEFI
protocols.
To keep good include structure, all public headers are put under
include/uefi.
This function was previously put in anon namespace, making it
unavailable for other source files to consume. Since we made this
function an API for consumption, move outside anon namespace so
that linkers can find it.
* Sometimes apt-get install qemu fails with fetch error, run apt-get
update first to mitigate
* unittest.py often fails due to app shell not started in 0.5s, increase
timeout
A large pile of changes to the PC platform and x86 architecture that
facilitate SMP support. Tested in both 64 and 32bit on qemu and real
hardware all the way back through i486.