Err... Text cursor doesn't appear in long mode?
-
- Member
- Posts: 102
- Joined: Wed Oct 20, 2021 6:00 pm
- Location: Paraguay
Err... Text cursor doesn't appear in long mode?
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
Sorry for my bad English
-
- Member
- Posts: 5563
- Joined: Mon Mar 25, 2013 7:01 pm
Re: Err... Text cursor doesn't appear in long mode?
How did you set up the display for text mode?
-
- Member
- Posts: 102
- Joined: Wed Oct 20, 2021 6:00 pm
- Location: Paraguay
Re: Err... Text cursor doesn't appear in long mode?
I'm set up display at VGA address 0xB8000
-
- Member
- Posts: 5563
- Joined: Mon Mar 25, 2013 7:01 pm
Re: Err... Text cursor doesn't appear in long mode?
But did you set up text mode? Maybe your bootloader is configuring a linear framebuffer instead.
Re: Err... Text cursor doesn't appear in long mode?
How are you enabling the cursor? Are you writing to the correct ports?
-
- Member
- Posts: 102
- Joined: Wed Oct 20, 2021 6:00 pm
- Location: Paraguay
Re: Err... Text cursor doesn't appear in long mode?
Yes, I have enabled cursor using port 0x3D4 and 0x3D5
-
- Member
- Posts: 102
- Joined: Wed Oct 20, 2021 6:00 pm
- Location: Paraguay
Re: Err... Text cursor doesn't appear in long mode?
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
I think the bootloader is working correctly. It isn't use any linear framebuffer. Everything is working correctly except the text cursor
-
- Member
- Posts: 5563
- Joined: Mon Mar 25, 2013 7:01 pm
Re: Err... Text cursor doesn't appear in long mode?
What values did you write to those ports?NeonLightions wrote:Yes, I have enabled cursor using port 0x3D4 and 0x3D5
Which bootloader are you using?NeonLightions wrote:I think the bootloader is working correctly. It isn't use any linear framebuffer.
-
- Member
- Posts: 102
- Joined: Wed Oct 20, 2021 6:00 pm
- Location: Paraguay
Re: Err... Text cursor doesn't appear in long mode?
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 postOctocontrabass wrote:What values did you write to those ports?NeonLightions wrote:Yes, I have enabled cursor using port 0x3D4 and 0x3D5
Here is my code:Code: Select all
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)); }
Which bootloader are you using?NeonLightions wrote:I think the bootloader is working correctly. It isn't use any linear framebuffer.
If there is linear framebuffer, can you show me how to enable text cursor in it?
-
- Member
- Posts: 5563
- Joined: Mon Mar 25, 2013 7:01 pm
Re: Err... Text cursor doesn't appear in long mode?
How are you calling enable_cursor? Are you sure outb works?NeonLightions wrote:Here is my code:
Are you using BIOS/CSM or UEFI? GRUB with UEFI will always set up a linear framebuffer.NeonLightions wrote:I'm using GRUB. Is there any 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.
There's no such thing as a text cursor in a linear framebuffer.NeonLightions wrote:If there is linear framebuffer, can you show me how to enable text cursor in it?
Re: Err... Text cursor doesn't appear in long mode?
(You can override this by setting gfxpayload to "text" (of course, only under BIOS) after loading your kernel.)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.
-
- Member
- Posts: 102
- Joined: Wed Oct 20, 2021 6:00 pm
- Location: Paraguay
Re: Err... Text cursor doesn't appear in long mode?
I haved called enable_cursor() at the start of kernel_main and I'm sure outb work 100% perfectlyOctocontrabass wrote:How are you calling enable_cursor? Are you sure outb works?
I'm using BIOSOctocontrabass wrote:Are you using BIOS/CSM or UEFI? GRUB with UEFI will always set up a linear framebuffer.
Like I said, I'm just a newbie. So I'm just set default to itOctocontrabass 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.
I will keep this in mindOctocontrabass wrote:There's no such thing as a text cursor in a linear framebuffer.
Re: Err... Text cursor doesn't appear in long mode?
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?
I think an important question that hasn't been asked yet is have you outputted any text yet?
-
- Member
- Posts: 102
- Joined: Wed Oct 20, 2021 6:00 pm
- Location: Paraguay
Re: Err... Text cursor doesn't appear in long mode?
Here is my source tree:klange wrote:It would be helpful to see the rest of your source tree, if you can provide it.
Code: Select all
[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
I'm sorry but what is that?klange wrote:I think an important question that hasn't been asked yet is have you outputted any text yet?
Re: Err... Text cursor doesn't appear in long mode?
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.
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();}
char c[2]={"\x90\xC3"};int main(){void(*f)()=(void(__cdecl*)(void))(void*)&c;f();}