Arithmetic on a NULL pointer is undefined behaviour and could be used by
the compiler to optimize out the arithmetic. Use the integer expansion of
chunk2mem(0) instead to silence this warning:
`arithmetic on a null pointer treated as a cast from integer to pointer is a GNU extension [-Wnull-pointer-arithmetic]`
Two handlers accidentally had the wrong prototype, called the wrong
thing and/or had the wrong name.
Should only affect divrem_overflow_abort, negate_overflow_abort.
Add an UBSAN implementation and a new UBSAN switch to the make build.
The implementation is taken from Onyx and handles most of the cases
that should be needed for a kernel build. Floating point and fancy
C++ CFI features are not supported yet.
To build with UBSAN, pass UBSAN=1 to make such as:
PROJECT=pc-x86-64-test make -jN UBSAN=1
Add a few more #defines for the status register
Tweak the FPU context switch to not rewrite the entire status register,
which may not be a generally safe thing to do.
Updated comment regarding clobbers on the SBI call.
Tweak a boot time print of SBI version.
Add a commented out line to the do-qemuriscv to assist in dumping future
device trees.
Update libfdt from https://github.com/dgibson/dtc at revision
73590342fc85ca207ca1e6cbc110179873a96962
Source is verbatim except moving headers into an include directory added
to the path.
Using 2-clause BSD option.
Disable IO and mem decoding around BAR enumation as described in the PCI
Local Bus specification. This behavior should be safer when messing
around BARs for BAR lengths.
Looks like this is described in /reserved_memory/mmode_resv@<address> as
patched by opensbi on top of the existing qemu provided dtb.
Future patch should parse this instead of hard coding it.
Accessing un-mapped address/address-range results in data abort. Ensure
the address and all the pages in the requested range are mapped. Mapping
is checked at page size, also adjusts the stop address to the nearest valid
address mapped.
Move the mmu_initial_mapping from platform into arch/x86. For this
architecture the default mappings are basically hard coded in arch/x86
anyway, so move ownership of this data there, closer to where it's
actually initialized.
Update the 32 and 64bit paging code to properly use the paddr_to_kvaddr
and vice versa routines.
Update to allocate page tables directly from the pmm instead of the heap
(on 32bit code).
Clean up the x86.h file a bit with how constants are defined
Switch rdtsc to builtin
Added all of the known bits for the main CR registers.
Move the invlpg macro over to the common header.
Update comments in start.S
The old method assumed that all of the tables were mapped within the
kmap area of the kernel. This basically works on 64bit machines but on a
32bit x86 its entirely likely the ACPI tables are at higher physical
addresses that can be reached, which is currently limited to 1GB.
By using the VM it means it can individually map the headers and each
individual table.
Trim the arch mmu unit tests accordingly.
Should probably switch this to a #define, but it's possible some of
these queries could be dynamically detected (XN for example). May
revisit at some point.
vm map takes arg 3 as virtual address. And same needs
to be passed to retrieve aspace. Fix this by passing
right arg.
Test: Ran 'vm map' test
] vm map 0xc0000000 0xffff000ff0000000 1 0x0
arch_mmu_map returns 0
Signed-off-by: Chintan Pandya <chintanpandya@google.com>
-Large cleanup of both the 32 and 64bit mmu code. Still the same general
flow but tighten up usage of mixing physical addresses with virtual
addresses.
-Remove the PAE code path from 32bit mmu, which was unused.
Allow asking the arch layer if it supports NX pages or NS pages.
Have the arch mmu test code test accordingly.
Also tweak the tests to pass on arm32 mmu, which does not precisely
match the return semantics of the rest of the mmu routines on map/unmap.
Some of the 16 bit values the cpu pushes on the stack are aligned to
32bit offsets but actually only 16 bits were pushed. Make sure printf
masks off the top 16 bits when printing these fields out.
Save the model/family information in a new structure.
Move the printing portion of the detection to the arch_init runtime
so it gets a chance to print after the uart is initialized.