OSDev.org

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

All times are UTC - 6 hours




Post new topic Reply to topic  [ 16 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: Sorry to bother again, why can't i write anything to the VGA
PostPosted: Sun Dec 12, 2021 5:38 pm 
Offline
Member
Member

Joined: Wed Oct 20, 2021 6:00 pm
Posts: 102
Location: Paraguay
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


Top
 Profile  
 
 Post subject: Re: Sorry to bother again, why can't i write anything to the
PostPosted: Sun Dec 12, 2021 6:18 pm 
Offline
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 5100
You're building 64-bit code but you never switch the CPU to 64-bit mode.


Top
 Profile  
 
 Post subject: Re: Sorry to bother again, why can't i write anything to the
PostPosted: Sun Dec 12, 2021 6:19 pm 
Offline
Member
Member

Joined: Wed Oct 20, 2021 6:00 pm
Posts: 102
Location: Paraguay
Octocontrabass wrote:
You're building 64-bit code but you never switch the CPU to 64-bit mode.

Yes, I just haven't switched to 64-bit mode yet. But can I call C function before I switch to 64-bit mode?


Top
 Profile  
 
 Post subject: Re: Sorry to bother again, why can't i write anything to the
PostPosted: Sun Dec 12, 2021 6:24 pm 
Offline
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 5100
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.


Top
 Profile  
 
 Post subject: Re: Sorry to bother again, why can't i write anything to the
PostPosted: Sun Dec 12, 2021 6:28 pm 
Offline
Member
Member

Joined: Wed Oct 20, 2021 6:00 pm
Posts: 102
Location: Paraguay
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.

OK, I will notice that. Thank you.


Top
 Profile  
 
 Post subject: Re: Sorry to bother again, why can't i write anything to the
PostPosted: Mon Dec 13, 2021 7:03 am 
Offline
Member
Member

Joined: Wed Oct 20, 2021 6:00 pm
Posts: 102
Location: Paraguay
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.

Hi,
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.


Top
 Profile  
 
 Post subject: Re: Sorry to bother again, why can't i write anything to the
PostPosted: Mon Dec 13, 2021 10:07 am 
Offline
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 5100
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.


Top
 Profile  
 
 Post subject: Re: Sorry to bother again, why can't i write anything to the
PostPosted: Mon Dec 13, 2021 6:31 pm 
Offline
Member
Member

Joined: Wed Oct 20, 2021 6:00 pm
Posts: 102
Location: Paraguay
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.

So what should I do to map 2 MiB pages? I followed Philipp's tutorial, but with GAS syntax.


Top
 Profile  
 
 Post subject: Re: Sorry to bother again, why can't i write anything to the
PostPosted: Mon Dec 13, 2021 8:03 pm 
Offline
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 5100
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.


Top
 Profile  
 
 Post subject: Re: Sorry to bother again, why can't i write anything to the
PostPosted: Tue Dec 14, 2021 2:16 am 
Offline
Member
Member

Joined: Wed Oct 20, 2021 6:00 pm
Posts: 102
Location: Paraguay
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.

I have done like what you said. But it still triple fault.


Top
 Profile  
 
 Post subject: Re: Sorry to bother again, why can't i write anything to the
PostPosted: Tue Dec 14, 2021 9:40 am 
Offline
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 5100
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.


Top
 Profile  
 
 Post subject: Re: Sorry to bother again, why can't i write anything to the
PostPosted: Tue Dec 14, 2021 5:30 pm 
Offline
Member
Member

Joined: Wed Oct 20, 2021 6:00 pm
Posts: 102
Location: Paraguay
Octocontrabass 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.

How stupid am I? I forgot to copy %eax back to %cr4, thank you! Now it's working normal. Sorry to bother you


Top
 Profile  
 
 Post subject: Re: Sorry to bother again, why can't i write anything to the
PostPosted: Thu Dec 16, 2021 8:07 pm 
Offline
Member
Member

Joined: Wed Oct 20, 2021 6:00 pm
Posts: 102
Location: Paraguay
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?


Top
 Profile  
 
 Post subject: Re: Sorry to bother again, why can't i write anything to the
PostPosted: Thu Dec 16, 2021 8:33 pm 
Offline
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 5100
A typo in this line causes an infinite loop.


Top
 Profile  
 
 Post subject: Re: Sorry to bother again, why can't i write anything to the
PostPosted: Fri Dec 17, 2021 1:34 am 
Offline
Member
Member

Joined: Wed Oct 20, 2021 6:00 pm
Posts: 102
Location: Paraguay
Octocontrabass wrote:

Thanks, another question: I can't write text with color, how may I fix it?


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

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 81 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