aboutsummaryrefslogtreecommitdiff
path: root/test/test_initrd.c
Commit message (Collapse)AuthorAgeFilesLines
* Share the same stack everywhereMiquel Sabaté Solà2024-12-021-5/+5
| | | | | | | | | | As documented in the code, we are not implementing any kind of memory protection, so in theory any process (regardless if running in user or kernel space) would be able to tamper with other processes' stack. Hence, don't even pretend that we are separating stacks and share the same global stack everywhere. This simplifies things a bit. Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
* tests: Only test initrd addresses on debugMiquel Sabaté Solà2024-11-251-4/+11
| | | | | | | | | | | | | | | | In initrd tests, and in general, we only need to check that the function did something. As in, that it set the entry addresses somewhere and did not leave them NULL. This is going to be performed from now on on CI and regular tests. And, just if you want to go the extra mile, we will run specific tests that check on memory addresses but that are not guaranteed to work. This is to be replaced in the future by having some proper debugging output. As in, having a message at kernel boot time specifying the addresses being used among other info. This needs a more complex printk utility, of course. Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
* test: Fix test on initrdMiquel Sabaté Solà2024-11-241-6/+9
| | | | | | | | | | | | 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>
* Accept tasks as a parameter on initrd extractionMiquel Sabaté Solà2024-11-241-1/+1
| | | | | | This allows this functionality to be properly extracted for unit tests. Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
* Add basic parsing for underlying ELF executablesMiquel Sabaté Solà2024-11-221-1/+12
| | | | | | | | | | | | | 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>
* Initial parsing of the provided initrd fileMiquel Sabaté Solà2024-11-211-0/+28
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>