Linux汇编写引导扇区

2014-11-24 13:53:45 · 作者: · 浏览: 3

最近再看《Orange‘s一个操作系统的实现》,里面用的是intel的汇编语法,自己比较习惯AT&T的语法了,自己研究了好长时间才将代码修改成功。


.code16指示as生成16位的代码。While `as' normally writes only "pure" 32-bit i386 code or 64-bit x86-64 code depending on the default configuration, it also supports writing code to run in real mode or in 16-bit protected mode code segment.


编译的话 as -o boot.o boot.s ;


ld -Ttext=0x7c00 --oformat binary -o boot.bin boot.o;


这样就ok了~~