Commit 26cfe46
committed
pvh: Add test for PVH note parsing
Add a test case as part of the load_elf() tests to verify
the functionality that parses the ELF Note header to look
for a PVH entry point address if one is encoded.
This is done by parsing a minimal ELF binary that encodes
a predefined address of 0x1e1fe1f, and verifying that the
same value is read.
The minimal ELF source code (elfnote.S):
#define ELFNOTE_START(name, type, flags) \
.pushsection .note.name, flags,@note ; \
.balign 4 ; \
.long 2f - 1f /* namesz */ ; \
.long 4484f - 3f /* descsz */ ; \
.long type ; \
1:.asciz #name ; \
2:.balign 4 ; \
3:
#define ELFNOTE_END \
4484:.balign 4 ; \
.popsection ;
#define ELFNOTE(name, type, desc) \
ELFNOTE_START(name, type, "a") \
desc ; \
ELFNOTE_END
#define XEN_ELFNOTE_PHYS32_ENTRY 18
ELFNOTE(PVHNote, XEN_ELFNOTE_PHYS32_ENTRY, .quad 0x1e1fe1f)
.section ".text","ax"
.global _start
_start:
Built with:
$ gcc elfnote.S -s -nostdlib -o test_elfnote.bin
Signed-off-by: Alejandro Jimenez <alejandro.j.jimenez@oracle.com>1 parent 6cf33a1 commit 26cfe46
2 files changed
+14
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
544 | 544 | | |
545 | 545 | | |
546 | 546 | | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
547 | 553 | | |
548 | 554 | | |
549 | 555 | | |
| |||
664 | 670 | | |
665 | 671 | | |
666 | 672 | | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
667 | 681 | | |
668 | 682 | | |
669 | 683 | | |
| |||
Binary file not shown.
0 commit comments