Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
summeros
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Byron Lathi
summeros
Commits
e6e6a7ca
Commit
e6e6a7ca
authored
3 years ago
by
Byron Lathi
Browse files
Options
Downloads
Patches
Plain Diff
add program break stuff
parent
0f81e7a0
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
kernel/Syscalls/execute.c
+6
-0
6 additions, 0 deletions
kernel/Syscalls/execute.c
kernel/Syscalls/execute.h
+2
-0
2 additions, 0 deletions
kernel/Syscalls/execute.h
with
8 additions
and
0 deletions
kernel/Syscalls/execute.c
+
6
−
0
View file @
e6e6a7ca
...
...
@@ -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);
...
...
This diff is collapsed.
Click to expand it.
kernel/Syscalls/execute.h
+
2
−
0
View file @
e6e6a7ca
...
...
@@ -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
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment