Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/kernel/loaders/elf.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,11 @@ bool parse_section_header(Elf64_Ehdr *elf_start, uint64_t size, executable_loade
*/
uint64_t elf_flags_to_memory_flags(Elf64_Word flags) {
// This function will be movede into the arch dependant code
// Elf flags:
// 1 = Read
// 2 = Write
// 4 = Execute
// They can be mixed.
// Conversion
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The table (I think lol) in my original comment was referring to the elf flags for the memory segments, that differ from the VM ones (that are the paging flags).

| PF_X | 0x1 | Execute |
| PF_W | 0x2 | Write |
| PF_R | 0x4 | Read |

So apparently even my comment was wrong XD (i don't even remember if there was something else too in the mappings code). Anyway i notice a typo on the line above , can you fix that too?

// ELF | VMM
// 0x0 | Executable
// 0x1 | Write
// 0x2 | Read
uint64_t flags_to_return = (flags & 0b10);
return flags_to_return;
}