Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
SteveOS
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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Stephen D
SteveOS
Commits
5246f7c5
Commit
5246f7c5
authored
6 years ago
by
Stephen D
Browse files
Options
Downloads
Patches
Plain Diff
Very, very simple malloc
parent
9eb90fd0
Branches
master
Branches containing commit
No related tags found
No related merge requests found
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
kernel/kernel.c
+1
-4
1 addition, 4 deletions
kernel/kernel.c
libc/mem.c
+18
-2
18 additions, 2 deletions
libc/mem.c
libc/mem.h
+1
-0
1 addition, 0 deletions
libc/mem.h
util/commands.c
+7
-1
7 additions, 1 deletion
util/commands.c
util/commands.h
+1
-0
1 addition, 0 deletions
util/commands.h
with
28 additions
and
7 deletions
kernel/kernel.c
+
1
−
4
View file @
5246f7c5
...
...
@@ -50,10 +50,7 @@ void main() {
register_commands
();
/*char buffer[0x4800];
strcpy(buffer, "writing this to the floppy drive");
floppy_write_track(4, buffer);
println(buffer);*/
disk_cmd_init
();
while
(
1
)
{
...
...
This diff is collapsed.
Click to expand it.
libc/mem.c
+
18
−
2
View file @
5246f7c5
#include
"mem.h"
void
memory_copy
(
u8
*
source
,
u8
*
dest
,
int
nbytes
)
{
void
memory_copy
(
u8
*
source
,
u8
*
dest
,
int
nbytes
)
{
int
i
;
for
(
i
=
0
;
i
<
nbytes
;
i
++
)
{
*
(
dest
+
i
)
=
*
(
source
+
i
);
}
}
void
memory_set
(
u8
*
dest
,
u8
val
,
u32
len
)
{
void
memory_set
(
u8
*
dest
,
u8
val
,
u32
len
)
{
u8
*
temp
=
(
u8
*
)
dest
;
for
(
;
len
!=
0
;
len
--
)
*
temp
++
=
val
;
}
//TODO:
//free()
//alignment
const
u32
start_addr
=
0x100000
;
u32
cur_addr
=
start_addr
;
const
u32
end_addr
=
0x10000000
;
u32
malloc
(
u32
len
)
{
u32
addr
=
cur_addr
;
cur_addr
+=
len
;
return
addr
;
}
This diff is collapsed.
Click to expand it.
libc/mem.h
+
1
−
0
View file @
5246f7c5
...
...
@@ -5,5 +5,6 @@
void
memory_copy
(
u8
*
source
,
u8
*
dest
,
int
nbytes
);
void
memory_set
(
u8
*
dest
,
u8
val
,
u32
len
);
u32
malloc
(
u32
len
);
#endif
This diff is collapsed.
Click to expand it.
util/commands.c
+
7
−
1
View file @
5246f7c5
...
...
@@ -5,6 +5,7 @@
#include
"../libc/string.h"
#include
"../programs/texteditor.h"
#include
"../drivers/floppy.h"
#include
"../libc/mem.h"
void
help
(
char
*
args
)
{
...
...
@@ -101,7 +102,12 @@ void video_debug(char *args)
}
}*/
char
buffer
[
0x4800
];
char
*
buffer
;
void
disk_cmd_init
()
{
buffer
=
(
char
*
)
malloc
(
0x4800
);
}
void
read_callback
(
int
p
)
{
...
...
This diff is collapsed.
Click to expand it.
util/commands.h
+
1
−
0
View file @
5246f7c5
#ifndef commands
#define commands
void
register_commands
();
void
disk_cmd_init
();
#endif
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