Commit Graph

2356 Commits

Author SHA1 Message Date
Travis Geiselbrecht
b76ba5ec0e [scripts][do-qemuriscv] synchronize with options available from arm version
Most notably the ability to specify the disk image
2022-05-12 20:24:17 -07:00
Travis Geiselbrecht
74386913a0 [scripts][do-qemuarm] set script=no when using tun/tap 2022-05-12 20:08:21 -07:00
Travis Geiselbrecht
3ba03f7def [external][libm] add -Wno-maybe-uninitialized
Some older code triggers this warning on gcc 12.1.
2022-05-12 20:04:42 -07:00
Travis Geiselbrecht
89f8e62587 [fs][fat][test] add some more test code
Also create a large zero filled file and add it to the test fs, to try
to make sure there's at least one file that crosses a FAT sector.
2022-04-29 22:12:30 -07:00
Travis Geiselbrecht
144f608bce [fs][fat] add support for FAT12
The 12 bit fat parsing code is a little tricky.
2022-04-29 22:10:11 -07:00
Travis Geiselbrecht
40f516c15a [lib][unittest] tweak the command line to let you list and selectively run individual tests 2022-04-29 20:39:05 -07:00
Travis Geiselbrecht
9a39da5651 [app] tweak app start to only run apps with entry points defined
Also remove a few empty extraneous app structs that are not doing
anything currently.
2022-04-29 20:38:15 -07:00
Travis Geiselbrecht
914c9c2a2f [dev][virtio-blk] update to newer version of the device
Nothing fundamentally changed, just update to new feature bits and print
them at device detection time.
Try to negotiate the guest feature set as well, though nothing
fundamentally changes at this time.
2022-04-26 00:40:03 -07:00
Travis Geiselbrecht
b834181637 [dev][virtio-block] fix bug when not using paging
In the non VM path the existing routine wouldn't subtract from len, so
the function would (properly) return bytes transferred instead of zero.

The wrapping code was written to assume 0 and not bytes transferred,
which seemed like a workaround for broken code. Change the inner routine
to always return bytes transferred and adjust wrapper routines
accordingly.
2022-04-25 23:37:39 -07:00
Travis Geiselbrecht
1c9caf9f64 [fs][fat][test] start of unittests for fat file system
Requires a block device be present with a pre-formatted fs, but
should fail gracefully if its not present.
2022-04-25 23:17:55 -07:00
Travis Geiselbrecht
f6f43edc3c [fs][tests] break some fs tests into their own module
Include the test modules if the overal virtual/test module is included.
Also set a new global build system var along with a configuration
variable.
2022-04-25 23:17:55 -07:00
Travis Geiselbrecht
cb5ccee400 [fs][fat] fix a bug in close_dir that forgot to delete dir nodes 2022-04-25 23:17:55 -07:00
Travis Geiselbrecht
c08d540fd6 [lib][fs] add a trace printf when unmounting 2022-04-25 23:17:45 -07:00
Travis Geiselbrecht
f537ff4f9a [lib][unittest] get unittest header working with C++ source
Needed a few cpp header guards in case it was included from C++ source.
2022-04-25 23:17:45 -07:00
Travis Geiselbrecht
5cbe21919b [fs][fat] add header guard to new iterator code header 2022-04-25 00:38:29 -07:00
Travis Geiselbrecht
e615a80993 [fs][fat] reuse directory iterator logic for files
Use the new helper class to also help reading from files efficiently.
2022-04-25 00:28:09 -07:00
Travis Geiselbrecht
b6b82852a2 [fs][fat][test] add a script to create some test block devices
Create a few file systems for fat 12, 16, and 32.
2022-04-23 00:39:33 -07:00
Travis Geiselbrecht
cad9af3420 [fs][fat] add readdir support 2022-04-23 00:27:31 -07:00
Travis Geiselbrecht
011cc61478 [fs][fat] break the dir entry code into a helper routine
Now extract the code to step one entry into a directory into a separate
routine so it can be reused for search and readdir code.
2022-04-22 23:43:30 -07:00
Travis Geiselbrecht
375f5fbfe3 [fs][fat] revamp the directory walk code
Use a new directory iterator routine that tracks the offset within the
directory and handles transitions between sectors and clusters.
Redo the entry parsing code to make a single pass across the long file
names to handle crossing sector boundaries.
2022-04-22 23:03:14 -07:00
Travis Geiselbrecht
9c1c0c6e3f [fs][fat] add a single mutex around the whole FS 2022-04-22 20:27:23 -07:00
Travis Geiselbrecht
ada94e94c7 [fs][fat] get the scaffolding in place for opendir/readdir/closedir
Currently returns a dir handle that reads nothing.
2022-04-22 20:27:23 -07:00
Travis Geiselbrecht
c997cfbc48 [kernel][mutex] Add a default timeout to the C++ wrapper mutex 2022-04-22 20:27:23 -07:00
Travis Geiselbrecht
1191f3a601 [lib][fat] restructure directory code
Move the directory handling code to dir.cpp
Handle walking the entire directory structure
Make file open be a much simpler function that just calls dir routines

TODO:
properly deal with FAT16 and FAT12 root directories
remove runtime mallocs in dir routines
2022-04-22 00:46:44 -07:00
Travis Geiselbrecht
b300a95ab4 [fs][fat] split the logic into more files, change fat detection logic
Generally split the driver into more files for future expansion.
Follow the FAT spec more closely to determine FAT type.
2022-04-21 23:06:18 -07:00
Travis Geiselbrecht
3229494b3b [fs][fat] rename from fat32 to simply fat
It also handles fat16 and (soon) fat12.
2022-04-21 21:37:34 -07:00
Travis Geiselbrecht
d7ef1985eb [scrtipts][do-qemu] align the arm and x86 script a bit more
Add option to specify disk file to ARM
2022-04-21 21:31:01 -07:00
Travis Geiselbrecht
fe2a370171 [fs][fat] general C++ificatition of the code and a bit of cleanup 2022-04-21 21:31:01 -07:00
Peter Collingbourne
4a15661ee0 [arch][arm64] use SMC when booted at EL2 in QEMU
If we were booted at EL2 (e.g. when passing -machine
virt,virtualization=on), we need to use SMC instead of HVC for PSCI
calls. Change psci_call() to do this and add a flag to do-qemuarm to
allow testing this scenario.
2022-04-19 18:32:12 -07:00
Peter Collingbourne
894a580b5f [top] use incomplete array declarations for constructor symbols
Clang will omit the initial comparison in this while loop on the
assumption that two different variables will not have the same address,
which will lead to a crash if the kernel has no constructors.

It will, however, retain the comparison for incomplete arrays
because they may have zero size (and therefore may alias with another
variable). Therefore, change the declarations of the start/end symbols
for the constructor list to incomplete arrays.
2022-04-19 18:29:02 -07:00
Travis Geiselbrecht
d829ad24ef [fs][fat] fix up the mount and read logic in fat32
Now seems to be capable of mounting a simple fat32 volume and
successfully reading a single file in the root directory that spans a
few 512 byte clusters.
2022-04-19 00:02:23 -07:00
Travis Geiselbrecht
d4969ccb3c [fs][fat32] trivially convert to C++ 2022-04-18 22:24:27 -07:00
Travis Geiselbrecht
fdb027fe7b [lib][bcache] add C++ header guards 2022-04-18 22:24:02 -07:00
Travis Geiselbrecht
c7bef34590 [lib][fs] fix path parsing bug
If two mount points had similar names but one was longer, the path
matching logic would be triggered on the shorter name.

ie, /foo and /foo2 were illegal, since /foo2 path matching would match
against /foo. Tighten the logic a bit to match against the matching
element of the passed in path.

Note: heirarchial path matching still works, so /foo/bar/baz will match
against a mount point at /foo/bar. Debatable if heirarchial mount points
should work at the moment with this simple logic, but it's there for
now.
2022-04-18 21:32:57 -07:00
Travis Geiselbrecht
b88d9e5df5 [lib][fs] add path normalization tests, add few shell commands
Move the test normalization routine into a separate test file.
Add shell commands to list registered file systems and mount points.
2022-04-18 21:04:51 -07:00
Travis Geiselbrecht
8cdd71ab00 [platform][rosco-m68k] default to WITH_LINKER_GC on 2022-04-18 01:15:45 -07:00
Travis Geiselbrecht
479d989185 [make] default WITH_LINKER_GC to false at the place it is used
Also switch the test logic to the TOBOOL macro.
2022-04-18 01:15:45 -07:00
Travis Geiselbrecht
9d1802fa2c [platform][rosco-m68k] change the tick rate to 100Hz
1000kHz is probably a bit much for this board.
2022-04-18 00:48:50 -07:00
Travis Geiselbrecht
54fd2c3e35 [app][mem_test] print the range before starting the test 2022-04-18 00:45:07 -07:00
Travis Geiselbrecht
8028512833 [arch][m68k] add more switches for cpu models 2022-04-12 17:26:33 -07:00
Travis Geiselbrecht
49644a2c39 [platform][rosco-m68k] Add port to the Rosco M68k board
Port to the really neat 68010 based board at https://rosco-m68k.com/

Port Features:
-10Mhz 68010
-1MB ram
-Dual UART + timer implemented as a 68c681 chip
-timer running at 1Khz, UART A for console
-interrupt driven RX support

Some amount of extending of the 68k exceptinon code was needed to
support the autovectored irqs that the 68681 uart uses. Added build
system support for 68010.
2022-04-12 00:25:12 -07:00
Peter Collingbourne
bce9599d80 [arch][arm64] disable EL1 FPU traps even when starting at EL1
It is possible for early initialization functions such as lk_main()
to contain NEON instructions because we don't build the kernel with
-mgeneral-regs-only. As a result we can end up taking an FPU exception
before we are ready to handle it.

We didn't have this problem when starting at a higher exception level
than EL1 because we turned off FPU traps in arm64_elX_to_el1(). But we
neglected to do so when starting at EL1. Fix the problem by moving the
CPACR_EL1 manipulation out of arm64_elX_to_el1() and into arm_reset().
2022-03-30 11:04:11 -07:00
Travis Geiselbrecht
6ad3643165 [lib][minip] add an arg to the ethernet transmit callback
Already had the registration hook for it, but was never used.
2022-03-19 15:06:57 -07:00
Travis Geiselbrecht
fe28bd8a95 [lib][minip] add a mechanism to wait for the stack to be configured
Configured in this case means an ip address assigned and a nic
installed.
2022-03-19 14:46:01 -07:00
Travis Geiselbrecht
9caf62273c [lib][minip] start of TCP connect state machine
A few miscellaneous tweaks outside of that.
2022-03-19 14:43:55 -07:00
Travis Geiselbrecht
dc09bac586 [lib][elf] tweak to a printf to be more useful 2022-03-13 13:49:28 -07:00
Travis Geiselbrecht
ce9f4f6db2 [arch][riscv] using a new trick utilize real instructions to zero fpu state
Previously was hard coding the instructions to work around a limitation
of the assembler that did not allow using fpu instructions when the code
was being compiled without support. Move the zeroing routine into a
separate assembly file and override the architure at the top.
2022-03-12 17:39:00 -08:00
Travis Geiselbrecht
4bd6de50b0 [scripts][do-qemux86] add a few more virtio devices and tweaks 2022-02-27 19:37:48 -08:00
Travis Geiselbrecht
e555db5bda [bus][pci] at least register that MSIX is available
Doesn't yet have support for it, but set the bool and remember it was
present when scanning devices.
2022-02-27 19:36:59 -08:00
Pedro Falcato
a9a631152f [fdtwalk] Fix a bug in #address-cells parsing
Fixes issue #314
2022-02-13 14:00:22 -08:00