亚洲av成人无遮挡网站在线观看,少妇性bbb搡bbb爽爽爽,亚洲av日韩精品久久久久久,兔费看少妇性l交大片免费,无码少妇一区二区三区

  免費注冊 查看新帖 |

Chinaunix

  平臺 論壇 博客 文庫
最近訪問板塊 發(fā)新帖
查看: 24606990 | 回復: 24606990
打印 上一主題 下一主題

我也來發(fā)一款自己寫的x86虛擬機(NXVM),能在win 7,linux和surface rt(ARM)下跑MS [復制鏈接]

論壇徽章:
0
跳轉(zhuǎn)到指定樓層
1 [收藏(0)] [報告]
發(fā)表于 2013-10-11 11:09 |只看該作者 |倒序瀏覽
本帖最后由 ylide 于 2014-05-10 00:20 編輯

發(fā)一款自己花了5個月時間編寫的386虛擬機 NXVM。

這個虛擬機是用C編寫的,一共40,000行代碼,
它完整的模擬了一臺PC,包括一個80386 CPU,以及所有必要的設(shè)備,
因此它可以運行一個基于x86的操作系統(tǒng),如MS-DOS6.22,并支持32位尋址。

這個虛擬機還額外附加了16位調(diào)試器(用法和DOS的debug.exe一樣)和32位調(diào)試器,以及一個匯編器和反匯編器,可以調(diào)試操作系統(tǒng)。

NXVM虛擬機可以同時在Windows和Linux下通過編譯。在Windows下,它可以運行在命令提示符窗口中(將Win32控制臺作為虛擬機顯示器和鍵盤),也可以創(chuàng)建自己的窗口(模擬DOS下的點陣字體)。在Linux下,它能在80x25尺寸的終端窗口中正常運行。

寫這個虛擬機的過程中也參考過easyVM和LightMachine,發(fā)現(xiàn)和修正了它們的一些bug,并用Bochs的CPU來跟蹤對比調(diào)試我的虛擬80386。

我還寫了一份文檔,詳細描述了使用方法并做了源代碼分析,感興趣的人可以直接理解相關(guān)邏輯。

【下載】

源代碼和簡介在GITHUB: http://github.com/cshaxu/nxvm/

磁盤鏡像和設(shè)計文檔:http://sdrv.ms/17XmGWa

【編譯】
1. 在Linux下編譯:
./configure 生成Makefile
make 生成可執(zhí)行文件./nxvm

2. 在Windows下編譯:在VS2008、VS2010或VS2012中,創(chuàng)建空的Win32控制臺項目,

把src文件夾下面的所有文件加入項目,然后排除掉src/platform/linux/下的代碼。

編譯x64 Release即可.

【截圖】
在 Surface RT 8.0下跑MS-DOS:


在64位Windows的命令提示符窗口中運行DOS:


在Linux終端里跑MS-DOS:



DOS運行在HMA:



TT打字程序:


俄羅斯方塊:



Windows窗口模式下的點陣字體模擬:

論壇徽章:
1
綜合交流區(qū)版塊每日發(fā)帖之星
日期:2015-10-14 06:20:00
2 [報告]
發(fā)表于 2013-10-13 12:13 |只看該作者
編程功力很強,不過程序?qū)嵱眯运坪醪惶蟆?nbsp; :wink:

論壇徽章:
1
綜合交流區(qū)版塊每日發(fā)帖之星
日期:2015-10-14 06:20:00
3 [報告]
發(fā)表于 2013-10-14 08:15 |只看該作者
回復 1# ylide

-bash-4.1$ make
gcc -c -g -O console.c
gcc -c -g -O main.c
gcc -c -g -O vmachine/vapi.c
gcc -c -g -O vmachine/vcmos.c
gcc -c -g -O vmachine/vcpu.c
gcc -c -g -O vmachine/vcpuins.c
gcc -c -g -O vmachine/vdma.c
gcc -c -g -O vmachine/vfdc.c
gcc -c -g -O vmachine/vfdd.c
gcc -c -g -O vmachine/vhdd.c
gcc -c -g -O vmachine/vkbc.c
gcc -c -g -O vmachine/vmachine.c
gcc -c -g -O vmachine/vpic.c
gcc -c -g -O vmachine/vpit.c
gcc -c -g -O vmachine/vport.c
gcc -c -g -O vmachine/vram.c
gcc -c -g -O vmachine/vvadp.c
gcc -c -g -O vmachine/system/linux.c -lpthread -lncurses
vmachine/system/linux.c:3:20: error: curses.h: No such file or directory
vmachine/system/linux.c: In function ‘linuxDisplayInit’:
vmachine/system/linux.c:32: error: ‘stdscr’ undeclared (first use in this function)
vmachine/system/linux.c:32: error: (Each undeclared identifier is reported only once
vmachine/system/linux.c:32: error: for each function it appears in.)
vmachine/system/linux.c:32: error: ‘TRUE’ undeclared (first use in this function)
vmachine/system/linux.c: In function ‘linuxDisplayFinal’:
vmachine/system/linux.c:45: error: ‘stdscr’ undeclared (first use in this function)
vmachine/system/linux.c:45: error: ‘FALSE’ undeclared (first use in this function)
vmachine/system/linux.c: In function ‘ReverseColor’:
vmachine/system/linux.c:58: error: ‘COLOR_BLACK’ undeclared (first use in this function)
vmachine/system/linux.c:58: error: ‘COLOR_WHITE’ undeclared (first use in this function)
vmachine/system/linux.c:59: error: ‘COLOR_BLUE’ undeclared (first use in this function)
vmachine/system/linux.c:59: error: ‘COLOR_YELLOW’ undeclared (first use in this function)
vmachine/system/linux.c:60: error: ‘COLOR_GREEN’ undeclared (first use in this function)
vmachine/system/linux.c:60: error: ‘COLOR_RED’ undeclared (first use in this function)
vmachine/system/linux.c:61: error: ‘COLOR_CYAN’ undeclared (first use in this function)
vmachine/system/linux.c:61: error: ‘COLOR_MAGENTA’ undeclared (first use in this function)
vmachine/system/linux.c: In function ‘CharProp2Color’:
vmachine/system/linux.c:80: error: ‘COLOR_BLACK’ undeclared (first use in this function)
vmachine/system/linux.c:81: error: ‘COLOR_BLUE’ undeclared (first use in this function)
vmachine/system/linux.c:82: error: ‘COLOR_GREEN’ undeclared (first use in this function)
vmachine/system/linux.c:83: error: ‘COLOR_CYAN’ undeclared (first use in this function)
vmachine/system/linux.c:84: error: ‘COLOR_RED’ undeclared (first use in this function)
vmachine/system/linux.c:85: error: ‘COLOR_MAGENTA’ undeclared (first use in this function)
vmachine/system/linux.c:86: error: ‘COLOR_YELLOW’ undeclared (first use in this function)
vmachine/system/linux.c:87: error: ‘COLOR_WHITE’ undeclared (first use in this function)
vmachine/system/linux.c: In function ‘linuxDisplayPaint’:
vmachine/system/linux.c:179: error: ‘COLS’ undeclared (first use in this function)
vmachine/system/linux.c:180: error: ‘LINES’ undeclared (first use in this function)
vmachine/system/linux.c: In function ‘linuxKeyboardMakeKey’:
vmachine/system/linux.c:311: error: ‘ERR’ undeclared (first use in this function)
vmachine/system/linux.c:327: error: ‘KEY_F0’ undeclared (first use in this function)
vmachine/system/linux.c:336: error: ‘KEY_DOWN’ undeclared (first use in this function)
vmachine/system/linux.c:338: error: ‘KEY_UP’ undeclared (first use in this function)
vmachine/system/linux.c:340: error: ‘KEY_LEFT’ undeclared (first use in this function)
vmachine/system/linux.c:342: error: ‘KEY_RIGHT’ undeclared (first use in this function)
vmachine/system/linux.c:344: error: ‘KEY_HOME’ undeclared (first use in this function)
vmachine/system/linux.c:346: error: ‘KEY_BACKSPACE’ undeclared (first use in this function)
vmachine/system/linux.c:348: error: ‘KEY_ENTER’ undeclared (first use in this function)
vmachine/system/linux.c:350: error: ‘KEY_NPAGE’ undeclared (first use in this function)
vmachine/system/linux.c:352: error: ‘KEY_PPAGE’ undeclared (first use in this function)
vmachine/system/linux.c:354: error: ‘KEY_END’ undeclared (first use in this function)
vmachine/system/linux.c: In function ‘linuxKeyboardProcess’:
vmachine/system/linux.c:368: error: ‘ERR’ undeclared (first use in this function)
make: *** [linux.o] Error 1

這個應(yīng)該怎么弄呢?

論壇徽章:
1
IT運維版塊每日發(fā)帖之星
日期:2015-12-20 06:20:00
4 [報告]
發(fā)表于 2013-10-14 11:37 |只看該作者
能說一下大體的架構(gòu)嗎?

論壇徽章:
4
天秤座
日期:2013-10-18 13:58:33金牛座
日期:2013-11-28 16:17:01辰龍
日期:2014-01-14 09:54:32戌狗
日期:2014-01-24 09:23:27
5 [報告]
發(fā)表于 2013-10-14 11:45 |只看該作者
專程來拜樓主的。

論壇徽章:
0
6 [報告]
發(fā)表于 2013-10-18 09:36 |只看該作者
我畢業(yè)設(shè)計差點就是選擇的做一個x86虛擬機,以后我也想做一個出來玩玩,樓主好厲害,贊一個.....

論壇徽章:
1
綜合交流區(qū)版塊每日發(fā)帖之星
日期:2015-10-14 06:20:00
7 [報告]
發(fā)表于 2013-10-18 15:47 |只看該作者
表瞎拜了!  

程序錯誤一大堆...  也不知道是怎么樓主怎么編譯運行通過的 ,  估計還有部分沒有 commit .

論壇徽章:
0
8 [報告]
發(fā)表于 2013-10-20 12:14 |只看該作者
本帖最后由 ylide 于 2013-10-20 12:27 編輯

回復 7# fly3ds

所有代碼都已經(jīng)commit了的,至少在Windows下用VS編譯肯定是可以的。
主貼更新了編譯方法,謝謝~~

論壇徽章:
0
9
發(fā)表于 2013-10-20 12:16
回復 3# fly3ds


   在linux下編譯要先安裝ncurses庫

論壇徽章:
0
10 [報告]
發(fā)表于 2013-10-20 12:19 |只看該作者
回復 4# goingstudy

可以參考設(shè)計文檔,在http://sdrv.ms/17XmGWa下載
您需要登錄后才可以回帖 登錄 | 注冊

本版積分規(guī)則 發(fā)表回復

  

北京盛拓優(yōu)訊信息技術(shù)有限公司. 版權(quán)所有 京ICP備16024965號-6 北京市公安局海淀分局網(wǎng)監(jiān)中心備案編號:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年舉報專區(qū)
中國互聯(lián)網(wǎng)協(xié)會會員  聯(lián)系我們:huangweiwei@itpub.net
感謝所有關(guān)心和支持過ChinaUnix的朋友們 轉(zhuǎn)載本站內(nèi)容請注明原作者名及出處

清除 Cookies - ChinaUnix - Archiver - WAP - TOP