Re: [AD] C/Asm integration (was [AD] Improvement on alphablending...)

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


On Sun, Aug 05, 2001 at 12:19:47AM +0100, Matthew Smith wrote:
> I don't understand why the frame buffer needs a new segment descriptor with
> this model, unless the memory management is tied to the PCI/AGP bus somehow,
> or is this just the way the Allegro drivers are written?
> If I understood this better I could help a lot more with the video drivers.

In two words: access rights.  The segment normally used for
cs,ds,es,ss has a finite limit, so while technically we can
specify any address in the 4Gb logical memory space as an offset
relative to the start of our segment (which is what all our
pointers are), we can't actually access it because it's past the
end of our segment.

There are basically two ways around this -- either we set our
segment limit to -1, which means disabled, or we ask DPMI for
another selector we can use to access the memory we want.  (Or
for the VGA memory at 0xa0000 we can use the DOS selector, which
djgpp already obtains.)

The one thing we must never do with this selector is leave it in
one of the segment registers during gcc-compiled code -- we
can't rely on the code generation.  C code wanting direct access
to bitmaps should use the bmp_select, bmp_write8, etc macros,
which handle the far pointer access in djgpp.  Outside djgpp (or
Watcom I guess), we never use this system anyway, so they just
become plain pointer-based reads and writes.

> The only way I can think of to pass %es into a C function is as a short, but
> then it wouldn't
> be a pure C function because it is processor specific. ?!

DOS only works on one processor, and other platforms don't need
to deal with this. :)

George

-- 
Random project update:
07/06/2001: Libnet 0.10.9 uploaded -- 13 months after 0.10.8!  Oops.
        http://www.canvaslink.com/libnet/  (try changes-0.10.9.txt)



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/