Determing the OEM string[SOLVED]

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.
Post Reply
User avatar
Chandra
Member
Member
Posts: 487
Joined: Sat Jul 17, 2010 12:45 am

Determing the OEM string[SOLVED]

Post by Chandra »

I've been facing difficulty while determing the OEM string for my grpahics card. I've read the Vesa 2.0 specification which clearly states that the pointer to the OEM string is a far pointer which resides somewhere below 1MB ( I'm not talking about the OEM Vendor Name just the OEM string).But i don't seem to find any string at all. Since I do this stuff in my bootloader, here's the code in assembly:

Code: Select all

mov DI, VESAINFO 
mov ax,4F00h
int 10h

mov eax, DWORD [VESAINFO+6]
mov [oem_string_ptr],eax
The value oem_string_ptr is passed to the kernel as the packed structure in the memory(with other values such as memory size, adress of frame buffer etc. all packed as a table in memory). I retrieve the oem_string_ptr from the memory from my kernel but the oem_string_ptr seems to point to the location where no string exists. Have I missed something?
Last edited by Chandra on Fri Oct 29, 2010 6:01 am, edited 1 time in total.
Programming is not about using a language to solve a problem, it's about using logic to find a solution !
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: Determing the OEM string

Post by Combuster »

are you actually using it as a segment:offset address, and not a 32-bit address?
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
TylerH
Member
Member
Posts: 285
Joined: Tue Apr 13, 2010 8:00 pm
Contact:

Re: Determing the OEM string

Post by TylerH »

Code: Select all

mov DI, VESAINFO
mov ax,4F00h
int 10h

mov eax, DWORD [VESAINFO+6]

; Convert to near ptr
shr eax, 16
shl eax, 4
add eax, WORD [VESAINFO+8]

mov [oem_string_ptr],eax
I think this'll work...
User avatar
Owen
Member
Member
Posts: 1700
Joined: Fri Jun 13, 2008 3:21 pm
Location: Cambridge, United Kingdom
Contact:

Re: Determing the OEM string

Post by Owen »

TylerAnon wrote:

Code: Select all

mov DI, VESAINFO
mov ax,4F00h
int 10h

mov eax, DWORD [VESAINFO+6]

; Convert to near ptr
shr eax, 16
shl eax, 4
add eax, WORD [VESAINFO+8]

mov [oem_string_ptr],eax
I think this'll work...
In real mode?! I think not...
User avatar
Chandra
Member
Member
Posts: 487
Joined: Sat Jul 17, 2010 12:45 am

Re: Determing the OEM string

Post by Chandra »

I tried changing the far ptr to near ptr and now the oem_string_ptr points to 0xC0000;
But still no string seems to exist there. Please help.
Programming is not about using a language to solve a problem, it's about using logic to find a solution !
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: Determing the OEM string

Post by Combuster »

Code: Select all

add eax, WORD [VESAINFO+8]
You folks realize that this is not valid assembly?

Have you tried to print the original value (what is it?) and determine for yourself what the correct physical address should be?
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
User avatar
Chandra
Member
Member
Posts: 487
Joined: Sat Jul 17, 2010 12:45 am

Re: Determing the OEM string

Post by Chandra »

Combuster wrote:

Code: Select all

add eax, WORD [VESAINFO+8]
You folks realize that this is not valid assembly?
I know that very well. Its not worth mentioning it that the assembler reports it as a 'mismatch in operand sizes'.It should be mov ax,WORD [VESAINFO+8]. Anyway, that's not what I am having problem with. Any more help please?
Programming is not about using a language to solve a problem, it's about using logic to find a solution !
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: Determing the OEM string

Post by Combuster »

Anyway, that's not what I am having problem with.
*cough*
add eax, WORD [VESAINFO+8]
(...)
mov ax,WORD [VESAINFO+8]
Start with finding a substitute that actually does what the original intended to do. This one is plain broken. No wonder you got the wrong values. (hint: you need more than one instruction)
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
Gigasoft
Member
Member
Posts: 856
Joined: Sat Nov 21, 2009 5:11 pm

Re: Determing the OEM string

Post by Gigasoft »

Sigh.

Code: Select all

movzx eax,WORD [VESAINFO+6]
movzx ecx,WORD [VESAINFO+8]
shl ecx,4
add eax,ecx
User avatar
Brendan
Member
Member
Posts: 8561
Joined: Sat Jan 15, 2005 12:00 am
Location: At his keyboard!
Contact:

Re: Determing the OEM string

Post by Brendan »

Hi,
Chandra wrote:Anyway, that's not what I am having problem with. Any more help please?
In real mode, you need a far pointer. It should be something like:

Code: Select all

    mov ax, [VESAINFO+6]
    mov si, [VESAINFO+8]
    mov es,ax                                    ;es:si = far pointer to OEM string
If this doesn't work, check that the routine you're using to print strings can handle far pointers (and if it doesn't, maybe consider writing an alternative version of it that uses "es lodsb" instead of just "lodsb", or "mov al,[es:si]" instead of just "mov al,[si]").

Of course it's also possible that the video card doesn't bother with the OEM string - it's not like it serves any practical purpose (and not like video card manufacturers actually implement everything VBE says they should correctly).


Cheers,

Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
User avatar
Chandra
Member
Member
Posts: 487
Joined: Sat Jul 17, 2010 12:45 am

Re: Determing the OEM string

Post by Chandra »

Thank you Gigasoft. I need to retrieve the OEM string in protected mode(from my kernel) and your code to change far ptr to near ptr works awesome. Thank you Brendan too for real mode code. And thank you all.

Great!
Programming is not about using a language to solve a problem, it's about using logic to find a solution !
User avatar
Owen
Member
Member
Posts: 1700
Joined: Fri Jun 13, 2008 3:21 pm
Location: Cambridge, United Kingdom
Contact:

Re: Determing the OEM string

Post by Owen »

Brendan wrote:

Code: Select all

    mov ax, [VESAINFO+6]
    mov si, [VESAINFO+8]
    mov es,ax                                    ;es:si = far pointer to OEM string
I can't help but think that

Code: Select all

  les ax, [VESAINFO+6]
would be shorter, and show some love for the little-used LxS instructions ;-)
Post Reply