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.
For LK_DEBUGLEVEL > 1
> alloc_struct_begin_size: 24
> free_heap_chunk_size: 24
size: max(alloc_struct_begin_size, free_heap_chunk_size)
But when freeing the chunk, allocated size is expected to be
greater than size of free_heap_chunk struct.
It contradicts its own code.
So add >= instead of > to maintain the integrity between
allocation and freeing of memory chunk.
Signed-off-by: vivek.j <vivek.j@samsung.com>
GCC 14 is quite picky about warnings, probably more so than clang.
-Fix a bunch of printf warnings. Pointers should be printed with %p.
-Move some stuff into an anonymous namespace.
-Worked around GCC really not liking reinterpret_casting from one
function pointer type to another. Fiddled with it a bit and eventually
settled on casting the function pointer to const void * and passing it
through.
This change updates the `help` console command to list the available
commands alphabetically, but only when we're not panicking. This makes
`help`'s helping more helpful.
This loads all sections specified by PE header at the correct memory
location, and executes the entry point function. Only the
OutputString function of text output protocol is implemented,
so the only application we can run is hello world.
Test: th
Bug: 294283461
Change-Id: I786bc8b7db9e1c0a6019b8fe4ba5a8c8ab4f2936
These headers define the API boundary between UEFI loader and
UEFI applications.
Test: th
Bug: 294283461
Change-Id: Idf064563bb033a8bf2b994261bcd77c0ed7aa2d8
Thids adds a uefi_load <block dev name> command, which will
parse the PE header and do some basic validation checks.
Bug: 294283461
Test: uefi_load virtio0
Change-Id: I97393652526bda5be1b995e59647e239c64d31d6
It's just a test routine that's using floating point, but since nothing
in cmpctmalloc should be used in interrupt context, it should be okay to
mark this code as using float.
- Add the file operations APIs for VirtIO 9p devices, such as file
create/open/close/read/write/stat.
- After this commit, almost complete file operations for v9p file
sharing are supported. An intuitive example is that users can use
filesystem commands, such as `ls`, to examine the shared folder.
Example:
```
# Build the littlekernel with the current directory (the codebase) as
the shared v9p folder
$ scripts/do-qemuarm -f .
...
welcome to lk/MP
boot args 0x0 0x0 0x0 0x0
INIT: cpu 0, calling hook 0x8011fa81 (version) at level 0x3ffff,
flags 0x1
...
# Mount the default VirtIO 9p device `v9p0` as the 9p filesystem onto
# `/v9p` path
] fs mount /v9p 9p v9p0
# List the `/v9p` folder, and we can see the littlekernel codebase
] ls /v9p
D 4096 arch
F 590 lk_inc.mk.example
D 4096 .cache
D 4096 project
D 4096 .github
D 4096 platform
D 4096 kernel
D 4096 external
F 1132 LICENSE
D 4096 target
D 4096 dev
D 4096 .git
F 120 .gitignore
F 12579 engine.mk
F 1388 README.md
D 4096 make
D 4096 top
error -2 opening file '/v9p/..'
D 4096 build-qemu-virt-arm32-test
F 763965 compile_commands.json
D 4096 scripts
D 4096 lib
D 4096 app
D 4096 docs
D 4096 .
D 4096 tools
F 1113 makefile
```
Signed-off-by: Cody Wong <codycswong@google.com>
- Add the directory operations, e.g., open directory, make directory,
read directory, and close directory.
Signed-off-by: Cody Wong <codycswong@google.com>
Add the fundamental filesystem structure to attach a VirtualIO 9p
device. With the implementation of VirtIO 9p devices (lk/dev/virtio/9p),
we can use those APIs to connect to a shared folder as a LK filesystem.
Signed-off-by: Cody Wong <codycswong@google.com>
With this change printf passes the fuchsia unit tests, except the lack
of field with and precision support. Disabled those parts of the test
for now.
Original change at
https://fuchsia.googlesource.com/fuchsia/+/db61af0d1fc27c4c807f5da7d0553a4bb422882b
The old code used to pad the output with zeros before the 0x,
so you would end up with a 0000000x10. This is not the intended
behavior.
Original author: pedro.falcato@gmail.com
The fuchsia printf unit tests are a derivative of the current LK ones in
app/tests, but have been somewhat expanded. Pull in the new copy and add
it to the new libc test module.
No real functional change, just following the pattern of moving unittest
code into a sub module that is picked up by the build system when
WITH_TESTS is set.