Sorry to bother again, why can't i write anything to the VGA
-
- Member
- Posts: 102
- Joined: Wed Oct 20, 2021 6:00 pm
- Location: Paraguay
Sorry to bother again, why can't i write anything to the VGA
Hi,
Like the title. Can you help me? I'm getting crazy with it.
Here is my repo: https://github.com/NeonLightions/Amore-OS-x64
Like the title. Can you help me? I'm getting crazy with it.
Here is my repo: https://github.com/NeonLightions/Amore-OS-x64
-
- Member
- Posts: 5563
- Joined: Mon Mar 25, 2013 7:01 pm
Re: Sorry to bother again, why can't i write anything to the
You're building 64-bit code but you never switch the CPU to 64-bit mode.
-
- Member
- Posts: 102
- Joined: Wed Oct 20, 2021 6:00 pm
- Location: Paraguay
Re: Sorry to bother again, why can't i write anything to the
Yes, I just haven't switched to 64-bit mode yet. But can I call C function before I switch to 64-bit mode?Octocontrabass wrote:You're building 64-bit code but you never switch the CPU to 64-bit mode.
-
- Member
- Posts: 5563
- Joined: Mon Mar 25, 2013 7:01 pm
Re: Sorry to bother again, why can't i write anything to the
Only if you compile said C function into 32-bit code.
It's better to just switch the CPU to 64-bit mode. Don't waste your time trying to mix 32-bit and 64-bit code.
It's better to just switch the CPU to 64-bit mode. Don't waste your time trying to mix 32-bit and 64-bit code.
-
- Member
- Posts: 102
- Joined: Wed Oct 20, 2021 6:00 pm
- Location: Paraguay
Re: Sorry to bother again, why can't i write anything to the
OK, I will notice that. Thank you.Octocontrabass wrote:Only if you compile said C function into 32-bit code.
It's better to just switch the CPU to 64-bit mode. Don't waste your time trying to mix 32-bit and 64-bit code.
-
- Member
- Posts: 102
- Joined: Wed Oct 20, 2021 6:00 pm
- Location: Paraguay
Re: Sorry to bother again, why can't i write anything to the
Hi,Octocontrabass wrote:Only if you compile said C function into 32-bit code.
It's better to just switch the CPU to 64-bit mode. Don't waste your time trying to mix 32-bit and 64-bit code.
I have entered long mode, but I still can't write anything to VGA buffer. Can you help me? I have updated repo, you can check on there. Thank you.
-
- Member
- Posts: 5563
- Joined: Mon Mar 25, 2013 7:01 pm
Re: Sorry to bother again, why can't i write anything to the
What does it do instead of writing to the VGA buffer? Triple fault and reboot? Looking at the code, it should triple fault and reboot.
This isn't going to work.
Neither will this.
And while I'm at it, EAX and EBX don't contain the Multiboot2 magic number or pointer to the Multiboot2 information at this point.
This isn't going to work.
Neither will this.
And while I'm at it, EAX and EBX don't contain the Multiboot2 magic number or pointer to the Multiboot2 information at this point.
-
- Member
- Posts: 102
- Joined: Wed Oct 20, 2021 6:00 pm
- Location: Paraguay
Re: Sorry to bother again, why can't i write anything to the
So what should I do to map 2 MiB pages? I followed Philipp's tutorial, but with GAS syntax.Octocontrabass wrote:What does it do instead of writing to the VGA buffer? Triple fault and reboot? Looking at the code, it should triple fault and reboot.
This isn't going to work.
Neither will this.
And while I'm at it, EAX and EBX don't contain the Multiboot2 magic number or pointer to the Multiboot2 information at this point.
-
- Member
- Posts: 5563
- Joined: Mon Mar 25, 2013 7:01 pm
Re: Sorry to bother again, why can't i write anything to the
You should fix your AT&T syntax. You forgot the $ prefix, so the assembler will interpret those labels as memory operands instead of immediate operands.
-
- Member
- Posts: 102
- Joined: Wed Oct 20, 2021 6:00 pm
- Location: Paraguay
Re: Sorry to bother again, why can't i write anything to the
I have done like what you said. But it still triple fault.Octocontrabass wrote:You should fix your AT&T syntax. You forgot the $ prefix, so the assembler will interpret those labels as memory operands instead of immediate operands.
-
- Member
- Posts: 5563
- Joined: Mon Mar 25, 2013 7:01 pm
Re: Sorry to bother again, why can't i write anything to the
Maybe you should use a debugger and see if you can spot the problem that way? It'll probably be faster than asking here.
I think you're missing an instruction.
I think you're missing an instruction.
-
- Member
- Posts: 102
- Joined: Wed Oct 20, 2021 6:00 pm
- Location: Paraguay
Re: Sorry to bother again, why can't i write anything to the
How stupid am I? I forgot to copy %eax back to %cr4, thank you! Now it's working normal. Sorry to bother youOctocontrabass wrote:Maybe you should use a debugger and see if you can spot the problem that way? It'll probably be faster than asking here.
I think you're missing an instruction.
-
- Member
- Posts: 102
- Joined: Wed Oct 20, 2021 6:00 pm
- Location: Paraguay
Re: Sorry to bother again, why can't i write anything to the
Hi,
After I fixed stupid bug (sorry to bother), there's more bug in my project. In kernel/video/vga/vga.c, there's a bug in __clrscr() but I can't find out what. Can anyone help me?
After I fixed stupid bug (sorry to bother), there's more bug in my project. In kernel/video/vga/vga.c, there's a bug in __clrscr() but I can't find out what. Can anyone help me?
-
- Member
- Posts: 5563
- Joined: Mon Mar 25, 2013 7:01 pm
-
- Member
- Posts: 102
- Joined: Wed Oct 20, 2021 6:00 pm
- Location: Paraguay
Re: Sorry to bother again, why can't i write anything to the
Thanks, another question: I can't write text with color, how may I fix it?Octocontrabass wrote:A typo in this line causes an infinite loop.