aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarvin Borner2020-08-23 12:19:20 +0200
committerMarvin Borner2020-08-23 12:19:20 +0200
commitb1faf9042c5104d7dafc7d880817def934086ddb (patch)
tree4abe87a6d83aaad17eebd291f2fe046e6a1324a6
parentb667ea0fbd26af222f828199e7b9a7e62ad98081 (diff)
How did this work before?!
I used r->eax instead of r->ebx in malloc :O
-rw-r--r--apps/test.c1
-rw-r--r--kernel/features/fs.c4
-rw-r--r--kernel/features/load.c2
-rw-r--r--kernel/features/proc.c2
-rw-r--r--kernel/features/syscall.c2
5 files changed, 5 insertions, 6 deletions
diff --git a/apps/test.c b/apps/test.c
index b511ab3..dd85ffd 100644
--- a/apps/test.c
+++ b/apps/test.c
@@ -5,7 +5,6 @@
int main()
{
print("[test loaded]\n");
- printf("TIME: %d\n", time());
/* struct window *win = gui_new_window(); */
msg_send(1, MSG_NEW_WINDOW, NULL);
diff --git a/kernel/features/fs.c b/kernel/features/fs.c
index c328f04..f23ccc0 100644
--- a/kernel/features/fs.c
+++ b/kernel/features/fs.c
@@ -70,7 +70,7 @@ void *read_inode(struct inode *in)
int indirect;
- int blocknum = 0;
+ int blocknum;
char *data;
for (int i = 0; i < num_blocks; i++) {
if (i < 12) {
@@ -168,7 +168,7 @@ void ls_root()
struct dirent *d = (struct dirent *)buf;
int sum = 0;
- int calc = 0;
+ int calc;
printf("\nRoot directory:\n");
do {
calc = (sizeof(struct dirent) + d->name_len + 4) & ~0x3;
diff --git a/kernel/features/load.c b/kernel/features/load.c
index 8aa28b8..d5dd839 100644
--- a/kernel/features/load.c
+++ b/kernel/features/load.c
@@ -52,7 +52,7 @@ void elf_load(char *path, struct proc *proc)
if (phdr->type != PT_LOAD)
continue;
memcpy((void *)phdr->vaddr, h + phdr->offset, phdr->filesz);
- memset((void *)(phdr->vaddr + phdr->filesz), phdr->memsz - phdr->filesz, 0);
+ memset((void *)(phdr->vaddr + phdr->filesz), 0, phdr->memsz - phdr->filesz);
}
u32 stack = (u32)malloc(0x1000) + 0x1000;
diff --git a/kernel/features/proc.c b/kernel/features/proc.c
index 1c0b443..ac62195 100644
--- a/kernel/features/proc.c
+++ b/kernel/features/proc.c
@@ -43,7 +43,7 @@ void scheduler(struct regs *regs)
current = proc_list->head;
while (!current) {
- if (!current || !current->next || !current->next->data) {
+ if (!current->next || !current->next->data) {
assert(proc_list->head);
current = proc_list->head;
} else {
diff --git a/kernel/features/syscall.c b/kernel/features/syscall.c
index 2a310ef..4197985 100644
--- a/kernel/features/syscall.c
+++ b/kernel/features/syscall.c
@@ -28,7 +28,7 @@ void syscall_handler(struct regs *r)
}
case SYS_MALLOC: {
printf("malloc\n");
- r->eax = (u32)malloc(r->eax);
+ r->eax = (u32)malloc(r->ebx);
break;
}
case SYS_FREE: {