Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
yhzhang0128 committed Apr 5, 2022
1 parent 04bed67 commit a23c2ab
Show file tree
Hide file tree
Showing 12 changed files with 33 additions and 38 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ DEBUG_DIR = build/debug
RELEASE_DIR = build/release

INCLUDE = -Ilibrary
INCLUDE += -Ilibrary/elf -Ilibrary/memory -Ilibrary/file -Ilibrary/syscall
INCLUDE += -Ilibrary/elf -Ilibrary/malloc -Ilibrary/file -Ilibrary/syscall
CFLAGS = -march=rv32imac -mabi=ilp32 -mcmodel=medlow
CFLAGS += -ffunction-sections -fdata-sections

Expand Down
2 changes: 1 addition & 1 deletion apps/app.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma once

#include "egos.h"
#include "memory.h"
#include "malloc.h"
#include "syscall.h"
#include "servers.h"

Expand Down
3 changes: 3 additions & 0 deletions earth/cpu_mmu.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
#include "earth.h"
#include <stdlib.h>

#define NFRAMES 256
#define CACHED_NFRAMES 28 /* 32 - 4 */

/* definitions for translation table */
struct translation_table_t {
struct {
Expand Down
1 change: 0 additions & 1 deletion earth/earth.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
#include "egos.h"
#include "elf.h"
#include "disk.h"
#include "memory.h"
#include <string.h>

void tty_init();
Expand Down
1 change: 0 additions & 1 deletion grass/grass.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

#include "elf.h"
#include "disk.h"
#include "memory.h"
#include "syscall.h"
#include "servers.h"

Expand Down
18 changes: 18 additions & 0 deletions library/egos.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,24 @@ struct grass {
char work_dir_name[32];
};

#define PAGE_SIZE 4096

/* memory layout */
#define FRAME_CACHE_END 0x80020000
#define FRAME_CACHE_START 0x80004000 /* 112KB frame cache */
/* earth interface */
#define GRASS_STACK_TOP 0x80003f80 /* ~8KB grass stack */
/* grass interface */
#define APPS_STACK_TOP 0x80002000 /* ~6KB app stack */
#define SYSCALL_ARG 0x80000400 /* ~1KB syscall args */
#define APPS_ARG 0x80000000 /* ~1KB argc, argv */

#define APPS_SIZE 0x00003000
#define APPS_ENTRY 0x08005000 /* 12KB app code+data */
#define GRASS_SIZE 0x00002000
#define GRASS_ENTRY 0x08003000 /* 8KB grass code+data */
/* 12KB earth data+stack */
/* earth code is in QSPI flash */
extern struct earth *earth;

#define printf earth->tty_printf
Expand Down
1 change: 0 additions & 1 deletion library/elf/elf.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#include "egos.h"
#include "elf.h"
#include "disk.h"
#include "memory.h"
#include "servers.h"

#include <string.h>
Expand Down
2 changes: 1 addition & 1 deletion library/file/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
#define INFO printf
#else
#include "egos.h"
#include "memory.h"
#include "malloc.h"
#endif

/* Temporary information about the file system and a particular inode.
Expand Down
1 change: 0 additions & 1 deletion library/memory/malloc.c → library/malloc/malloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
*/

#include "egos.h"
#include "memory.h"

/* heap region is defined in the memory layout scripts */
extern char __heap_start, __heap_end;
Expand Down
9 changes: 9 additions & 0 deletions library/malloc/malloc.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#pragma once

#undef malloc
#define malloc my_alloc
void* my_alloc(unsigned int size);

#undef free
#define free my_free
void my_free(void* ptr);
30 changes: 0 additions & 30 deletions library/memory/memory.h

This file was deleted.

1 change: 0 additions & 1 deletion library/syscall/syscall.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
*/

#include "egos.h"
#include "memory.h"
#include "syscall.h"
#include "servers.h"

Expand Down

0 comments on commit a23c2ab

Please sign in to comment.