Working on bochs but not on real PC

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
User avatar
AlfaOmega08
Member
Member
Posts: 226
Joined: Wed Nov 07, 2007 12:15 pm
Location: Italy

Post by AlfaOmega08 »

OK. I've decided to use GRUB... So much simple :)

Can anyone tell me how to install grub on a FAT12 1.44M FD?
StephanvanSchaik
Member
Member
Posts: 127
Joined: Sat Sep 29, 2007 5:43 pm
Location: Amsterdam, The Netherlands

Post by StephanvanSchaik »

How to use GRUB

Edit:

Enabling the A20 line

I have the feeling that you wanted to load the kernel at the 1MB barrier. This is possible but you need to set up the GDT correctly and enable the A20 line before loading the kernel. If you have loaded the kernel then you need to enter protected mode and then you can execute the kernel if it is flat binary.
User avatar
AlfaOmega08
Member
Member
Posts: 226
Joined: Wed Nov 07, 2007 12:15 pm
Location: Italy

Post by AlfaOmega08 »

Yes, I tried to load and jump to the kernel after the 1st MB. But I've enable A20 before to load the kernel.

When I've changed the A20 code for keyboard with the one for the port 0x92, VPC enter in an infinite loop after the A20 enabling, without any error message. Bha...

Thanks for the guide
User avatar
Masterkiller
Member
Member
Posts: 153
Joined: Sat May 05, 2007 6:20 pm

Post by Masterkiller »

AlfaOmega08 wrote:When I've changed the A20 code for keyboard with the one for the port 0x92, VPC enter in an infinite loop after the A20 enabling, without any error message. Bha...
Yes, that is possible, because System control port also contains a reset bit and sometimes on reading it mistaken read to '1' (which should reset CPU). Well, I don't remember well everything that I read, but port 0x92 is used to enable A20 in some version of linux, so I think it can be trusted :)

Here some example code:

Code: Select all

EnableA20:
PUSH ax
CLI
IN al, 0x92
TEST al, 02h
JNZ ea20_Success
OR al, 02h
AND al, 0xFE
OUT 0x92, al
IN al, 0x92
TEST al, 02h
JNZ ea20_Success
JMP ea20_Fail
ea20_Success: ;say 'A20 enabled' and return
ea20_Fail: ;blah, try some other way :(
It is more simple than keyboard controller :)
User avatar
AlfaOmega08
Member
Member
Posts: 226
Joined: Wed Nov 07, 2007 12:15 pm
Location: Italy

Post by AlfaOmega08 »

I'll try in another moment. Now I've solved using Bochs. Anytime I'll write a module to enable and disable A20 like linux does.

Thanks for the code you posted
User avatar
AlfaOmega08
Member
Member
Posts: 226
Joined: Wed Nov 07, 2007 12:15 pm
Location: Italy

Post by AlfaOmega08 »

I can't believe it!!!

My os works fine with bochs
But I have wanted to retry with my bootloader

When starting on VMWare, it exits, with a message of stack fault...

After lots of hours, with a huge number of stack faults...

I've found the solution in the Bran's Kernel Dev Tutorial!!!

Just putting the:

Code: Select all

MOV ESP, _sys_stack
before the call to the main function, in the start.asm file, i've solved the problem.

Now the kernel works on VPC2007 too!!! :twisted: :twisted: :twisted:

I hope this can help some other one with my same problem.

Thanks everyone.
Bye
Post Reply