OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Mar 28, 2024 8:25 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 52 posts ]  Go to page Previous  1, 2, 3, 4  Next
Author Message
 Post subject: Re: My OS does not boot in real hardware
PostPosted: Sun Feb 17, 2019 3:09 pm 
Offline
Member
Member

Joined: Fri Aug 26, 2016 1:41 pm
Posts: 671
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?


Top
 Profile  
 
 Post subject: Re: My OS does not boot in real hardware
PostPosted: Sun Feb 17, 2019 3:42 pm 
Offline
Member
Member

Joined: Wed Dec 12, 2018 12:16 pm
Posts: 119
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


Top
 Profile  
 
 Post subject: Re: My OS does not boot in real hardware
PostPosted: Sun Feb 17, 2019 3:58 pm 
Offline
Member
Member

Joined: Fri Aug 26, 2016 1:41 pm
Posts: 671
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.


Top
 Profile  
 
 Post subject: Re: My OS does not boot in real hardware
PostPosted: Sun Feb 17, 2019 4:05 pm 
Offline
Member
Member

Joined: Fri Aug 26, 2016 1:41 pm
Posts: 671
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.


Top
 Profile  
 
 Post subject: Re: My OS does not boot in real hardware
PostPosted: Sun Feb 17, 2019 4:06 pm 
Offline
Member
Member

Joined: Wed Dec 12, 2018 12:16 pm
Posts: 119
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.


Top
 Profile  
 
 Post subject: Re: My OS does not boot in real hardware
PostPosted: Sun Feb 17, 2019 4:25 pm 
Offline
Member
Member

Joined: Fri Aug 26, 2016 1:41 pm
Posts: 671
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.


Top
 Profile  
 
 Post subject: Re: My OS does not boot in real hardware
PostPosted: Sun Feb 17, 2019 4:27 pm 
Offline
Member
Member

Joined: Wed Dec 12, 2018 12:16 pm
Posts: 119
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.


Top
 Profile  
 
 Post subject: Re: My OS does not boot in real hardware
PostPosted: Sun Feb 17, 2019 4:44 pm 
Offline
Member
Member

Joined: Fri Aug 26, 2016 1:41 pm
Posts: 671
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`.


Top
 Profile  
 
 Post subject: Re: My OS does not boot in real hardware
PostPosted: Sun Feb 17, 2019 4:47 pm 
Offline
Member
Member

Joined: Wed Dec 12, 2018 12:16 pm
Posts: 119
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.


Top
 Profile  
 
 Post subject: Re: My OS does not boot in real hardware
PostPosted: Sun Feb 17, 2019 5:15 pm 
Offline
Member
Member

Joined: Fri Aug 26, 2016 1:41 pm
Posts: 671
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.


Top
 Profile  
 
 Post subject: Re: My OS does not boot in real hardware
PostPosted: Sun Feb 17, 2019 5:22 pm 
Offline
Member
Member

Joined: Wed Dec 12, 2018 12:16 pm
Posts: 119
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.


Top
 Profile  
 
 Post subject: Re: My OS does not boot in real hardware
PostPosted: Sun Feb 17, 2019 5:26 pm 
Offline
Member
Member

Joined: Fri Aug 26, 2016 1:41 pm
Posts: 671
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?


Top
 Profile  
 
 Post subject: Re: My OS does not boot in real hardware
PostPosted: Sun Feb 17, 2019 5:33 pm 
Offline
Member
Member

Joined: Fri Aug 26, 2016 1:41 pm
Posts: 671
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.


Top
 Profile  
 
 Post subject: Re: My OS does not boot in real hardware
PostPosted: Sun Feb 17, 2019 5:36 pm 
Offline
Member
Member

Joined: Wed Dec 12, 2018 12:16 pm
Posts: 119
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. :)


Top
 Profile  
 
 Post subject: Re: My OS does not boot in real hardware
PostPosted: Sun Feb 17, 2019 5:51 pm 
Offline
Member
Member

Joined: Fri Aug 26, 2016 1:41 pm
Posts: 671
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.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 52 posts ]  Go to page Previous  1, 2, 3, 4  Next

All times are UTC - 6 hours


Who is online

Users browsing this forum: Bing [Bot], Google [Bot], SemrushBot [Bot] and 56 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group