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.
I've to admit, that I'm a real beginner in OS development. I startet yesterday. My bootloader works like it is supposed to, but I'd like to have a 32-Bit kernel.
Do I have to switch to protected mode before I can do anything else?
Well, Here's my Code. If I use [Bits 32] my cls and print procedure don't work anymore.
Rather then taking code without understanding it, you should read this.
You do need to go into protected mode, but you have not performed the steps to create the environment (gdt/ints) nor switch the processor into protected mode. Just adding a [Bits 32] doesnt do anything related to protected mode.
OS Development Series | Wiki | os | ncc
char c[2]={"\x90\xC3"};int main(){void(*f)()=(void(__cdecl*)(void))(void*)&c;f();}
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
neon wrote:Rather then taking code without understanding it, you should read this.
You do need to go into protected mode, but you have not performed the steps to create the environment (gdt/ints) nor switch the processor into protected mode. Just adding a [Bits 32] doesnt do anything related to protected mode.
Hi,
Sorry, I'm not that kind of guy who takes code without understanding it I admit, that I used some code from the wiki as a base. But I spend half an hour understanding every single line of code. I could tell you something about every line
And it seems that there's a misunderstanding. I know that I've done nothing to enter protected mode. That's not my goal (not yet).
My question just was how to make my 16 Bit print and cls code running with [BITS 32] or whether it's necessary to switch to protected mode in order to run 32 Bit code.
And as far as I understood imate900 I can choose between running THIS code in protected mode OR change my code.
And changing my code the way imate900 suggested did not lead to success.
@Combuster: I've read the babystep tutorial til Babystep 4
And changing my code the way imate900 suggested did not lead to success.
And what have we learned from this? Just kidding.
@imate: Understand what you're talking about before you say it. If I were you, I'd be doing so or expecting a ban soon enough.
Solar wrote:It keeps stunning me how friendly we - as a community - are towards people who start programming "their first OS" who don't even have a solid understanding of pointers, their compiler, or how a OS is structured.
neon wrote:Rather then taking code without understanding it, you should read this.
You do need to go into protected mode, but you have not performed the steps to create the environment (gdt/ints) nor switch the processor into protected mode. Just adding a [Bits 32] doesnt do anything related to protected mode.
Hi,
Sorry, I'm not that kind of guy who takes code without understanding it I admit, that I used some code from the wiki as a base. But I spend half an hour understanding every single line of code. I could tell you something about every line
And it seems that there's a misunderstanding. I know that I've done nothing to enter protected mode. That's not my goal (not yet).
My question just was how to make my 16 Bit print and cls code running with [BITS 32] or whether it's necessary to switch to protected mode in order to run 32 Bit code.
And as far as I understood imate900 I can choose between running THIS code in protected mode OR change my code.
And changing my code the way imate900 suggested did not lead to success.
@Combuster: I've read the babystep tutorial til Babystep 4
Apologies if Combuster sounded a little aggressive - we get people who copy-paste without reading in around the ratio 50-1 with people who actually attempt to understand.
There is a mode where you can run 32-bit code without protected mode. It's called "unreal mode" - there should be a wiki article on it. Other than that, if you want to run 32-bit code you'll have to switch to protected mode, which means setting up a GDT and setting the CR0.PE bit. Again, there's plenty about that on the wiki.
JamesM wrote:There is a mode where you can run 32-bit code without protected mode. It's called "unreal mode" - there should be a wiki article on it.
Umm, last time I checked, unreal mode was just a register trick to use the GDT's selectors in real mode.
Solar wrote:It keeps stunning me how friendly we - as a community - are towards people who start programming "their first OS" who don't even have a solid understanding of pointers, their compiler, or how a OS is structured.
JamesM wrote:
Apologies if Combuster sounded a little aggressive - we get people who copy-paste without reading in around the ratio 50-1 with people who actually attempt to understand.
I think this sounds familiar with me I'm registered in another forum and there it's the same. Many people (mostly new members) "code" their programs using copy&paste
kop99 wrote:Cjreek,
Unless you are going to make the real mode kernel, First thing you have to do is Protected Mode entrance...
This is what I wanted to hear
But prepare... For Sure there will be another noob question soon
(Of course after reading every possible tutorial )