Message-Id: <199612032147.QAA27120@delorie.com> From: Kuang-Chun Cheng Subject: boot loader problem, need advise To: djgpp AT delorie DOT com Date: Wed, 4 Dec 96 5:49:27 EAT Mailer: Elm [revision: 70.85] Hi, Recently, I am interesting about boot loader (specially for COFF format file). I got one from Bill Currie which build bootstrap image by using djasm. I also went through the method Linux used which build bootstrap image by as86. Well, I ask myself why not just use GNU as to build bootstrap image? Why use two different assembler?? So I did some tests and I failed while switching to protected mode :( And worst, I don't know why it failed :( First, I add .code16 directive at the beginning of the asm code. If I didn't add .code16, I can't print out string by calling BIOS video services. I want the 512 bytes bootstrap image can switch cpu to pmode before pass control to COFF file (just as Bill's version did). I set up the IDT and GDT (I believe they are setup correctly). The problem show up while executing (I use objcopy -O binary coff_out bin_out to generate image) lidt idt_lable This instruction causes a reboot cycle. That meant when I try to boot from floppy (with the image I wrote), system reboot again when it meet instruction lidt. I did disable interrupt, NMI and try to reset 8259 as Linux kernel did ... No matter how I try, it just doesn't work :( If I comment out lidt and switch to pmode blinding by movw %cr0, %eax orb %al, $0x01 movw %eax, %cr0 # (1) or xorw %ax, %ax inc %ax lmsw %ax # (2) The same problem as lidt appear at (1) and (2). Well, I just can't figure out what's wrong. Could someone explain what's wrong for me? Is it possible to write a bootstrap loader by GNU as? And how ? Thanks a lot Kuang-chun Cheng kccheng AT hep2 DOT phys DOT sinica DOT edu DOT tw