Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
ASA
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
ASA
Commits
06131deb
Commit
06131deb
authored
4 years ago
by
Thierno souleymane Bah
Browse files
Options
Downloads
Patches
Plain Diff
feat(load_mdr function implemented)
parent
3b5fa1b2
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
tpfs/vol.c
+32
-0
32 additions, 0 deletions
tpfs/vol.c
tpfs/vol.h
+2
-0
2 additions, 0 deletions
tpfs/vol.h
with
34 additions
and
0 deletions
tpfs/vol.c
0 → 100644
+
32
−
0
View file @
06131deb
#include
<stdio.h>
#include
<ctype.h>
#include
<assert.h>
#include
"hardware.h"
#include
"drive.h"
#include
"vol.h"
void
load_mbr
()
{
int
i
;
unsigned
char
buffer
[
sizeof
(
mbr_t
)];
read_sector
(
buffer
,
0
,
0
);
mbr
.
magic
=
buffer
[
0
]
+
(
buffer
[
1
]
<<
8
);
if
(
mbr
.
magic
==
MBR_MAGIC
)
{
mbr
.
nb_vols
=
buffer
[
2
];
for
(
i
=
0
;
i
<
mbr
.
nb_vols
;
i
++
)
{
mbr
.
vols
[
i
].
sector
=
buffer
[
3
+
(
i
*
4
)];
mbr
.
vols
[
i
].
cylinder
=
buffer
[
4
+
(
i
*
4
)];
mbr
.
vols
[
i
].
nb_sectors
=
buffer
[
5
+
(
i
*
4
)];
mbr
.
vols
[
i
].
type
=
buffer
[
6
+
(
i
*
4
)];
}
return
;
}
mbr
.
magic
=
MBR_MAGIC
;
mbr
.
nb_vols
=
0
;
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
tpfs/vol.h
+
2
−
0
View file @
06131deb
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
#define VOL_H
#define VOL_H
#define NB_VOLS_MAX 8
#define NB_VOLS_MAX 8
#define MBR_MAGIC 0xCAFE // Savoir si le mbr a déjà été initialisé ou non
static
mbr_t
mbr
;
static
mbr_t
mbr
;
...
@@ -22,6 +23,7 @@ typedef struct vol_s
...
@@ -22,6 +23,7 @@ typedef struct vol_s
typedef
struct
mbr_s
typedef
struct
mbr_s
{
{
unsigned
int
magic
;
unsigned
int
nb_vols
;
// nombre de volumes actuels
unsigned
int
nb_vols
;
// nombre de volumes actuels
vol_t
vols
[
NB_VOLS_MAX
];
vol_t
vols
[
NB_VOLS_MAX
];
}
mbr_t
;
}
mbr_t
;
...
...
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