Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
Ordonnancement
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
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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ASE-2021
Ordonnancement
Commits
3119a62e
Commit
3119a62e
authored
4 years ago
by
Thierno souleymane Bah
Browse files
Options
Downloads
Patches
Plain Diff
feat(ppage_of_vpage and mmu_handler functions done)
parent
c115b086
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
process.c
+40
-0
40 additions, 0 deletions
process.c
process.h
+34
-0
34 additions, 0 deletions
process.h
with
74 additions
and
0 deletions
process.c
0 → 100644
+
40
−
0
View file @
3119a62e
#include
<stdlib.h>
#include
<stdio.h>
#include
"hardware.h"
#include
"process.h"
int
current_process
=
NULL
;
int
ppage_of_vpage
(
int
process
,
unsigned
vpage
)
{
if
(
vpage
<
N
)
{
if
(
process
==
PROCESS_0
)
return
2
*
vpage
+
2
;
if
(
process
==
PROCESS_1
)
return
2
*
vpage
+
1
;
}
return
-
1
;
}
void
mmu_handler
()
{
tlb_entry_t
tlb
;
unsigned
int
vaddr
=
((
long
int
)
_in
(
MMU_FAULT_ADDR_HI
)
<<
32
)
|
(
_in
(
MMU_FAULT_ADDR_LO
)
&
0xFFFFFFFF
);
unsigned
int
vpage
=
(
vaddr
>>
12
)
&
0xFFF
;
unsigned
int
ppage
=
ppage_of_vpage
(
current_process
,
vpage
);
if
(
vaddr
<
virtual_memory
||
vaddr
>
virtual_memory
+
VM_SIZE
||
vpage
==
-
1
)
{
fprintf
(
stderr
,
"Echec"
);
exit
(
EXIT_FAILURE
);
}
tlb
.
s
.
tlb_vpage
=
vpage
;
tlb
.
s
.
tlb_ppage
=
ppage
;
tlb
.
s
.
tlb_rwx
=
7
;
tlb
.
s
.
tlb_used
=
1
;
_out
(
TLB_ADD_ENTRY
,
tlb
.
i
);
}
This diff is collapsed.
Click to expand it.
process.h
0 → 100644
+
34
−
0
View file @
3119a62e
#if !defined(PROCESS)
#define PROCESS
#define PROCESS_1 1
#define PROCESS_0 0
#define N 127
#define VM_SIZE 160000 * 8
#define MMU_FAULT_ADDR_LO 0xCC
#define MMU_FAULT_ADDR_HI 0xCD
#define TLB_ADD_ENTRY 0xCE
struct
tlb_entry_s
{
unsigned
tlb_RFU
:
8
;
unsigned
tlb_vpage
:
12
;
unsigned
tlb_ppage
:
8
;
unsigned
tlb_rwx
:
3
;
unsigned
tlb_used
:
1
;
};
union
tlb_entry_u
{
int
i
;
struct
tlb_entry_s
s
;
};
typedef
union
tlb_entry_u
tlb_entry_t
;
int
ppage_of_vpage
(
int
process
,
unsigned
vpage
);
void
mmu_handler
();
#endif // PROCESS
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