ATI VBE Protect Mode Info GPF!

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
arabasso
Member
Member
Posts: 27
Joined: Thu Jul 10, 2008 9:41 am

ATI VBE Protect Mode Info GPF!

Post by arabasso »

I am creating a generic VESA video driver. Having implemented a V86 monitor, I can list the modes, set the video mode, etc. Everything OK so far...

So to speed things up, I decided to use the implementation in 32 bit VBE standard (more specifically the function "Set Display Start" that serves to make hardware scrolling). Tested on different video cards (Trident Cyber Blade, Nvidia TNT2 / GF MX 440 / 9600GT, SIS Mirage / 730). In all cases it worked correctly (the speed gain was nonsense using page flipping).

So I decided to test on my notebook Acer Aspire 3050 (ATI Xpress X1100). Incredibly, ATI card handles GPF on function "Set Display Start").

Following is the code that implements VBE PMode functions:

Code: Select all

void getFunctionsVideo()
{
	video.context.ax = 0x4F0A;
	video.context.bx = 0x0000;

	executeVirtual(0x10, & video.context);

	if (video.context.ax == 0x4F)
	{
		video.functionsInfo = malloc(video.context.cx);

		memcpy(video.functionsInfo, cast(void *, ((video.context.es << 4) + video.context.di)), video.context.cx);

		video.functions.setWindow  = cast(unsigned int, video.functionsInfo) + video.functionsInfo->setWindow;
		video.functions.setDisplay = cast(unsigned int, video.functionsInfo) + video.functionsInfo->setDisplay;
		video.functions.setPalette = cast(unsigned int, video.functionsInfo) + video.functionsInfo->setPalette;

		video.functions.selector = 0x10;

		unsigned int ioPrivInfo = cast(unsigned int, video.functionsInfo);

		if (video.functionsInfo->ioPrivInfo > 0)
		{
			unsigned short * io = cast(unsigned short *, (ioPrivInfo + video.functionsInfo->ioPrivInfo));

			while (* io != 0xFFFF)
				io++;

			io++;

			// *** ATI CARD NOT CREATES A DESCRIPTOR ***

			if (* io != 0xFFFF)
			{
				printf("\nPORT IO.: %X / %X\n", * cast(unsigned int *, io), * (io + 2));

				setGlobalEntryDescriptor(6, * cast(unsigned int *, io), * (io + 2), 0x92, 0xCF);

				video.functions.selector = 0x30;
			}
		}

		putchar('\n');
	}
}
...
// *** Remembering ATI Xpress does not require the creation of a descriptor ***

void scrollVideo(unsigned int offset)
{
	__asm__ __volatile__
	(
		"call	* %0"
		:
		: "r" (video.functions.setDisplay), "b" (0x0), "c" (offset & 0xFFFF), "d" (offset >> 16)
	);
}
What could it be?!
User avatar
Primis
Member
Member
Posts: 62
Joined: Fri May 14, 2010 3:46 pm
Libera.chat IRC: Primis
Location: New York, NY
Contact:

Re: ATI VBE Protect Mode Info GPF!

Post by Primis »

Going out on a limb here, could your paging code mark a page as read-only? if you tried to write in it, that would trip your GPF.
Another theory, are you still in your v86 monitor? if so, you probably shouldn't be able to write to that memory.
Just guesses though, if its just that laptop, maybe the BIOS doesn't set it back to a VESA compatible, many laptops don't bother seeing as many OS'es use "modern" modes which completely disable VESA 99.9% of the time. check your BIOS to see if there is an option to do with it or a "NON PLUG-N-PLAY OS" option. usually you want that turned off so the BIOS can do some of the heavy lifting for you.
"On two occasions I have been asked, 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question."
Image
Post Reply