I have to solve tasks from pintoS (a OS from stanford).
Here you find the code and the documentation:
http://www.stanford.edu/class/cs140/projects/pintos/
I'm solving Task2, but I have a Problem.
When I try to load a program from userspace, the ELF-Parser failes.
In the userprog/process.c the function load tries to load the ELF File.
After loading, it iterates through the ELF-Sections.
If the Type of a header is PD_LOAD, it checks the header in the function validate_segment ()
The problem now is, that this function failes, because of the check:
if (phdr->p_vaddr < PGSIZE)
return false;
Because p_vaddr is 0 and Pagesize is 4kb.
I just used readelf to read the userspace program (a self-coded echo program):
Code: Select all
Section Headers:
[Nr] Name Type Addr Off Size ES Flg Lk Inf Al
[ 0] NULL 00000000 000000 000000 00 0 0 0
[ 1] .note.gnu.build-i NOTE 00000000 001000 000024 00 A 0 0 4
[ 2] .text PROGBITS 080480e0 0010e0 001caa 00 AX 0 0 16
[ 3] .rodata PROGBITS 08049d8c 002d8c 00024e 00 A 0 0 4
[ 4] .rodata.str1.4 PROGBITS 08049fdc 002fdc 0000e8 01 AMS 0 0 4
[ 5] .rodata.str1.1 PROGBITS 0804a0c4 0030c4 0001d5 01 AMS 0 0 1
...
The problem now is, that Addr is 0 (as you see in the output from readelf).
But I think that pintOS wanted to parse the .text section....
What is the ".note.gnu.build-i" Section?
I'm not really familare with ELF Format, you maybe can help me?
Maybe my compiler added this section, but the compiler from stanford doesn't?
can you give me some hints?
thx guys, best regards,
Juggl3r