2011-09-03 51 views
0

我試圖編譯this OS有64位OS X計算機上NASM。但是,彙編是給我的,似乎是從事實來,它並沒有意識到,這個代碼是64位,而不是32位的錯誤。我怎樣才能解決這個問題,而不修改代碼?如何讓nasm認識到這個代碼是64位的?

的錯誤:

$ nasm kernel64.asm -o kernel64.sys 
init_64.asm:153: error: symbol `lodsq' redefined 
init_net.asm:38: error: symbol `stosq' redefined 
init_net.asm:40: error: symbol `stosq' redefined 
init_net.asm:42: error: symbol `stosq' redefined 
init_net.asm:49: error: symbol `stosq' redefined 
init_net.asm:51: error: symbol `stosq' redefined 
init_net.asm:53: error: symbol `stosq' redefined 
syscalls/string.asm:363: error: parser: instruction expected 
syscalls/screen.asm:264: error: symbol `jrcxz' redefined 
syscalls/screen.asm:264: error: parser: instruction expected 
syscalls/debug.asm:23: error: symbol `pushfq' redefined 
syscalls/misc.asm:119: error: symbol `jrcxz' redefined 
syscalls/misc.asm:119: error: parser: instruction expected 
syscalls/misc.asm:126: error: symbol `jrcxz' redefined 
syscalls/misc.asm:126: error: parser: instruction expected 
syscalls/misc.asm:132: error: symbol `jrcxz' redefined 
syscalls/misc.asm:132: error: parser: instruction expected 
syscalls/misc.asm:326: warning: numeric constant 0x23D8AD1401DE7383 does not fit in 32 bits 
syscalls/smp.asm:121: error: symbol `stosq' redefined 
syscalls/smp.asm:123: error: symbol `stosq' redefined 
syscalls/smp.asm:179: error: symbol `lodsq' redefined 
syscalls/smp.asm:181: error: symbol `lodsq' redefined 
drivers/net/rtl8169.asm:219: error: symbol `stosq' redefined 
drivers/net/i8254x.asm:195: error: symbol `stosq' redefined 
drivers/net/i8254x.asm:200: error: symbol `stosq' redefined 
interrupt.asm:102: error: symbol `iretq' redefined 
interrupt.asm:116: error: symbol `iretq' redefined 
interrupt.asm:166: error: symbol `iretq' redefined 
interrupt.asm:239: error: symbol `iretq' redefined 
interrupt.asm:307: error: symbol `iretq' redefined 
interrupt.asm:322: error: symbol `iretq' redefined 
interrupt.asm:537: error: symbol `lodsq' redefined 
cli.asm:22: error: symbol `jrcxz' redefined 
cli.asm:22: error: parser: instruction expected 
cli.asm:26: error: symbol `jrcxz' redefined 
cli.asm:26: error: parser: instruction expected 
+0

什麼是錯誤 – phoxis

+0

什麼是你'nasm'版本? – phoxis

+0

@phoxis:'NASM版本0.98.40' – Adrian

回答

1

我想你的NASM版本太舊。該BareMetal OS安裝說明頁說,使用NASM的最新版本是2.9.10(現在的),並且您正在使用的版本0.98.40。另外,NASM手冊說:

NASM的2系列支持x86-64的,並且是自2007年以來

NASM的生產版本和BareMetal OS installation manual說:

NASM會將彙編源文件編譯爲可執行的二進制文件。 NASM也用於編譯Assembly中的任何應用程序。確保您使用的是最新版本的NASM,因爲舊版本無法正常工作。

因此安裝最新版本。

http://www.nasm.us/

http://www.nasm.us/doc/nasmdocc.html

+0

我怎麼會覆蓋一個已經在我的電腦上的版本? – Adrian

+0

不同的問題。我從來沒有使用OSX,只有贏和* nix。從nasm下載源代碼並編譯並安裝(使用提供的腳本)。結帳:http://www.neuraladvance.com/2009/08/19/compiling-and-installing-nasm-on-mac-os-x/ – phoxis

+1

確定。它的工作,謝謝。 – Adrian