Skip to content

Commit

Permalink
Update by Nov.3rd
Browse files Browse the repository at this point in the history
Update basic skeleton of mipsivm.
  • Loading branch information
yat17006 committed Nov 3, 2019
1 parent d1ab85d commit 6b20460
Show file tree
Hide file tree
Showing 8 changed files with 548 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
*.ko
*.obj
*.elf
*.cod

# Linker output
*.ilk
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ Each PDE is an 8-byte entry. There are 512 PDEs. For each entry, there are 64 bi
Each PTE is an 8-byte entry. There are 512 PTEs. For each entry, there are 64 bits. The higher 52 bits indicates the HVA of page base. The lower 12 bits indicates the property of PTE, including the access control.

### Glossary of Memory Virtualization
The glossary will be listed as a markdown list as followings
| Acronyms | Abbreviated for | Explanation |
| --------- | ------------------------------------- | ------------------------------------------------- |
| GPA | Guest Physical Address | Address that referenced in simulated MIPS VM |
Expand Down
22 changes: 22 additions & 0 deletions compchk_win7x64.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
@echo off
set ddkpath=C:\WinDDK\7600.16385.1\bin\x86
set incpath=C:\WinDDK\7600.16385.1\inc
set libpath=C:\WinDDK\7600.16385.1\lib
set binpath=.\bin\compchk_win7x64
set objpath=.\bin\compchk_win7x64\Intermediate

title Compiling mipsivm, Checked Build, 64-Bit Windows (AMD64 Architecture)
echo Project: mipsivm
echo Platform: 64-Bit Windows
echo Preset: Debug/Checked Build
pause

echo ============Start Compiling============
%ddkpath%\amd64\cl.exe .\src\entry.c /I"%incpath%\api" /I"%incpath%\crt" /I".\src\include" /Zi /nologo /W3 /WX /Od /D"_msvc" /D"_amd64" /Zc:wchar_t /Zc:forScope /FAcs /Fa"%objpath%\entry.cod" /Fo"%objpath%\entry.obj" /Fd"%objpath%\vc90.pdb" /GS- /Gd /TC /c /errorReport:queue

%ddkpath%\amd64\cl.exe .\src\vcpu.c /I".\src\include" /Zi /nologo /W3 /WX /Oi /Od /D"_msvc" /D"_amd64" /Zc:wchar_t /Zc:forScope /FAcs /Fa"%objpath%\vcpu.cod" /Fo"%objpath%\vcpu.obj" /Fd"%objpath%\vc90.pdb" /GS- /Gd /TC /c /errorReport:queue

echo ============Start Linking============
%ddkpath%\amd64\link.exe "%objpath%\vcpu.obj" "%objpath%\entry.obj" /LIBPATH:"%libpath%\win7\amd64" /LIBPATH:"%libpath%\Crt\amd64" /NODEFAULTLIB "msvcrt.lib" /NOLOGO /DEBUG /PDB:"%objpath%\mipsivm.pdb" /INCREMENTAL:NO /OUT:"%binpath%\mipsivm.exe" /SUBSYSTEM:CONSOLE /ENTRY:"main" /Machine:X64 /ERRORREPORT:QUEUE

pause
22 changes: 22 additions & 0 deletions src/entry.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
mipsivm - MIPS Interpreting Virtual Machine
Copyright 2018-2019, Yaotian "Zero" Tang. All rights reserved.
This file is the entry module of mipsivm program.
This program is distributed in the hope that it will be useful, but
without any warranty (no matter implied warranty or merchantability
or fitness for a particular purpose, etc.).
File Location: /include/entry.c
*/

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

void main()
{
printf("Welcome to mipsivm!\n");
}
79 changes: 79 additions & 0 deletions src/include/midef.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
/*
mipsivm - MIPS Interpreting Virtual Machine
Copyright 2018-2019, Yaotian "Zero" Tang. All rights reserved.
This file defines basic types, constants, etc.
This program is distributed in the hope that it will be useful, but
without any warranty (no matter implied warranty or merchantability
or fitness for a particular purpose, etc.).
File Location: /include/midef.h
*/

#if defined(_msvc)
#pragma once

typedef unsigned __int8 u8;
typedef unsigned __int16 u16;
typedef unsigned __int32 u32;
typedef unsigned __int64 u64;

typedef signed __int8 i8;
typedef signed __int16 i16;
typedef signed __int32 i32;
typedef signed __int64 i64;
#endif

#if defined(_amd64)
typedef u64 ulong_ptr;
typedef i64 long_ptr;
#else
typedef u32 ulong_ptr;
typedef i32 long_ptr;
#endif

typedef union _large_integer
{
struct
{
u32 lo;
u32 hi;
};
u64 value;
}large_integer,*large_integer_p;

typedef volatile u8 u8v;
typedef volatile u16 u16v;
typedef volatile u32 u32v;
typedef volatile u64 u64v;

typedef volatile i8 i8v;
typedef volatile i16 i16v;
typedef volatile i32 i32v;
typedef volatile i64 i64v;

typedef volatile ulong_ptr vulong_ptr;
typedef volatile long_ptr vlong_ptr;

#if defined(_msvc)
typedef enum
{
false=0,
true=1
}bool;

#define cdecl __cdecl
#define stdcall __stdcall
#define fastcall __fastcall

#define inline __inline
#define always_inline __forceinline
#endif

#define null (void*)0
#define maxu8 0xff
#define maxu16 0xffff
#define maxu32 0xffffffff
#define maxu64 0xffffffffffffffff
Loading

0 comments on commit 6b20460

Please sign in to comment.