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
ee7c05e1
Commit
ee7c05e1
authored
3 years ago
by
Byron Lathi
Browse files
Options
Downloads
Patches
Plain Diff
remove debug statements
parent
d1ea0ba5
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/Filesystem/ext2.c
+2
-0
2 additions, 0 deletions
kernel/Filesystem/ext2.c
kernel/Syscalls/execute.c
+3
-27
3 additions, 27 deletions
kernel/Syscalls/execute.c
with
5 additions
and
27 deletions
kernel/Filesystem/ext2.c
+
2
−
0
View file @
ee7c05e1
...
...
@@ -61,6 +61,8 @@ uint32_t ext2_read_sectors(uint32_t inode_num, uint32_t start, uint32_t count, u
ata_read_sectors
(
ATA_MASTER
,
ext2_base
+
inode
.
block_pointer
[
block
]
*
2
+
i
,
1
,
buf
+
sectors_read
*
256
);
sectors_read
++
;
}
return
0
;
}
uint32_t
ext2_read_data
(
uint32_t
inode_num
,
uint32_t
count
,
uint16_t
*
buf
)
...
...
This diff is collapsed.
Click to expand it.
kernel/Syscalls/execute.c
+
3
−
27
View file @
ee7c05e1
...
...
@@ -87,8 +87,6 @@ int32_t _sys_exec(uint8_t* cmd)
tmpargs
++
;
}
printf
(
"argc: %d
\n
"
,
argc
);
// This will not work for arguments which need spaces
int
i
;
for
(
i
=
0
;
i
<
cmdlen
;
i
++
)
{
...
...
@@ -96,13 +94,6 @@ int32_t _sys_exec(uint8_t* cmd)
cmd
[
i
]
=
NULL
;
}
printf
(
"The first time... "
);
for
(
i
=
0
;
i
<
cmdlen
;
i
++
)
{
printf
(
"%c"
,
cmd
[
i
]);
//cmdcpy[i] = cmd[i];
}
printf
(
"
\n
"
);
uint32_t
parsed_inode
=
ext2_parse_path_to_inode_num
((
int8_t
*
)
name
);
if
(
parsed_inode
==
-
1
)
...
...
@@ -126,8 +117,6 @@ int32_t _sys_exec(uint8_t* cmd)
pcb
->
file_desc_array
[
0
].
file_ops
=
&
stdin_ops
;
pcb
->
file_desc_array
[
1
].
file_ops
=
&
stdout_ops
;
printf
(
"Running a program with pid %d
\n
"
,
pid
);
heap_create
(
pid
);
/* increment pid and run process; decrement it after termination */
...
...
@@ -158,17 +147,8 @@ int32_t _sys_exec(uint8_t* cmd)
}
}
printf
(
"cmdcpy: %s
\n
"
,
cmdcpy
);
for
(
i
=
0
;
i
<
argc
;
i
++
)
{
printf
(
"arg%d: %s
\n
"
,
i
,
argv
[
i
]);
}
elf_header_t
*
e_header
=
(
elf_header_t
*
)
data
.
data8
;
printf
(
"Program header count: %d
\n
"
,
e_header
->
e_phnum
);
printf
(
"Program header size: %x
\n
"
,
e_header
->
e_phentsize
);
printf
(
"Program header offset: %x
\n
"
,
e_header
->
e_phoff
);
program_header_t
*
p_header
[
e_header
->
e_phnum
];
...
...
@@ -180,7 +160,6 @@ int32_t _sys_exec(uint8_t* cmd)
map_large
(
EXEC_BASE_ADDR
,
_8MB
+
pid
*
_4MB
);
//where program will be run
map_large
(
EXEC_TMP_ADDR
,
_8MB
+
(
pid
+
1
)
*
_4MB
);
// program loaded temporarily here, then copied over
ext2_read_data
(
parsed_inode
,
0
,
(
uint16_t
*
)
EXEC_TMP_ADDR
);
printf
(
"Loaded %s into %#x
\n
"
,
name
,
EXEC_TMP_ADDR
);
// what if you...
// read the program header to see how many bytes you needed to allocate and where
...
...
@@ -189,10 +168,7 @@ int32_t _sys_exec(uint8_t* cmd)
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
);
memccpy
((
void
*
)
p_header
[
i
]
->
p_vaddr
,
(
const
void
*
)(
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
;
}
...
...
@@ -233,13 +209,13 @@ int32_t _sys_exec(uint8_t* cmd)
pid
--
;
printf
(
"end of _sys_exec
\n
"
);
//
printf("end of _sys_exec\n");
return
status
;
}
int32_t
_sys_exit
(
uint32_t
status
)
{
printf
(
"_sys_exit
\n
"
);
//
printf("_sys_exit\n");
pcb_t
*
pcb
=
get_pcb_ptr
();
...
...
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