| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
|
|
|
|
| |
This was broken since I first introduced the test on initrd on
40ffc517e20c ("Initial parsing of the provided initrd file") but it
always was as a work in progress test.
Now that the initrd parsing has separation of concerns with the global
'tasks' variable since f4986dab75fa ("Accept tasks as a parameter on
initrd extraction"), we can have a proper test written for this.
Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
|
| |
|
|
|
|
| |
This allows this functionality to be properly extracted for unit tests.
Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
|
| |
|
|
|
|
|
| |
And for the first time I saw this whole thing working with optimizations
on :)
Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
|
| |
|
|
|
|
|
| |
We actually don't need to preserve the initially computed base address
for each binary, but we can just preserve the final entry address.
Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Scheduling is easier if there is an init process which does nothing.
This way we don't have to perform hacks in order to idle in S privilege
mode while touching special registers in weird ways.
For now this process is kind of costly since 'wfi' is not accepted in
this context, but this can be further tuned down in the future by
setting TW=1 on 'mstatus', or by handling the exception and allowing it
if it comes from the proper process.
All of that being said, there is still work to be done as things fail
when optimitzations are on.
Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
|
| |
|
|
|
|
|
|
| |
This allows us to actually catch system calls and start to run user
space programs. That being said, the whole thing is still pretty
brittle, and the scheduler is not quite there yet.
Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
|
| |
|
|
|
|
|
|
|
|
| |
In commit 573a8c6b490a ("usr: Rename foo/bar to fizz/buzz") the path of
the user-space binaries have changed. The `initrd` parsing code makes
some decisions based on that naming, and so it needed to be updated as
well.
Fixes: 573a8c6b490a ("usr: Rename foo/bar to fizz/buzz")
Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
|
| |
|
|
|
|
|
| |
The actual work is done somewhere else, there is no need to constantly
run the main thread.
Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
|
| |
|
|
|
|
|
|
|
|
|
|
| |
When creating the user space binaries I forgot about their proper names,
which is funny on its own. Anyways, let's get them the name they were
intended.
Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
alksjdlkajd
Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
|
| |
|
|
|
|
|
|
| |
A basic interrupt handler has been implemented which tracks the seconds
that have been elapsing along the way. Depending on the value of these
seconds, then a task has to be called.
Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
The given initrd is a CPIO archive of multiple ELF executables. We are
already able to parse the CPIO archive to detect where each file is
located, this commit adds the mapping for each ELF executable to the
corresponding task_struct.
Note that this is still heavily under construction, since we cannot
simply jump into the entry point of an executable as we have not yet
setup the proper layout from performing context switches.
Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
|
| |
|
|
|
|
|
|
|
|
|
|
| |
We expect a CPIO archive with the 'newc' format for the initrd. Parse
this archive from the given initrd address and fetch the address for
each ELF executable while also pairing which task correspond to which
ELF.
This commit leaves to do the actual parsing of the ELF file for each
task, while also leaving some string utilities to be refined.
Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
|
| |
|
|
|
|
|
|
|
| |
The binutils used in Ubuntu 24.04 has a crash when trying to link the
end binary, which is avoided when passing `-fno-PIE`. Since this is a
good idea anyways for the kernel in general, let's pass this flag always
and kill two birds with one stone.
Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
|
| |
|
|
|
|
|
|
|
| |
The dt parsing algorithm assumes that a little-endian system is in place
and hence most numbers on the DTB blob have to be converted from
big-endian to little-endian. I am not planning on changing that any time
soon, so let's add this as a requirement.
Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
|
| |
|
|
| |
Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
|
| |
|
|
|
|
|
|
|
| |
Since the library code can now be exchanged between tests and the actual
kernel, there might be a missmatch when launching QEMU after calling
`make all`. Ensure that this cannot happen by calling `clean` on the
`qemu` target.
Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
|
| |
|
|
|
|
|
|
|
|
| |
The kernel entry has a pointer to the DTB blob as a parameter. From this
pointer we can parse the the DTB blob to find the properties
"chosen->linux,initrd-start" and "chosen->linux,initrd-start". These
properties are guaranteed to have 64-bit addresses which point where the
initrd is in memory, which we need to fetch the binaries to be loaded.
Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
|
| |
|
|
| |
Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Bootstrap an init task which holds at least the initial stack that is to
be used when setting up the registers (such as `sp` and `tp`).
In order to guarantee that the stack and the rest of the registers are
set up correctly, this commit also provides a raw implementation of a
`printk` function.
Moreover, this commit also adds an argument that must be passed to
`start_kernel`, which is the pointer to the embedded `fdt` blob. This
argument will be used by later work so to fetch, at least, the base
address for the initial ram disk. This was also used to test that the
stack was working as expected.
Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
|
| |
|
|
|
|
|
|
|
| |
Fix the following build error on a clean repository:
riscv64-suse-linux-ld: cannot open output file usr/bin/foo: No such file or directory
Fixes: d79436a1170e ("usr: Bootstrap the initramfs for the kernel")
Signed-off-by: Ricardo B. Marliere <rbm@suse.com>
|
| |
|
|
|
|
|
|
|
| |
Introduce a sample `foo` program which already calls the
`write_and_block` system call which is yet to be implemented by this
kernel. Moreover, the same CPIO format is used for the initramfs as with
Linux, so we can pass it with QEMU without worries.
Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
|
| |
|
|
|
|
|
|
|
|
|
| |
Load the debug symbols into the gdb session by simply passing the
executable file into gdb directly. Moreover, allow users of the gdb
target to provide an extra variable so to pass extra flags to gdb.
Moreover, this commit comes with other small cleanups on the Makefile,
like a proper ABI specifier,
Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
|
| |
|
|
|
|
|
| |
This will ensure that the code style is preserved and that commits being
pushed at least build successfully.
Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
|
|
|
For now the base layout has been defined and we have a binary that is
properly reached through openSBI.
Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
|