stivale: Slight change in how anchors work
This commit is contained in:
parent
591f601299
commit
08423fb646
@ -29,8 +29,9 @@
|
||||
bool stivale_load_by_anchor(void **_anchor, const char *magic,
|
||||
uint8_t *file, uint64_t filesize) {
|
||||
struct stivale_anchor *anchor = NULL;
|
||||
size_t magiclen = strlen(magic);
|
||||
for (size_t i = 0; i < filesize; i += 16) {
|
||||
if (memcmp(file + i, magic, 16) == 0) {
|
||||
if (memcmp(file + i, magic, magiclen) == 0) {
|
||||
anchor = (void *)(file + i);
|
||||
}
|
||||
}
|
||||
@ -91,7 +92,7 @@ void stivale_load(char *config, char *cmdline) {
|
||||
|
||||
if (bits == -1) {
|
||||
struct stivale_anchor *anchor;
|
||||
if (!stivale_load_by_anchor((void **)&anchor, "STIVALE1 ANCHOR", kernel, kernel_file->size)) {
|
||||
if (!stivale_load_by_anchor((void **)&anchor, "STIVALE1 ANCHOR", kernel, kernel_file->size)) {
|
||||
panic("stivale: Not a valid ELF or anchored file.");
|
||||
}
|
||||
|
||||
|
@ -87,7 +87,7 @@ void stivale2_load(char *config, char *cmdline, bool pxe, void *efi_system_table
|
||||
|
||||
if (bits == -1) {
|
||||
struct stivale2_anchor *anchor;
|
||||
if (!stivale_load_by_anchor((void **)&anchor, "STIVALE2 ANCHOR", kernel, kernel_file->size)) {
|
||||
if (!stivale_load_by_anchor((void **)&anchor, "STIVALE2 ANCHOR", kernel, kernel_file->size)) {
|
||||
panic("stivale2: Not a valid ELF or anchored file.");
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user