-1

I am developing an operating system. As from the references, I have to enter to 32 bit protected mode from 16 bit real mode. In the step, its use an instruction as:

bits 32

But my assembler says that is illegal it also use instruction like:

org 0x7c00

some tutorials use [bits 32]. But I use both, but no luck.

I googled this, but this time it messed up

So any guiding would be helpful.

Thanks

huzeyfe
  • 3,554
  • 6
  • 39
  • 49
MaheshMV
  • 11
  • 4
  • `bits 32` (or equivalent) changes the encoding of instructions done by the assembler. It doesn't "do" anything and it's not an instruction. It's not part of switching to 32 bit mode (though it's useful for generating the 32bit code). Anyway it sounds like you just have to use a different assembler. – harold Dec 23 '15 at 11:36
  • Would you please give us some information about what compiler are you using, and/or what syntax are you using to write your code to enter protected mode? – ilpelle Dec 23 '15 at 11:55

1 Answers1

4

You have to tell the CPU that you want to enter the protected mode. Better you start here http://wiki.osdev.org/Babystep1 and look around on this website. Short: Do some real-mode stuff with something like use16 or bits 16 at the beginning, load a valid value into the gdt-register with lgdt [6byteGDTstruct], set bit 0 in CR0-register, jump far somewhere in your code and use use32 or bits 32 from there.

sivizius
  • 450
  • 2
  • 14