Back to home page

DOS ain't dead

Forum index page

Log in | Register

Back to the forum
Board view  Mix view

copying buffer contents to protected mode (Users)

posted by ecm Homepage E-mail, Düsseldorf, Germany, 28.05.2011, 01:09

I'll describe what Japheth meant if you allow.

> > VESA32 cleared the buffer located in real-mode,
>
> Ok, maybe i'm misunderstanding, but my code *was* all real mode
> (16-bit)... and the interrupt did *not* clear the buffer -- the
> call failed and it didn't change the buffer at all! I set the
> buffer up with 256 bytes of "x" characters, ran the VESA BIOS
> 4F01h Int 10h call, and then looked at the buffer -- no change,
> still 256 bytes of "x" characters.
>
> ...
>
> > but didn't copy the contents back to protected-mode if the call
> > failed.
>
> I'm pretty-much duh! about protected mode programming. (I do
> know -- in general -- what p/m is though! :-| )

The VESA32 program apparently sets up a buffer in some memory accessible in real (or if applicable V86-)mode first. It initializes this buffer properly in some way. It makes its call to that video BIOS interface. Now the protected mode part of VESA32 has its own memory allocated for the buffer, which it uses to process the results. However, this "protected mode buffer" isn't initialized specifically - after all, after the call the content of the "real mode buffer" is copied into the protected mode buffer. The real mode buffer had been initialized before the call, so in the end, the protected mode buffer should either contain whatever results the call wrote to the buffer, or it should contain the initialization content ('x' characters or NULs or whatever). Right?

Wrong. As Japheth said, the code was accidentally written so that it would only copy the buffer's contents from the real mode buffer to the protected mode buffer in case the call indicated success. If the call indicated failure, the protected mode buffer would never be initialized. VESA32's processing of the buffer contents would therefore read this uninitialized buffer.

 

Complete thread:

Back to the forum
Board view  Mix view
22762 Postings in 2122 Threads, 402 registered users (0 online)
DOS ain't dead | Admin contact
RSS Feed
powered by my little forum