Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
octopOS
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
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
Code review analytics
Issue analytics
Insights
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
weip00
octopOS
Commits
69108852
Commit
69108852
authored
3 years ago
by
Paul Weiß (Poohl)
Browse files
Options
Downloads
Patches
Plain Diff
u7 docu
parent
ea06554e
Branches
main
Tags
u7
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
boards/portux/drivers/mmu.c
+7
-7
7 additions, 7 deletions
boards/portux/drivers/mmu.c
boards/portux/startup.c
+0
-1
0 additions, 1 deletion
boards/portux/startup.c
kernel/process_mgmt.c
+10
-3
10 additions, 3 deletions
kernel/process_mgmt.c
with
17 additions
and
11 deletions
boards/portux/drivers/mmu.c
+
7
−
7
View file @
69108852
...
...
@@ -36,6 +36,7 @@ void release_addsp_slot(addsp_queue* q, int slt) {
q
->
available
++
;
}
// this is needed by the process mgmt, but we can't turn on the mmu before process mgmt
void
init_mmu_mgmt
()
{
init_addsp_queue
(
&
addsp_q
);
}
...
...
@@ -63,17 +64,16 @@ void init_first_level_pagetable(uint address_space_id) {
address_spaces
[
address_space_id
].
desc
[
i
]
=
(
AP_NONE_NONE
<<
10
)
|
0
b10
;
for
(
uint
i
=
(
UNDEF_MEMORY2
>>
20
);
i
<
249
;
++
i
)
address_spaces
[
address_space_id
].
desc
[
i
]
=
(
AP_NONE_NONE
<<
10
)
|
0
b10
;
// make user
land
acessible by users
// make user
code
acessible by users
uint
userland_desc
=
EXTERNAL_SRAM
>>
20
;
address_spaces
[
address_space_id
].
desc
[
userland_desc
]
=
(
userland_desc
<<
20
)
|
(
AP_RW_R
<<
10
)
|
0
b10
;
/*for (uint i = 0; i < 63; ++i) {
address_spaces[address_space_id].desc[userland_desc + 1 + i] |= (AP_RW_RW << 10);
}*/
// modify the mapping to switch 1MB of sram with 1MB of undef memory
//address_spaces[address_space_id].desc[(EXTERNAL_SRAM + 17*MEGABYTE) >> 20] = (UNDEF_MEMORY1) | (AP_RW_RW << 10) | 0b10;
//address_spaces[address_space_id].desc[(UNDEF_MEMORY1) >> 20] = (EXTERNAL_SRAM + 17*MEGABYTE) | (AP_RW_RW << 10) | 0b10;
}
/**
* Grants access to a section of memory of size size located at dest in physical address space
* and mapped at address in logical address space address_space_id.
*/
int
set_ap
(
uint
address_space_id
,
void
*
address
,
uint
size
,
void
*
dest
,
uint
ap
)
{
if
(
size
!=
MEGABYTE
)
return
-
1
;
...
...
This diff is collapsed.
Click to expand it.
boards/portux/startup.c
+
0
−
1
View file @
69108852
...
...
@@ -78,7 +78,6 @@ void c_entry(void) {
demo_t
.
start
=
&
u7_demo
;
new_thread
(
"demo"
,
&
demo_t
);
/* interrupt tst loop*/
while
(
42
)
{
asm
volatile
(
"nop"
:::
);
...
...
This diff is collapsed.
Click to expand it.
kernel/process_mgmt.c
+
10
−
3
View file @
69108852
...
...
@@ -67,8 +67,11 @@ void idle() {
}
void
exit
(
u32
*
hw_context
)
{
// Don't call tis directly frem kernel... Why would you?
// if (current.open_handles == 0)
// Don't call this directly from kernel... Why would you?
// we can only release a process if it has no children,
// as it might be owner of the address space.
// we can only release the address_space if we're actually its owner.
if
(
processes
[
current
].
children
>
0
)
{
processes
[
current
].
state
=
ZOMBIE
;
}
else
{
...
...
@@ -137,7 +140,9 @@ int new_thread(char* name, init_thread_state_args* args) {
return
internal_new_thread_finalizer
(
name
,
id
);
}
// this one is not yet updated for the children + address-space thing.
int
new_thread_raw
(
char
*
name
,
cpu_context
*
init_state
,
bool
may_be_sys
)
{
return
-
1
;
if
(
!
cpu_context_validate
(
init_state
,
may_be_sys
))
return
-
2
;
int
id
=
get_tcb_slot
(
&
tcbq
);
if
(
id
<
0
)
return
-
1
;
...
...
@@ -158,12 +163,14 @@ void thread_swap_callback(u32* context) {
break
;
// get your chainsaw and your shotgun cause we're going on a zombie-hunt
// we haven't upgraded to the recursive shotgun yet.
if
(
processes
[
next
].
state
==
ZOMBIE
&&
processes
[
next
].
children
==
0
)
{
release_tcb_slot
(
&
tcbq
,
processes
[
next
].
id
);
release_address_space
(
processes
[
next
].
address_space
);
processes
[
next
].
state
=
DEAD
;
if
(
processes
[
next
].
parent
)
processes
[
processes
[
next
].
parent
].
children
-=
1
;
else
release_address_space
(
processes
[
next
].
address_space
);
printf
(
"BOOM! -> %x
\n
"
,
processes
[
next
].
id
);
}
}
...
...
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