Commit 7a3b22b
committed
pvh: Add tests for PVH note parsing
Add test cases to verify the functionality that parses
the ELF Note header to look for a PVH entry point address
if one is encoded.
Parse a minimal ELF binary that encodes a predefined address
of 0x1e1fe1f, and verify that the same value is read. Also
test the case in which a note header is present but no PVH
entry point is encoded, as well as a case where the PVH entry
address is encoded in the note header using a field of
incorrect size.
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
#define NT_VERSION 1
ELFNOTE(dummy, NT_VERSION, .quad 0xcafecafe)
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
The elfnote.S source above is modified to generate the binaries
for the rest of the test cases.
Signed-off-by: Alejandro Jimenez <alejandro.j.jimenez@oracle.com>1 parent e4fdfa5 commit 7a3b22b
File tree
6 files changed
+56
-2
lines changed- src/loader
6 files changed
+56
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
556 | 556 | | |
557 | 557 | | |
558 | 558 | | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
559 | 577 | | |
560 | 578 | | |
561 | 579 | | |
| |||
678 | 696 | | |
679 | 697 | | |
680 | 698 | | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
681 | 735 | | |
682 | 736 | | |
683 | 737 | | |
| |||
Binary file not shown.
Binary file not shown.
Binary file not shown.
0 commit comments