Skip to content
Snippets Groups Projects
Commit e6e6a7ca authored by Byron Lathi's avatar Byron Lathi
Browse files

add program break stuff

parent 0f81e7a0
No related branches found
No related tags found
No related merge requests found
......@@ -186,13 +186,19 @@ int32_t _sys_exec(uint8_t* cmd)
// read the program header to see how many bytes you needed to allocate and where
// wrote an ext2 read where you could specifiy a starting point in the inode and bytes to read
pcb->program_break = NULL;
for (i = 0; i < e_header->e_phnum; i++) {
printf("Program header %d type %x flags %x", i, p_header[i]->p_type, p_header[i]->p_flags);
printf(" offset %x vaddr %#x paddr %#x size %x\n",
p_header[i]->p_offset, p_header[i]->p_vaddr, p_header[i]->p_paddr, p_header[i]->p_filesz);
memccpy(p_header[i]->p_vaddr, EXEC_TMP_ADDR + p_header[i]->p_offset, p_header[i]->p_memsz);
if (p_header[i]->p_vaddr + p_header[i]->p_memsz > pcb->program_break)
pcb->program_break = p_header[i]->p_vaddr + p_header[i]->p_memsz;
}
pcb->program_size = pcb->program_break;
unmap_large(EXEC_TMP_ADDR);
//ext2_read_sectors(parsed_inode, p_header[1]->p_offset/512, divhi(p_header[1]->p_memsz, 512), p_header[1]->p_vaddr);
......
......@@ -112,6 +112,8 @@ typedef struct pcb {
int32_t parent_pid;
uint32_t parent_esp;
uint32_t parent_ebp;
uint32_t program_size;
uint32_t program_break;
} pcb_t;
int32_t _sys_exec(uint8_t* name);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment