How would one get nasm to recognize that this code is 64-bit?
I am trying to compile this OS with nasm on a 64-bit OS X computer. However, the assembler is giving me errors that seem to be coming from the fact that it doesn't realize that this code is 64-bit instead 开发者_JS百科of 32-bit. How can I fix this without modifing the code?
The errors:
$ 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
I think your NASM version is too old. The BareMetal OS installation instructions page says to use the latest release of NASM which is 2.9.10 (now) , and you are using version 0.98.40. Also the NASM manual says:
The NASM 2 series support x86-64, and is the production version of NASM since 2007.
and the BareMetal OS installation manual says:
NASM will compile the Assembly source files into a executable binary file. NASM is also used to compile any applications that are writtin in Assembly. Make sure you are using the latest version of NASM as older versions do not work correctly.
Therefore install the latest version.
http://www.nasm.us/
http://www.nasm.us/doc/nasmdocc.html
精彩评论