Commit Graph

2442 Commits

Author SHA1 Message Date
Pedro Falcato
3b4dade91f [bus][pci] Disable IO and mem decoding around BAR enumeration
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.
2023-01-15 18:35:49 -08:00
Travis Geiselbrecht
91d0a5f7d1 [lib][fdtwalk] add routine to find and parse /reserved-memory node
Add logic to the riscv virt platform to properly mark off memory
claimed by OpenSBI.
2022-12-17 17:12:35 -08:00
Travis Geiselbrecht
2d561b4fcf [platform][qemu-virt-riscv] seems the first 512K are now used by opensbi 1.1
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.
2022-12-17 00:57:37 -08:00
gvk51
8b1335ea7e [lib][debugcommands] sanity check address is mapped before display/modify
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.
2022-11-03 00:04:30 -07:00
Travis Geiselbrecht
bcfad25587 [arch][x86][mmu] update how mmu code accesses physical pages
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).
2022-11-02 23:48:49 -07:00
Travis Geiselbrecht
7742bd021b [arch][x86] general cleanup
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
2022-11-02 23:02:24 -07:00
Travis Geiselbrecht
0d0568612a [lib][acpi_lite] update to use the VMM to map acpi tables in
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.
2022-11-02 21:44:15 -07:00
Travis Geiselbrecht
7ddde308a3 [arch][x86][mmu] fix unmap routines to actually work
also additionally invlpg the address.
2022-11-02 02:09:46 -07:00
Travis Geiselbrecht
b990ad7999 [dev][net][e1000] just added a few comments with device ids
Was fiddling with making it work on i219 based e1000s, which was not
easily fruitful. However, may as well check in some comments with some
ids.
2022-11-02 00:28:36 -07:00
Travis Geiselbrecht
2367686854 [make] add a way for a module to opt into additional warnings
Move -Wmissing-declarations and -Wmissing-prototypes into this bucket.
Opt in most of the core top level modules in the system. More to follow.
2022-10-23 23:16:48 -07:00
Travis Geiselbrecht
4ce2e6a35d [libc] fix a warning squelch for some locally defined routines 2022-10-23 23:03:17 -07:00
Travis Geiselbrecht
7017a8fff9 [arch][mmu] add another routine to query if the arch supports user aspaces
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.
2022-10-23 22:40:00 -07:00
Chintan Pandya
550256d6bc kernel: vm: Fix incorrect argument passing in 'vm map' test
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>
2022-10-23 21:40:18 -07:00
Travis Geiselbrecht
ee880bad58 [ci][gcc] update main toolchain to gcc 12.2.0 2022-10-23 21:26:04 -07:00
Travis Geiselbrecht
45e864d0c6 [ci] update github cache to v3 2022-10-23 21:25:12 -07:00
Travis Geiselbrecht
8cc5b06eeb [ci] update github checkout action to v3 2022-10-23 21:25:12 -07:00
Travis Geiselbrecht
5377fcbd12 [kernel][vm] add error handling with failed arch mmu mappings
In the 3 places in the upper VMM where it calls arch_mmu_map, try to
gracefully handle errors by unwinding the region creation.
2022-10-23 21:02:22 -07:00
Travis Geiselbrecht
2e81bfd55f [arch][x86] remove an extra printf left in the x86 mmu code 2022-10-23 21:00:15 -07:00
Travis Geiselbrecht
08b3238952 [arch][x86] clean up of mmu code
-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.
2022-10-23 20:37:33 -07:00
Travis Geiselbrecht
611bd1cba0 [bus][pci] ask for 4MB alignment when mapping the ecam
This helps any architecture that might have a better chance with using
large pages.
2022-10-21 23:47:47 -07:00
Travis Geiselbrecht
3a6b43cb32 [arch][mmu][tests] slight tweaks 2022-10-21 01:35:28 -07:00
Travis Geiselbrecht
d5451cc8e6 [arch][tests] add a way to query some arch mmu features
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.
2022-10-21 00:00:49 -07:00
Travis Geiselbrecht
f1dad5f4c8 [arch][mmu] remove arch_mmu_disable which is currently unused 2022-10-20 23:26:45 -07:00
Travis Geiselbrecht
0b5202362d [arch][mmu][test] change the arch mmu test file to c++
This lets us more easily use some C++ for test cleanup.
Updated the arch mmu flags to be explicitly unsigned to make C++
happier.
2022-10-20 23:24:33 -07:00
Travis Geiselbrecht
f6a2610aef [arch][mmu][test] update a few of the expects to asserts in these tests
In a few places where it's dangerous to proceed, raise to an assert so the
test stops.
2022-10-19 21:02:06 -07:00
Travis Geiselbrecht
d36f5ab8d8 [arch][x86] fix a bug in the unmap routine on 32bit mmu code
Was apparently already fixed on the 64bit side, but never rolled back.
2022-10-19 20:58:32 -07:00
Travis Geiselbrecht
318673348f [arch][x86][32] fix a bug in the exception report
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.
2022-10-19 20:22:10 -07:00
Travis Geiselbrecht
b7d7215030 [arch][x86][fpu] clean up the fpu init code to print info later 2022-10-19 20:17:05 -07:00
Travis Geiselbrecht
77d8622268 [arch][x86] clean up a bit of the cpuid detection
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.
2022-10-19 20:03:49 -07:00
Travis Geiselbrecht
2ac68a56a8 [arch][x86] no need to "memory" clobber simple in instructions
They only read data into the eax register instead of memory.
2022-10-19 19:27:57 -07:00
Travis Geiselbrecht
96231b132f [bus][pci] make the pci bus dump on bootup use a little less horizontal space
Should fit better on an 80 column display
2022-10-19 00:24:10 -07:00
Travis Geiselbrecht
208bae5feb [scripts][do-qemux86] use the older 'pc' machine model when selecting x86-32
This gets a bit more coverage of hardware. In general if using 32bit LK
it's for running on older hardware anyway.
2022-10-18 23:59:15 -07:00
Travis Geiselbrecht
3a6c4aed8f [bus][pci] do not automatically initialize the bus manager in pci_init_legacy
This lets the caller do any last minute resource set up before starting
the bus manager. Is consistent with the way pci_init_ecam() works.
2022-10-18 23:58:18 -07:00
Travis Geiselbrecht
5f9e6fdefc [arch][x86][cpuid] clamp number of cpuid entries to read at boot
Make sure we only read up to the max amount of cpuid values we have
preallocated in our static array.
2022-10-18 23:56:52 -07:00
Travis Geiselbrecht
e02401e4bf [arch][x86] fix up some in instruction macros
Turns out all of the in and rep ins/outs instruction macros have been wrong
since they were first added.

-Make sure they clobber memory
-Make sure edi/esi/ecx registers are marked as both read and written by
the instruction.

The latter was causing a codegen problem in the ide driver where the
pointer was pushed forward by a rep ins but the compiler didn't know the
register was modified.
2022-10-18 23:07:32 -07:00
Pedro Falcato
165f826ca3 [platform] [riscv-virt] Fix PLIC_PRIORITY macro
Old PLIC_PRIORITY macro had an off-by-one bug, causing you to set the
priority for the wrong IRQ.
2022-09-28 19:36:13 -07:00
Milis Linux
2550f205b8 [documentation] add a getting started guide 2022-09-26 10:08:08 -07:00
Michael Bishop
95ac371146 [lib][gfx] fix undefined flush pointer
all places that call flush, check if its null before calling it
but its never actually written to, so it can sometimes point to garbage and just fault
2022-09-25 18:16:52 -07:00
Michael Bishop
368b5f69b8 [lib][libc] add missing BE64SWAP 2022-09-25 18:16:06 -07:00
Michael Bishop
f4b2fa9a6b [dev][power][psci] refactor out of the qemu-virt-arm module 2022-09-25 18:14:50 -07:00
Travis Geiselbrecht
baca46e133 [lib][libc] fix an incorrect include path in a libc file 2022-09-25 18:03:59 -07:00
mni
034a8d0ede [libc] add atof() function 2022-09-06 10:26:41 -07:00
Travis Geiselbrecht
213cc90857 [gitignore] add clangd and vscode dirs to the ignore list 2022-08-18 19:14:22 -07:00
Travis Geiselbrecht
00d653306d [tools][bin2h] mark as python3 compatible 2022-08-18 19:11:46 -07:00
Travis Geiselbrecht
c44c6ed86e Merge from luka177:f4-update
Update the stm32f4xx ST peripheral libraries.
2022-08-14 19:07:35 -07:00
Travis Geiselbrecht
55a6a38469 [target][qemu-m4] tweak a line after stm32f4xx library changed a definition. 2022-08-14 19:06:23 -07:00
Travis Geiselbrecht
f2cf99bf73 [platform][stm32f4xx] append the necessary #define to GLOBAL_COMPILEFLAGS
GLOBAL_CFLAGS will only work for .c files, which breaks on the first
inclusion of the headers by a .cpp file. *_COMPILEFLAGS is for all
language types (C, asm, C++)
2022-08-14 19:05:20 -07:00
Travis Geiselbrecht
2985728864 [stm32f4xx][stdperiph driver] remove +x from file modes in imported files 2022-08-14 19:00:16 -07:00
Travis Geiselbrecht
627e0a5cc0 [stm32f4xx][stdperiph driver] fix a typo in a wait loop 2022-08-14 18:59:50 -07:00
Milis Linux
c4676e9445 [tcp] remove extra printf 2022-08-14 18:50:32 -07:00