uefi error unsupported when opening graphics output protocol

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.
User avatar
zaval
Member
Member
Posts: 656
Joined: Fri Feb 17, 2017 4:01 pm
Location: Ukraine, Bachmut
Contact:

Re: uefi error unsupported when opening graphics output prot

Post by zaval »

nexos wrote:@zaval: How would UEFI prevent you from drawing to the framebuffer before ExitBootServices? It has no way of doing so! The OSL is running in kernel mode. It can draw to the framebuffer.
obviously it wouldn't prevent. why you think I said that?
ANT - NT-like OS for x64 and arm64.
efify - UEFI for a couple of boards (mips and arm). suspended due to lost of all the target park boards (russians destroyed our town).
nexos
Member
Member
Posts: 1081
Joined: Tue Feb 18, 2020 3:29 pm
Libera.chat IRC: nexos

Re: uefi error unsupported when opening graphics output prot

Post by nexos »

I'm confused :?
zaval wrote:for the early stages of the OS initialization, there is video framebuffer, about which you get to know from GOP functions/fields. after your OSL owns the system, you can draw in that framebuffer by yourself.
It appears here that you said that you can only use the framebuffer after calling ExitBootServices. Please correct me if I misunderstood :) .
"How did you do this?"
"It's very simple — you read the protocol and write the code." - Bill Joy
Projects: NexNix | libnex | nnpkg
User avatar
zaval
Member
Member
Posts: 656
Joined: Fri Feb 17, 2017 4:01 pm
Location: Ukraine, Bachmut
Contact:

Re: uefi error unsupported when opening graphics output prot

Post by zaval »

I should have written "after your OSL owns the system, you have to draw in that framebuffer by yourself." (as opposed to using GOP during Boot Services).
ANT - NT-like OS for x64 and arm64.
efify - UEFI for a couple of boards (mips and arm). suspended due to lost of all the target park boards (russians destroyed our town).
nexos
Member
Member
Posts: 1081
Joined: Tue Feb 18, 2020 3:29 pm
Libera.chat IRC: nexos

Re: uefi error unsupported when opening graphics output prot

Post by nexos »

Ok, that makes more sense. I guess I misunderstood :lol: .
"How did you do this?"
"It's very simple — you read the protocol and write the code." - Bill Joy
Projects: NexNix | libnex | nnpkg
User avatar
austanss
Member
Member
Posts: 377
Joined: Sun Oct 11, 2020 9:46 pm
Location: United States

Re: uefi error unsupported when opening graphics output prot

Post by austanss »

zaval, I apologize for my statements. I misread your post. I still haven't fixed this problem. Originally I thought I was forcing an incompatible video mode upon my computer, and that's why it wasn't working. However, I quickly realized that the error lies in the function call to open the protocol, which leaves me stumped.

The UEFI spec reports only one cause for an EFI_UNSUPPORTED error that arises from an OpenProtocol function call.
UEFI specification wrote: If Handle does not support Protocol, then EFI_UNSUPPORTED is returned.
Does the handle relate to the specific UEFI implementation of the computer?
Skylight: https://github.com/austanss/skylight

I make stupid mistakes and my vision is terrible. Not a good combination.

NOTE: Never respond to my posts with "it's too hard".
User avatar
austanss
Member
Member
Posts: 377
Joined: Sun Oct 11, 2020 9:46 pm
Location: United States

Re: uefi error unsupported when opening graphics output prot

Post by austanss »

After finding this amazing Stack Overflow answer, I am on a lead that I will get back to you on:

https://stackoverflow.com/a/49814997
Skylight: https://github.com/austanss/skylight

I make stupid mistakes and my vision is terrible. Not a good combination.

NOTE: Never respond to my posts with "it's too hard".
User avatar
austanss
Member
Member
Posts: 377
Joined: Sun Oct 11, 2020 9:46 pm
Location: United States

Re: uefi error unsupported when opening graphics output prot

Post by austanss »

Blasted, it didn't work. I'm going to attempt to use alternative functions in a last-ditch attempt to make this work on my computer.
Skylight: https://github.com/austanss/skylight

I make stupid mistakes and my vision is terrible. Not a good combination.

NOTE: Never respond to my posts with "it's too hard".
User avatar
austanss
Member
Member
Posts: 377
Joined: Sun Oct 11, 2020 9:46 pm
Location: United States

Re: uefi error unsupported when opening graphics output prot

Post by austanss »

I fixed the issue!

Instead of using just OpenProtocol, or using LocateProtocol + (OpenProtocol/HandleProtocol), I just used LocateProtocol and it worked! Magical!

My kernel isn't loading, I'm hanging at getting memory map. However, I don't know for sure that's where it's hanging at, I only know that was the last message being sent.

IN the bootloader/kernel transition, there is a graphical silence period. After getting the memory map, I can't use any more UEFI boot functions. I then have to immediately leave boot services. Then, the bootloader calls the kernel, and after loading a new GDT, new IDT, and calling global constructors, then my kernel main function is called and THEN, after doing a few tasks it configures the terminal. So there is a lot going on and I can't tell where the issue lies. Being that the issue only arises on my real computer, doing the traditional breakpoint isn't going to work efficiently.

I know that a lot of information does come through the serial port.

In fact, my computer even has a serial port. But I don't have a device connected to receive the data. Anyone have any ideas?
Skylight: https://github.com/austanss/skylight

I make stupid mistakes and my vision is terrible. Not a good combination.

NOTE: Never respond to my posts with "it's too hard".
Octocontrabass
Member
Member
Posts: 5568
Joined: Mon Mar 25, 2013 7:01 pm

Re: uefi error unsupported when opening graphics output prot

Post by Octocontrabass »

You can access the framebuffer at any time to put pixels on it. Filling the screen with different colors should be good enough for some simple debugging.
User avatar
austanss
Member
Member
Posts: 377
Joined: Sun Oct 11, 2020 9:46 pm
Location: United States

Re: uefi error unsupported when opening graphics output prot

Post by austanss »

Octocontrabass wrote:You can access the framebuffer at any time to put pixels on it. Filling the screen with different colors should be good enough for some simple debugging.
you're a genius
Skylight: https://github.com/austanss/skylight

I make stupid mistakes and my vision is terrible. Not a good combination.

NOTE: Never respond to my posts with "it's too hard".
User avatar
austanss
Member
Member
Posts: 377
Joined: Sun Oct 11, 2020 9:46 pm
Location: United States

Re: uefi error unsupported when opening graphics output prot

Post by austanss »

Right, now I'm kinda pissed.

Code: Select all

kernel_entry:

	mov r15, rdi					;	preserve parameters]

	mov rdi, kernel_taken_over
	call serial_msg

	mov qword [asm_framebuffer_ptr], 0x80000000

	mov edx, 0xFFFFFF
	call set_status_color

. . .

set_status_color:
	push rcx
	mov rcx, [asm_framebuffer_ptr]
%rep 50
	mov dword [rcx], edx // Page fault here
	inc rcx
%endrep
	pop rcx
	ret

section .data

asm_framebuffer_ptr:
	resb 8
Skylight: https://github.com/austanss/skylight

I make stupid mistakes and my vision is terrible. Not a good combination.

NOTE: Never respond to my posts with "it's too hard".
Octocontrabass
Member
Member
Posts: 5568
Joined: Mon Mar 25, 2013 7:01 pm

Re: uefi error unsupported when opening graphics output prot

Post by Octocontrabass »

rizxt wrote:

Code: Select all

	mov qword [asm_framebuffer_ptr], 0x80000000
How did you get this number?
User avatar
austanss
Member
Member
Posts: 377
Joined: Sun Oct 11, 2020 9:46 pm
Location: United States

Re: uefi error unsupported when opening graphics output prot

Post by austanss »

Octocontrabass wrote:
rizxt wrote:

Code: Select all

	mov qword [asm_framebuffer_ptr], 0x80000000
How did you get this number?
Thanks for pointing that out, that is a problem.

Given a struct like this:

Code: Select all

typedef struct s_boot_info {
	uint64_t verification;
	Framebuffer *vbe_framebuffer;
	Memory_Map_Descriptor *memory_map;
	uint64_t mmap_size;
	uint64_t mmap_descriptor_size;
	Efi_Runtime_Services *runtime_services;
} Boot_Info;
Where a pointer to said struct is stored in the rdi register...

In assembly, how do I access the Framebuffer pointer, vbe_framebuffer?
Skylight: https://github.com/austanss/skylight

I make stupid mistakes and my vision is terrible. Not a good combination.

NOTE: Never respond to my posts with "it's too hard".
Octocontrabass
Member
Member
Posts: 5568
Joined: Mon Mar 25, 2013 7:01 pm

Re: uefi error unsupported when opening graphics output prot

Post by Octocontrabass »

Read it from memory at [rdi+8].
User avatar
austanss
Member
Member
Posts: 377
Joined: Sun Oct 11, 2020 9:46 pm
Location: United States

Re: uefi error unsupported when opening graphics output prot

Post by austanss »

After using the magical color method, and diagnosing a few issues, and removing lines of code, I finally got my OS booting on real hardware! Currently, the sample size is 1 (my computer), but I will test it on multiple other computers when I get the chance.

I've been working on this for a month and a half and I'm so glad I finished it!

I can't believe I've taken a project this far.

I don't know if you can tell how ecstatic I am...

Problems I need to address: interrupts

Once I fix my interrupts, and fix the keyboard, I think I can keep moving forward with this OS, of course, until UEFI 3.0 comes out and obsoletes every operating system except Windows...
Skylight: https://github.com/austanss/skylight

I make stupid mistakes and my vision is terrible. Not a good combination.

NOTE: Never respond to my posts with "it's too hard".
Post Reply