OSDev.org
https://forum.osdev.org/

My OS does not boot in real hardware
https://forum.osdev.org/viewtopic.php?f=1&t=33514
Page 2 of 4

Author:  MichaelPetch [ Sun Feb 17, 2019 3:09 pm ]
Post subject:  Re: My OS does not boot in real hardware

Are you ABSOLUTELY sure? If you right mouse click the Command program and Run as Administrator the title at the top the command window should say "Administrator: Command Prompt" . If not in Administrator mode it only shows "Command Prompt" in the title bar. What does yours say?

Author:  deleted8917 [ Sun Feb 17, 2019 3:42 pm ]
Post subject:  Re: My OS does not boot in real hardware

MichaelPetch wrote:
Are you ABSOLUTELY sure? If you right mouse click the Command program and Run as Administrator the title at the top the command window should say "Administrator: Command Prompt" . If not in Administrator mode it only shows "Command Prompt" in the title bar. What does yours say?

Yes. Evidence:
Image

Author:  MichaelPetch [ Sun Feb 17, 2019 3:58 pm ]
Post subject:  Re: My OS does not boot in real hardware

I had to ask given that I have been down this road with others and then days or weeks later I discover it wasn't the case. Thanks.

Author:  MichaelPetch [ Sun Feb 17, 2019 4:05 pm ]
Post subject:  Re: My OS does not boot in real hardware

Can you try what is in this SuperUser answer (I had to do this previously as well): https://superuser.com/a/1226550

Where it says "select volume #" # is replaced by the value of the volume associated with the USB entry in the list.

Author:  deleted8917 [ Sun Feb 17, 2019 4:06 pm ]
Post subject:  Re: My OS does not boot in real hardware

I flashed my OS on the pen drive using win32disk, and well, it starts, jumps to protected mode, but I get an exception.
General fault exception. That means that the bootloader jumped to protected mode, and my IDT works.
Well, what now?
EDIT: My OS seems to be very unstable, now it triple faults again.

Author:  MichaelPetch [ Sun Feb 17, 2019 4:25 pm ]
Post subject:  Re: My OS does not boot in real hardware

Well now the fun part I guess ;-). It is time you might consider altering your fault_handler. I'd start by printing out eip and cs to determine what the instruction the instruction pointer was pointing at that caused the fault. You can use the output of objdump (with -D option) on your ELF file to try and match the EIP with an instruction. That might help you narrow down the problem to a particular function.

Other ways of going about this would be trim back your kernel code and see if removing something makes the issue disappear.

Author:  deleted8917 [ Sun Feb 17, 2019 4:27 pm ]
Post subject:  Re: My OS does not boot in real hardware

MichaelPetch wrote:
Well now the fun part I guess ;-). It is time you might consider altering your fault_handler. I'd start by printing out eip and cs to determine what the instruction the instruction pointer was pointing at that caused the fault. You can use the output of objdump (with -D option) on your ELF file to try and match the EIP with an instruction. That might help you narrow down the problem to a particular function.

Other ways of going about this would be trim back your kernel code and see if removing something makes the issue disappear.

I will modify the fault handler.
In the meantime, here's my source code (again) GryphusOS
Well, as I said is triple faulting again.

Author:  MichaelPetch [ Sun Feb 17, 2019 4:44 pm ]
Post subject:  Re: My OS does not boot in real hardware

Triple faulting where. Before entering protected mode or after? Remember I don't have your system so I don't know so it is very hard to tell. I'd start by simplifying `kernelmain` . Start with something that doesn't do anything but print to the screen (write something to the display at address 0xb8000. Don't use any specialized functions. If that triple faults and causes a reboot then there is likely something before kernelmain is called that is causing the problem. If that works consistently then you can look at adding your other code back into `kernelmain`.

Author:  deleted8917 [ Sun Feb 17, 2019 4:47 pm ]
Post subject:  Re: My OS does not boot in real hardware

MichaelPetch wrote:
Triple faulting where. Before entering protected mode or after? Remember I don't have your system so I don't know so it is very hard to tell. I'd start by simplifying `kernelmain` . Start with something that doesn't do anything but print to the screen (write something to the display at address 0xb8000. Don't use any specialized functions. If that triple faults and causes a reboot then there is likely something before kernelmain is called that is causing the problem. If that works consistently then you can look at adding your other code back into `kernelmain`.

I think that it triple faults in real mode, because the "loading" string does not prints.

Author:  MichaelPetch [ Sun Feb 17, 2019 5:15 pm ]
Post subject:  Re: My OS does not boot in real hardware

When you say triple faulting does the computer continually reboot? Anyway, it really sounds like to me that writing to the USB hasn't occurred properly. After you write the file with win32disk do you take the USB stick out and move it to another machine? If you do, do you do a safe windows eject before you remove the USB stick? Information on doing that is here: https://www.digitalcitizen.life/how-saf ... -your-data . By default the devices usually use cached writes for performance. When you write to the drive, the data may not have been actually written to the device yet.

As well if you over write the boot sector of a device, Windows may pop up a message about the device being unformatted/unpartititioned and whether you'd like to format the drive. Never tell it to format the USB since that will cause the bootloader to be overwritten.

Author:  deleted8917 [ Sun Feb 17, 2019 5:22 pm ]
Post subject:  Re: My OS does not boot in real hardware

MichaelPetch wrote:
When you say triple faulting does the computer continually reboot? Anyway, it really sounds like to me that writing to the USB hasn't occurred properly. After you write the file with win32disk do you take the USB stick out and move it to another machine? If you do, do you do a safe windows eject before you remove the USB stick? Information on doing that is here: https://www.digitalcitizen.life/how-saf ... -your-data . By default the devices usually use cached writes for performance. When you write to the drive, the data may not have been actually written to the device yet.

As well if you over write the boot sector of a device, Windows may pop up a message about the device being unformatted/unpartititioned and whether you'd like to format the drive. Never tell it to format the USB since that will cause the bootloader to be overwritten.

Yes, I safe eject the USB. And the machine is continually rebooting.

Author:  MichaelPetch [ Sun Feb 17, 2019 5:26 pm ]
Post subject:  Re: My OS does not boot in real hardware

I don't use win32disk, so I can say anything about it. Did you happen to try using DD after doing the procedure I listed in an earlier comment (a procedure to clean the disk before using DD)? Did it resolve the access denied error?

Author:  MichaelPetch [ Sun Feb 17, 2019 5:33 pm ]
Post subject:  Re: My OS does not boot in real hardware

One other thing, and this is just to be on the safe side. You have %include "rstdio.inc" right after including bpb.inc . bpb.inc should be included at the top where it is. Move the rstdio.inc include line just before the section .data line. This likely has nothing to do with your issue, but if you ever run into a BIOS that attempts to intelligently determine the presence of a BPB - it could get confused.

Author:  deleted8917 [ Sun Feb 17, 2019 5:36 pm ]
Post subject:  Re: My OS does not boot in real hardware

MichaelPetch wrote:
I don't use win32disk, so I can say anything about it. Did you happen to try using DD after doing the procedure I listed in an earlier comment (a procedure to clean the disk before using DD)? Did it resolve the access denied error?

Yes, I resolved the access denied error, and dd works correctly.
But It gets stuck (again, ugh) in real mode, in the loading stage...
I ejected the USB safely, as suggested.
btw, I thank you for the patience you've had with me. :)

Author:  MichaelPetch [ Sun Feb 17, 2019 5:51 pm ]
Post subject:  Re: My OS does not boot in real hardware

Can you make a copy of your disk.img (that fails) available somewhere I can download it or email it to [email protected] ? There isn't much more help I can render. The beginning of that bootloader is pretty straight forward including the relocation (it is what old versions of DOS did).Other than trying a different USB thumb drive (maybe yours has a problem?) I can't suggest much more.

Page 2 of 4 All times are UTC - 6 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/