This is the mail archive of the ecos-discuss@sourceware.org mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Software interrupt


>>>>> "Antoine" == Antoine Amirault <Antoine.Amirault@esial.uhp-nancy.fr> writes:

    Antoine> Hello,
    Antoine> First, thank you for answer.

    Antoine> I studied the question : how to switch in real mode ? but
    Antoine> it seems to be hardest than switching into protected
    Antoine> mode. I found a trick about real mode : when CPU is in
    Antoine> protected mode, we have to save all CPU registers and
    Antoine> reset it. Is it normal to be obliged to do this kind of
    Antoine> operation ?

    Antoine> I've an other idea, but it's very brutal : it's to do the
    Antoine> work of the 0x10 interruption, and go write directly in
    Antoine> the VGA control registers. I suppose this works, but it's
    Antoine> very heavy to do.

    Antoine> I read and read again the eCos documentation, but I don't
    Antoine> undestand if there's any function or macro (using HAL or
    Antoine> kernel functions) allowing me to emit software
    Antoine> interruption rather than using ASM.

    Antoine> An other question, CPU isn't supposed to start in real
    Antoine> mode ? If this is wrong, it's seems to be very hard to
    Antoine> come back in real mode ! It's strange to go write
    Antoine> directly in CPU or VGA card register, i think (hope) that
    Antoine> there's some methods doing this difficult job.

    Antoine> My aim is simply to display pixel on screen, by all way.
    Antoine> this one of my ideas, if you have another one, fell free
    Antoine> to explain it

There are a number of ways to approach this, but none of them are
straightforward.

The int10 video bios calls can only be made in 16-bit real mode. eCos
runs in 32-bit protected mode, so cannot access the video bios
directly. If you must invoke int10 then there are two approaches:

  1) set up a 16-bit virtual machine within the 32-bit protected mode
     and use that to invoke the video bios. This is hard, not to
     mention nearly impossible to debug. You will need to study some
     books like Mindshare's "Protected Mode Software Architecture" and
     maybe a couple of others in the series to understand what is
     involved. Linux already has code to do this and BSD may have as
     well, but eCos does not. Before trying to use any existing code
     you will want to check licensing issues, e.g. I suspect the Linux
     code will be vanilla GPL.

  2) an alternative way of running the 16-bit video bios code would be
     to include an x86 instruction set simulator in your application
     and execute the bios call inside the simulator. I suspect there
     is some suitable code out there already, dosbox may be worth a
     look.

The next approach is to try to access the video bios in 32-bit
protected mode. In theory this is supposed to be supported by modern
graphics cards, but when I tried it back in 2002 it did not work on
the card I was using. You may have more luck nowadays, depending on
the vintage of your graphics card. If you want to investigate further,
a starting place is http://en.wikipedia.org/wiki/VESA_BIOS_Extensions

A third approach is to access VGA hardware directly. Unfortunately the
VGA standard is probably one of the most convoluted hardware designs
ever. You will probably need a book like Ferraro's "Programmer's Guide
to the EGA and VGA Cards" to make any sense at all out of the
hardware. You will probably want to concentrate on mode 13, giving you
a 320x240 8bpp paletted display. Again you should be able to find
existing code for this. If you need a higher resolution then you are
going to need code specific to your graphics card, and you may find it
difficult to get hold of the required documentation.

Another approach is to use the existing configuration option
CYGNUM_HAL_I386_PC_STARTUP_VIDEO_MODE. The idea here is that a very
small part of RedBoot still runs in 16-bit real mode, prior to
switching to 32-bit protected mode, so that code can make an int10
video bios call. If you rebuild RedBoot with that option enabled and
set to a suitable mode, when you next reboot the PC using that RedBoot
the display should be set appropriately and an application run on top
of RedBoot can access it. Exactly what video modes are available and
the layout and location of display memory will depend on your graphics
hardware, so some experimenting will be needed.

Bart

-- 
Bart Veer                                   eCos Configuration Architect
eCosCentric Limited    The eCos experts      http://www.ecoscentric.com/
Barnwell House, Barnwell Drive, Cambridge, UK.      Tel: +44 1223 245571
Registered in England and Wales: Reg No 4422071.

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]