forked from yhzhang0128/egos-2000
-
Notifications
You must be signed in to change notification settings - Fork 0
/
egos.h
47 lines (37 loc) · 1.26 KB
/
egos.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#pragma once
/* SiFive FE310 has a 65MHz clock */
#define CPU_CLOCK_RATE 65000000
struct earth {
/* CPU interface */
int (*intr_enable)();
int (*intr_disable)();
int (*intr_register)(void (*handler)(int));
int (*excp_register)(void (*handler)(int));
int (*mmu_alloc)(int* frame_no, int* cached_addr);
int (*mmu_free)(int pid);
int (*mmu_map)(int pid, int page_no, int frame_no);
int (*mmu_switch)(int pid);
/* Disk and tty device driver interface */
int (*disk_read)(int block_no, int nblocks, char* dst);
int (*disk_write)(int block_no, int nblocks, char* src);
int (*tty_intr)();
int (*tty_read)(char* buf, int len);
int (*tty_write)(const char *format, ...);
int (*tty_info)(const char *format, ...);
int (*tty_fatal)(const char *format, ...);
int (*tty_success)(const char *format, ...);
int (*tty_highlight)(const char *format, ...);
};
struct grass {
int (*proc_alloc)();
void (*proc_free)(int);
void (*proc_set_ready)(int);
int work_dir_ino;
char work_dir_name[32];
};
extern struct earth *earth;
#define INFO earth->tty_info
#define FATAL earth->tty_fatal
#define SUCCESS earth->tty_success
#define HIGHLIGHT earth->tty_highlight
#define printf earth->tty_write