-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fetch the initrd address from the DTB blob
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à <[email protected]>
- Loading branch information
Showing
14 changed files
with
285 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,24 @@ | ||
#ifndef __FBOS_PRINTK_H_ | ||
#define __FBOS_PRINTK_H_ | ||
|
||
/* | ||
* This file might be pulled from user space tests. Hence, define alternatives | ||
* for this functions from glibc. | ||
*/ | ||
|
||
#ifdef __KERNEL__ | ||
extern void die(const char *const message); | ||
extern void printk(const char *const message); | ||
#else | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
|
||
#define die(x) \ | ||
do { \ | ||
printf(x); \ | ||
exit(1); \ | ||
} while (0) | ||
#define printk(x) printf(x) | ||
#endif /* __KERNEL */ | ||
|
||
#endif // __FBOS_PRINTK_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* | ||
* Defined in include/fbos/string.h | ||
* | ||
* size_t strlen(const char *str) | ||
* | ||
* Returns (a0): string length. | ||
* Parameter (a0): string to measure. | ||
* Clobbers: t0, t1. | ||
*/ | ||
.globl strlen | ||
.type strlen, @function | ||
strlen: | ||
mv t1, a0 | ||
1: | ||
lbu t0, 0(t1) | ||
beqz t0, 2f | ||
addi t1, t1, 1 | ||
j 1b | ||
2: | ||
sub a0, t1, a0 | ||
ret | ||
|
||
/* | ||
* Defined in include/fbos/string.h | ||
* | ||
* int strcmp(const char *s1, const char *s2) | ||
* | ||
* Returns (a0): comparison result as in stdlib. | ||
* Parameter (a0, a1): strings to compare. | ||
* Clobbers: t0, t1. | ||
*/ | ||
.globl strcmp | ||
.type strcmp, @function | ||
strcmp: | ||
1: | ||
lbu t0, 0(a0) | ||
lbu t1, 0(a1) | ||
bne t0, t1, 2f | ||
addi a0, a0, 1 | ||
addi a1, a1, 1 | ||
bnez t0, 1b | ||
li a0, 0 | ||
ret | ||
2: | ||
sub a0, t0, t1 | ||
ret |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.