problem with bootin
problem with bootin
Hai i have made a 32 bit os following james molloy tuturial and tested it.
it shows no problem with bochs.
i tested it in intel celeron processor and it worked fine..
but if i test it in any of 64bit processors or newer intel processors it jus reboots after grub is loaded..
what is the reason ?
it shows no problem with bochs.
i tested it in intel celeron processor and it worked fine..
but if i test it in any of 64bit processors or newer intel processors it jus reboots after grub is loaded..
what is the reason ?
Re: problem with bootin
Does it use any 64 bit stuff at all?
-
- Member
- Posts: 2566
- Joined: Sun Jan 14, 2007 9:15 pm
- Libera.chat IRC: miselin
- Location: Sydney, Australia (I come from a land down under!)
- Contact:
Re: problem with bootin
Because a 64-bit processor won't run a 32-bit OS? I know it has compatibility modes to run 32 bit code, but I doubt it'll run a 32-bit OS (at least, AFAIK).
-
- Member
- Posts: 391
- Joined: Wed Jul 25, 2007 8:45 am
- Libera.chat IRC: aejsmith
- Location: London, UK
- Contact:
Re: problem with bootin
No. If that was the case, GRUB wouldn't even run x86_64 processors can run both 32-bit and 64-bit OSes, depending on what CPU mode you are in.pcmattman wrote:Because a 64-bit processor won't run a 32-bit OS? I know it has compatibility modes to run 32 bit code, but I doubt it'll run a 32-bit OS (at least, AFAIK).
@asdfgh: What processors exactly does this happen on? Also, does it happen if you run it on 64-bit QEMU (qemu-system-x86_64)?
-
- Member
- Posts: 2566
- Joined: Sun Jan 14, 2007 9:15 pm
- Libera.chat IRC: miselin
- Location: Sydney, Australia (I come from a land down under!)
- Contact:
Re: problem with bootin
Ah, my mistake. Thanks for that, I'll keep that in mind .
Re: problem with bootin
Try to make a test kernel that just basically sets protected mode register values.asdfgh wrote:Hai i have made a 32 bit os following james molloy tuturial and tested it.
it shows no problem with bochs.
i tested it in intel celeron processor and it worked fine..
but if i test it in any of 64bit processors or newer intel processors it jus reboots after grub is loaded..
what is the reason ?
Try to load the DS, ES, FS and GS registers with valid segment numbers, maybe to the default data segment for testing purposes.
Also, and probably most importantly, reload the SS register to a proper data segment for the stack (it can be the default 4GB data segment I guess) and then reload the ESP register to point just the end of the stack. For example if the end of your kernel stack is at 0x500000, give ESP the value of 0x500000-1 (please somebody correct in case substracting 1 is incorrect).
Try it out. My first kernels, which loaded from floppy using a custom Master Boot Record always failed for this kind of things, in a HP Vectra VL 5/200 Series 4.
YouTube:
http://youtube.com/@AltComp126
My x86 OS/software:
https://sourceforge.net/projects/api-simple-completa/
Donate to get more food/programming resources/computers:
https://www.paypal.com/donate/?hosted_b ... QS2YTW3V64
http://youtube.com/@AltComp126
My x86 OS/software:
https://sourceforge.net/projects/api-simple-completa/
Donate to get more food/programming resources/computers:
https://www.paypal.com/donate/?hosted_b ... QS2YTW3V64
Re: problem with bootin
Hi,
For example, it could be that the newer computers have more RAM and there's a bug in the memory manager initialization, or that a reserved bit is set somewhere that's ignored on older CPUs but used for something on newer CPUs, or that TLB's aren't being invalidated properly and the bug only shows itself if the CPU has large enough TLBs, or some sort of race condition that only causes problems if the CPU is fast enough, or the code detects some new feature is present and tries to use or initialize it and fails (but doesn't try to use the feature or fail on older CPUs that don't have the feature), or uses uninitialized RAM which happens to be set to zero on some computers, or...
Basically it could be any sort of problem with any piece of code; and without much useful information you won't get many useful answers.
You could try inserting something like "for(;;);" near the start of the code and see if it locks up instead of rebooting, and then keep shifting this line of code and retrying until you know exactly where it reboots. Implementing some temporary/basic screen output and/or exception handling might help too. Alternatively, you could comment out parts until it works, then slowly remove the comments.
Cheers,
Brendan
I'd assume it has more to do with "newer processors" than it has to do with "64-bit processors"...asdfgh wrote:it shows no problem with bochs.
i tested it in intel celeron processor and it worked fine..
but if i test it in any of 64bit processors or newer intel processors it jus reboots after grub is loaded..
what is the reason ?
For example, it could be that the newer computers have more RAM and there's a bug in the memory manager initialization, or that a reserved bit is set somewhere that's ignored on older CPUs but used for something on newer CPUs, or that TLB's aren't being invalidated properly and the bug only shows itself if the CPU has large enough TLBs, or some sort of race condition that only causes problems if the CPU is fast enough, or the code detects some new feature is present and tries to use or initialize it and fails (but doesn't try to use the feature or fail on older CPUs that don't have the feature), or uses uninitialized RAM which happens to be set to zero on some computers, or...
Basically it could be any sort of problem with any piece of code; and without much useful information you won't get many useful answers.
You could try inserting something like "for(;;);" near the start of the code and see if it locks up instead of rebooting, and then keep shifting this line of code and retrying until you know exactly where it reboots. Implementing some temporary/basic screen output and/or exception handling might help too. Alternatively, you could comment out parts until it works, then slowly remove the comments.
Cheers,
Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
- Brynet-Inc
- Member
- Posts: 2426
- Joined: Tue Oct 17, 2006 9:29 pm
- Libera.chat IRC: brynet
- Location: Canada
- Contact:
Re: problem with bootin
How can anyone be so uninformed?pcmattman wrote:Because a 64-bit processor won't run a 32-bit OS? I know it has compatibility modes to run 32 bit code, but I doubt it'll run a 32-bit OS (at least, AFAIK).
Re: problem with bootin
I think the OP should be reading the Intel/AMD manuals and maybe just some general computer theory books before diving into 32-bit programming (in general, not just OS development).
Website: https://joscor.com
-
- Member
- Posts: 2566
- Joined: Sun Jan 14, 2007 9:15 pm
- Libera.chat IRC: miselin
- Location: Sydney, Australia (I come from a land down under!)
- Contact:
Re: problem with bootin
I read the Intel manuals and got confused about the 64/32 bit compatibility stuff . So it's not really uninformed as much as misinformed.Brynet-Inc wrote:How can anyone be so uninformed?pcmattman wrote:Because a 64-bit processor won't run a 32-bit OS? I know it has compatibility modes to run 32 bit code, but I doubt it'll run a 32-bit OS (at least, AFAIK).