-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
libvmm: check DTB header when setting up guest images
- Loading branch information
1 parent
8ead87e
commit 771e46c
Showing
2 changed files
with
43 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
* Copyright 2023, UNSW | ||
* | ||
* SPDX-License-Identifier: BSD-2-Clause | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include <stdint.h> | ||
|
||
/* | ||
* The following value and header definition are from v0.3, Section 5.2 of the | ||
* Devicetree Specification. | ||
*/ | ||
|
||
/* Note that this is the little-endian representation, the specification | ||
* mentions only the big-endian representation. */ | ||
#define DTB_MAGIC 0xEDFE0DD0 | ||
|
||
struct dtb_header { | ||
uint32_t magic; | ||
uint32_t totalsize; | ||
uint32_t off_dt_struct; | ||
uint32_t off_dt_strings; | ||
uint32_t off_mem_rsvmap; | ||
uint32_t version; | ||
uint32_t last_comp_version; | ||
uint32_t boot_cpuid_phys; | ||
uint32_t size_dt_strings; | ||
uint32_t size_dt_struct; | ||
}; | ||
|
||
bool dtb_check_magic(struct dtb_header *h) { | ||
return h->magic == DTB_MAGIC; | ||
} |