Skip to content

Commit a3f58a2

Browse files
committed
Move emu/memory.[ch] to kernel/
A long time ago, for linux, emu and kernel were separated into separate library targets, but for some reason memory.c was kept in emu/ despite only being linked into kernel. Now's a good time to move it where it belongs.
1 parent fd6b6ea commit a3f58a2

File tree

14 files changed

+13
-17
lines changed

14 files changed

+13
-17
lines changed

asbestos/asbestos.c

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
#include "asbestos/gen.h"
55
#include "asbestos/frame.h"
66
#include "emu/cpu.h"
7-
#include "emu/memory.h"
87
#include "emu/interrupt.h"
98
#include "util/list.h"
109

emu/mmu.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ typedef dword_t page_t;
1616
typedef dword_t pages_t;
1717
// bytes MUST be unsigned if you would like this to overflow to zero
1818
#define PAGE_ROUND_UP(bytes) (PAGE((bytes) + PAGE_SIZE - 1))
19+
#define MEM_PAGES (1 << 20) // at least on 32-bit
1920
#endif
2021

2122
struct mmu {
@@ -37,4 +38,4 @@ static inline void *mmu_translate(struct mmu *mmu, addr_t addr, int type) {
3738
return mmu->ops->translate(mmu, addr, type);
3839
}
3940

40-
#endif
41+
#endif

fs/fd.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#ifndef FD_H
22
#define FD_H
33
#include <dirent.h>
4-
#include "emu/memory.h"
4+
#include "kernel/memory.h"
55
#include "util/list.h"
66
#include "util/sync.h"
77
#include "util/bits.h"

fs/proc/pid.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#include <string.h>
22
#include <sys/stat.h>
3-
#include "emu/memory.h"
3+
#include "kernel/memory.h"
44
#include "kernel/calls.h"
55
#include "fs/proc.h"
66
#include "fs/fd.h"

kernel/calls.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#include "debug.h"
33
#include "kernel/calls.h"
44
#include "emu/interrupt.h"
5-
#include "emu/memory.h"
5+
#include "kernel/memory.h"
66
#include "kernel/signal.h"
77
#include "kernel/task.h"
88

kernel/fs.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#include "fs/dev.h"
88
#include "fs/fake-db.h"
99
#include "fs/fix_path.h"
10-
#include "emu/memory.h"
10+
#include "kernel/memory.h"
1111
#include <dirent.h>
1212
#include <sqlite3.h>
1313

emu/memory.c kernel/memory.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#include "debug.h"
1111
#include "kernel/errno.h"
1212
#include "kernel/signal.h"
13-
#include "emu/memory.h"
13+
#include "kernel/memory.h"
1414
#include "asbestos/asbestos.h"
1515
#include "kernel/vdso.h"
1616
#include "kernel/task.h"

emu/memory.h kernel/memory.h

-3
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,15 @@
88
#include "util/list.h"
99
#include "util/sync.h"
1010
#include "misc.h"
11-
struct asbestos;
1211

1312
struct mem {
1413
struct pt_entry **pgdir;
1514
int pgdir_used;
1615

17-
struct asbestos *asbestos;
1816
struct mmu mmu;
1917

2018
wrlock_t lock;
2119
};
22-
#define MEM_PAGES (1 << 20) // at least on 32-bit
2320
#define MEM_PGDIR_SIZE (1 << 10)
2421

2522
// Initialize the address space

kernel/mm.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#ifndef KERNEL_MM_H
22
#define KERNEL_MM_H
33

4-
#include "emu/memory.h"
4+
#include "kernel/memory.h"
55
#include "misc.h"
66

77
// uses mem.lock instead of having a lock of its own

kernel/mmap.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#include "kernel/errno.h"
55
#include "kernel/task.h"
66
#include "fs/fd.h"
7-
#include "emu/memory.h"
7+
#include "kernel/memory.h"
88
#include "kernel/mm.h"
99

1010
struct mm *mm_new() {

kernel/task.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#include <string.h>
55
#include "kernel/calls.h"
66
#include "kernel/task.h"
7-
#include "emu/memory.h"
7+
#include "kernel/memory.h"
88
#include "emu/tlb.h"
99

1010
__thread struct task *current;

meson.build

+1-2
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ if get_option('kernel') == 'ish'
8383
'kernel/errno.c',
8484

8585
'kernel/calls.c',
86+
'kernel/memory.c',
8687
'kernel/user.c',
8788
'kernel/vdso.c', vdso,
8889
'kernel/task.c',
@@ -148,8 +149,6 @@ if get_option('kernel') == 'ish'
148149
'util/fifo.c',
149150
'util/fchdir.c',
150151

151-
'emu/memory.c',
152-
153152
'platform/' + host_machine.system() + '.c',
154153
]
155154

tools/ptraceomatic.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#include <sys/wait.h>
1212
#include <sys/ptrace.h>
1313
#include <sys/user.h>
14-
#undef PAGE_SIZE // defined in sys/user.h, but we want the version from emu/memory.h
14+
#undef PAGE_SIZE // defined in sys/user.h, but we want the version from kernel/memory.h
1515
#include <sys/personality.h>
1616
#include <sys/socket.h>
1717

tools/ptutil.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
#include <sys/prctl.h>
1313
#include <sys/syscall.h>
1414
#include <asm/prctl.h>
15-
#undef PAGE_SIZE // want definition from emu/memory.h
15+
#undef PAGE_SIZE // want definition from kernel/memory.h
1616
#include "../misc.h"
1717

1818
long trycall(long res, const char *msg) {

0 commit comments

Comments
 (0)