incomplete refactor

This commit is contained in:
Yanyan Jiang 2017-04-19 22:55:19 +08:00
parent 48812662f0
commit a6de532260
6 changed files with 31 additions and 36 deletions

7
AM/arch/mips32-npc/README.md Executable file
View File

@ -0,0 +1,7 @@
# MIPS32-NPC
AbstractMachine implementation for NJU-Personal-Computer (NPC).
## Memory Mappings
XXX - XXX: XXX

View File

@ -1,6 +1,9 @@
#ifndef __ARCH_LIB__
#define __ARCH_LIB__
// These should not appear in the arch.h
// See AM spec for more details.
#define VMEM ((char *)0xc0000000)
#define KEY_CODE_ADDR ((volatile unsigned int *)0xf0000000)
#define KEY_CODE (*KEY_CODE_ADDR)

View File

@ -4,41 +4,20 @@
* `_Area`代表一段连续的内存。
* ```
typedef struct _Area {
void *start, *end;
} _Area;
```
* `_Screen`描述系统初始化后的屏幕后续可通过PCI总线设置显示控制器则此设置不再有效
* ```
typedef struct _Screen {
int width, height;
} _Screen;
```
* 屏幕的像素颜色由32位整数`typedef u32 _Pixel;`确定从高位到低位是00rrggbb红绿蓝各8位。
* 按键代码由如下enum指定
* 按键代码由`_KEY_XXX`指定,其中`_KEY_NONE = 0`。
* ```
enum {
_KEY_NONE = 0,
_KEY_UP, _KEY_DOWN, _KEY_LEFT, _KEY_RIGHT, ...
};
```
* `_Protect`描述一个被保护的地址空间(`_area`),以及一个体系结构相关的指针(`ptr`)a。
* `_Protect`描述一个被保护的地址空间:
## `arch.h`
* ```
typedef struct _Protect {
_Area area;
void *ptr;
} _Protect;
```
描述体系结构相关的信息,包括:
* 整数类型`i8`, `u8`, `i16`, `u16`, `i32`, `u32`, `size_t`, `off_t`的定义。
* `typedef struct _RegSet {}`代表所有体系结构寄存器。
## Turing Machine

12
klib/klib.h Executable file
View File

@ -0,0 +1,12 @@
// TODO: merge declarations into a single header.
// TODO: klib should be compiled into one binary.
#ifndef __KLIB_H__
#define __KLIB_H__
// We're expecting:
// assert, printf, sprintf
// memcpy, memset, strcpy, strlen, itoa, atoi, ...
// kalloc, kree
#endif

View File

@ -1,6 +1,8 @@
#ifndef __TYPES_H__
#define __TYPES_H__
// TODO: this is NOT expected to appear here.
// types are arch-dependent.
typedef unsigned int uint32_t;
typedef int int32_t;

View File

@ -1,8 +0,0 @@
#include <stdio.h>
int main(){
printf("now your are in user space!\n");
printf("hello world!\n");
while(1);
return 0;
}