Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
yhzhang0128 committed Apr 11, 2022
1 parent bc31b35 commit 041fa90
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
8 changes: 4 additions & 4 deletions grass/scheduler.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,11 @@ static void proc_send(struct syscall *sc) {
} else {
/* Copy message from sender to kernel stack */
struct sys_msg tmp;
memcpy(&tmp, &sc->msg, SYSCALL_MSG_LEN);
memcpy(&tmp, &sc->msg, sizeof(tmp));

/* Copy message from kernel stack to receiver */
earth->mmu_switch(receiver);
memcpy(&sc->msg, &tmp, SYSCALL_MSG_LEN);
memcpy(&sc->msg, &tmp, sizeof(tmp));
earth->mmu_switch(curr_pid);

/* Set receiver process as runnable */
Expand All @@ -170,11 +170,11 @@ static void proc_recv(struct syscall *sc) {
/* Copy message from sender to kernel stack */
struct sys_msg tmp;
earth->mmu_switch(sender);
memcpy(&tmp, &sc->msg, SYSCALL_MSG_LEN);
memcpy(&tmp, &sc->msg, sizeof(tmp));

/* Copy message from kernel stack to receiver */
earth->mmu_switch(curr_pid);
memcpy(&sc->msg, &tmp, SYSCALL_MSG_LEN);
memcpy(&sc->msg, &tmp, sizeof(tmp));

/* Set sender process as runnable */
proc_set_runnable(sender);
Expand Down
6 changes: 2 additions & 4 deletions library/egos.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
#pragma once

#define ENV_DIR_LEN 32
#define PAGE_SIZE 4096
#define SYSCALL_MSG_LEN 1024

struct earth {
/* CPU interface */
int (*intr_enable)();
Expand All @@ -30,6 +26,7 @@ struct earth {
int (*tty_critical)(const char *format, ...);
};

#define ENV_DIR_LEN 32
struct grass {
/* Process control interface */
int (*proc_alloc)();
Expand All @@ -56,6 +53,7 @@ extern struct grass *grass;
#define CRITICAL earth->tty_critical

/* memory layout */
#define PAGE_SIZE 4096
#define FRAME_CACHE_END 0x80020000
#define FRAME_CACHE_START 0x80004000 /* 112KB frame cache */
/* earth interface */
Expand Down
1 change: 1 addition & 0 deletions library/servers/servers.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#pragma once

#include "block_store.h"
#define SYSCALL_MSG_LEN 1024

void exit(int status);
int dir_lookup(int dir_ino, char* name);
Expand Down

0 comments on commit 041fa90

Please sign in to comment.