OSDev.org

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

All times are UTC - 6 hours




Post new topic Reply to topic  [ 21 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: Err... Text cursor doesn't appear in long mode?
PostPosted: Wed Oct 20, 2021 6:05 pm 
Offline
Member
Member

Joined: Wed Oct 20, 2021 6:00 pm
Posts: 102
Location: Paraguay
This is akward, since I'm programming a kernel in long mode. Everything is fine except there is no text cursor in the screen. I have tried all methods on Internet such as OsDev wiki and Jose's wiki, even Jame's kernel development tutorial. But all of them did not bring positive results. It's still just a blank black screen. Can anybody help me solve this issue? Reply me if you want to see the source code. Thank you very much for reading my question.

Sorry for my bad English


Top
 Profile  
 
 Post subject: Re: Err... Text cursor doesn't appear in long mode?
PostPosted: Wed Oct 20, 2021 7:33 pm 
Offline
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 5099
How did you set up the display for text mode?


Top
 Profile  
 
 Post subject: Re: Err... Text cursor doesn't appear in long mode?
PostPosted: Wed Oct 20, 2021 7:44 pm 
Offline
Member
Member

Joined: Wed Oct 20, 2021 6:00 pm
Posts: 102
Location: Paraguay
I'm set up display at VGA address 0xB8000


Top
 Profile  
 
 Post subject: Re: Err... Text cursor doesn't appear in long mode?
PostPosted: Wed Oct 20, 2021 9:06 pm 
Offline
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 5099
But did you set up text mode? Maybe your bootloader is configuring a linear framebuffer instead.


Top
 Profile  
 
 Post subject: Re: Err... Text cursor doesn't appear in long mode?
PostPosted: Wed Oct 20, 2021 9:18 pm 
Offline
Member
Member
User avatar

Joined: Wed Sep 28, 2005 11:00 pm
Posts: 85
How are you enabling the cursor? Are you writing to the correct ports?


Top
 Profile  
 
 Post subject: Re: Err... Text cursor doesn't appear in long mode?
PostPosted: Wed Oct 20, 2021 9:20 pm 
Offline
Member
Member

Joined: Wed Oct 20, 2021 6:00 pm
Posts: 102
Location: Paraguay
Yes, I have enabled cursor using port 0x3D4 and 0x3D5


Top
 Profile  
 
 Post subject: Re: Err... Text cursor doesn't appear in long mode?
PostPosted: Wed Oct 20, 2021 9:23 pm 
Offline
Member
Member

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

I think the bootloader is working correctly. It isn't use any linear framebuffer. Everything is working correctly except the text cursor


Top
 Profile  
 
 Post subject: Re: Err... Text cursor doesn't appear in long mode?
PostPosted: Wed Oct 20, 2021 9:38 pm 
Offline
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 5099
NeonLightions wrote:
Yes, I have enabled cursor using port 0x3D4 and 0x3D5

What values did you write to those ports?

NeonLightions wrote:
I think the bootloader is working correctly. It isn't use any linear framebuffer.

Which bootloader are you using?


Top
 Profile  
 
 Post subject: Re: Err... Text cursor doesn't appear in long mode?
PostPosted: Wed Oct 20, 2021 9:43 pm 
Offline
Member
Member

Joined: Wed Oct 20, 2021 6:00 pm
Posts: 102
Location: Paraguay
Octocontrabass wrote:
NeonLightions wrote:
Yes, I have enabled cursor using port 0x3D4 and 0x3D5

What values did you write to those ports?

Here is my code:
Code:
void enable_cursor(uint8_t size)
{
    uint8_t start_line = 16 - size;
   outb(0x3D4, 0x0A);
   outb(0x3D5, (inb(0x3D5) & 0xC0) | start_line);

   outb(0x3D4, 0x0B);
   outb(0x3D5, (inb(0x3D5) & 0xE0) | 15);
}

void update_cursor(int x, int y)
{
   uint16_t pos = y * 80 + x;

   outb(0x3D4, 0x0F);
   outb(0x3D5, (uint8_t) (pos & 0xFF));
   outb(0x3D4, 0x0E);
   outb(0x3D5, (uint8_t) ((pos >> 8) & 0xFF));
}

void move_cursor(void) {
    const size_t idx = y_pos * 80 + x_pos;
    outb(0x3D4, 0x0F);
    outb(0x3D5, (uint8_t) (idx & 0xFF));
    outb(0x3D4, 0x0E);
    outb(0x3D5, (uint8_t) ((idx >> 8) & 0xFF));
}


NeonLightions wrote:
I think the bootloader is working correctly. It isn't use any linear framebuffer.

Which bootloader are you using?


I'm using GRUB. Is there any linear framebuffer? After all, I'm just a newbie with this project. Forgive me if there any mistake in my words and my lack knowledge post

If there is linear framebuffer, can you show me how to enable text cursor in it?


Top
 Profile  
 
 Post subject: Re: Err... Text cursor doesn't appear in long mode?
PostPosted: Wed Oct 20, 2021 10:20 pm 
Offline
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 5099
NeonLightions wrote:
Here is my code:

How are you calling enable_cursor? Are you sure outb works?

NeonLightions wrote:
I'm using GRUB. Is there any linear framebuffer?

Are you using BIOS/CSM or UEFI? GRUB with UEFI will always set up a linear framebuffer.

How did you configure GRUB and your multiboot header? If you told it you want a linear framebuffer, it will give you a linear framebuffer.

NeonLightions wrote:
If there is linear framebuffer, can you show me how to enable text cursor in it?

There's no such thing as a text cursor in a linear framebuffer.


Top
 Profile  
 
 Post subject: Re: Err... Text cursor doesn't appear in long mode?
PostPosted: Wed Oct 20, 2021 11:18 pm 
Offline
Member
Member

Joined: Wed Mar 30, 2011 12:31 am
Posts: 676
Octocontrabass wrote:
How did you configure GRUB and your multiboot header? If you told it you want a linear framebuffer, it will give you a linear framebuffer.

(You can override this by setting gfxpayload to "text" (of course, only under BIOS) after loading your kernel.)

_________________
toaruos on github | toaruos.org | gitlab | twitter | bim - a text editor


Top
 Profile  
 
 Post subject: Re: Err... Text cursor doesn't appear in long mode?
PostPosted: Thu Oct 21, 2021 12:59 am 
Offline
Member
Member

Joined: Wed Oct 20, 2021 6:00 pm
Posts: 102
Location: Paraguay
Octocontrabass wrote:
How are you calling enable_cursor? Are you sure outb works?

I haved called enable_cursor() at the start of kernel_main and I'm sure outb work 100% perfectly


Octocontrabass wrote:
Are you using BIOS/CSM or UEFI? GRUB with UEFI will always set up a linear framebuffer.

I'm using BIOS

Octocontrabass wrote:
How did you configure GRUB and your multiboot header? If you told it you want a linear framebuffer, it will give you a linear framebuffer.

Like I said, I'm just a newbie. So I'm just set default to it


Octocontrabass wrote:
There's no such thing as a text cursor in a linear framebuffer.

I will keep this in mind


Top
 Profile  
 
 Post subject: Re: Err... Text cursor doesn't appear in long mode?
PostPosted: Thu Oct 21, 2021 1:17 am 
Offline
Member
Member

Joined: Wed Mar 30, 2011 12:31 am
Posts: 676
It would be helpful to see the rest of your source tree, if you can provide it.

I think an important question that hasn't been asked yet is have you outputted any text yet?

_________________
toaruos on github | toaruos.org | gitlab | twitter | bim - a text editor


Top
 Profile  
 
 Post subject: Re: Err... Text cursor doesn't appear in long mode?
PostPosted: Thu Oct 21, 2021 1:30 am 
Offline
Member
Member

Joined: Wed Oct 20, 2021 6:00 pm
Posts: 102
Location: Paraguay
klange wrote:
It would be helpful to see the rest of your source tree, if you can provide it.

Here is my source tree:
Code:
[MyOS]
|__ [scripts]
|    |__ .gitignore
|    |__ grub.cfg
|    |__ linker.ld
|__ [src]
|    |__ [boot]
|    |    |__ header.s
|    |    |__ main.s
|    |    |__ main64.s
|    |__ [common]
|    |    |__ printf.c
|    |    |__ printf.h
|    |    |__ types.h
|    |__ [display]
|    |    |__ vga.c
|    |    |__ vga.h
|    |    |__ terminal.h
|    |    |__ terminal.c
|    |__ [device]
|    |    |__ port.c
|    |    |__ port.h
|    |__ [interrupts]
|    |    |__ idt.c
|    |    |__ idt.h
|    |    |__ load_idt.s
|    |    |__ isr.c
|    |    |__ isr.h
|    |__ [memory]
|    |    |__ gdt.c
|    |    |__ gdt.h
|    |    |__ load_gdt.s
|    |__ main.c
|__ Makefile


klange wrote:
I think an important question that hasn't been asked yet is have you outputted any text yet?

I'm sorry but what is that?


Top
 Profile  
 
 Post subject: Re: Err... Text cursor doesn't appear in long mode?
PostPosted: Thu Oct 21, 2021 1:42 am 
Offline
Member
Member
User avatar

Joined: Sun Feb 18, 2007 7:28 pm
Posts: 1564
Hi,

You mentioned that all you see is a blank screen. Are you able to display any text at all? I.e. implement a quick function to print a string to 0xb8000 and verify if it works or not.

_________________
OS Development Series | Wiki | os | ncc
char c[2]={"\x90\xC3"};int main(){void(*f)()=(void(__cdecl*)(void))(void*)&c;f();}


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

All times are UTC - 6 hours


Who is online

Users browsing this forum: Bing [Bot], Majestic-12 [Bot], SemrushBot [Bot] and 66 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