• Accessing physical addresses in protected mode

    From Johann 'Myrkraverk' Oskarsson@21:1/5 to All on Thu May 28 02:10:34 2020
    Dear c.o.m.programmer,

    How would I map a physical address into my process address space
    in an extended program? Specifically, CauseWay with OpenWatcom.

    I am experimenting with PCI device access. I am able to read the
    physical address from the config address space with the outpd()/
    inpd() functions; specifically d0000008 in my case (3Dfx Voodoo
    in DOSBox). And predictably, if I try it directly, I get an
    exception thrown.

    --
    Johann | email: invalid -> com | www.myrkraverk.com/blog/
    I'm not from the Internet, I just work there. | twitter: @myrkraverk

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Johann 'Myrkraverk' Oskarsson@21:1/5 to Johann 'Myrkraverk' Oskarsson on Thu May 28 03:10:31 2020
    On 28/05/2020 2:10 am, Johann 'Myrkraverk' Oskarsson wrote:
    Dear c.o.m.programmer,

    How would I map a physical address into my process address space
    in an extended program?  Specifically, CauseWay with OpenWatcom.

    I am experimenting with PCI device access.  I am able to read the
    physical address from the config address space with the outpd()/
    inpd() functions; specifically d0000008 in my case (3Dfx Voodoo
    in DOSBox).  And predictably, if I try it directly, I get an
    exception thrown.
    I figured this out. I use DPMI to convert the address. This is the
    code.

    union REGS registers = { 0 };
    registers.w.ax = 0x0800u;
    registers.w.bx = (uint32_t)bar >> 16u;
    registers.w.cx = (uint32_t)bar & 0xffffu;
    registers.w.si = 0x0100u; // 16MB according to the manual.
    registers.w.di = 0x0000u; // unnecessary.
    uint32_t error = int386( 0x31u, &registers, &registers );

    if ( registers.w.cflag ) {
    printf( "Error %08x\n", error );
    return error;
    }

    // Then the real pointer is in
    uint32_t *voodoo = registers.w.bx << 0x10u | registers.w.cx;


    --
    Johann | email: invalid -> com | www.myrkraverk.com/blog/
    I'm not from the Internet, I just work there. | twitter: @myrkraverk

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Johann 'Myrkraverk' Oskarsson@21:1/5 to T. Ment on Thu May 28 05:36:06 2020
    On 28/05/2020 5:21 am, T. Ment wrote:
    On Thu, 28 May 2020 03:10:31 +0800, Johann 'Myrkraverk' Oskarsson wrote:

    I am experimenting with PCI device access.  I am able to read the
    physical address from the config address space with the outpd()/
    inpd() functions; specifically d0000008 in my case (3Dfx Voodoo
    in DOSBox).  And predictably, if I try it directly, I get an
    exception thrown.

    I figured this out. I use DPMI to convert the address.

    Glad you worked it out, DOSBox and all. Curious about your goal.

    The original goal was to satisfy my need to poke hardware. Now that
    I've succeeded, I'm wondering if I can make it do something useful
    without going through drivers like Glide, for which some versions
    can be had on sourceforge, but I'm also reading the hardware manual
    of the voodoo card.

    Going from a hardware manual to /something useful/ isn't trivial, so
    I'll probably take a look at the Glide source code and/or try to instru-
    ment some games.

    I'm also attempting to get hold of a real 3Dfx voodoo, but I have no
    idea if that'll be successful, given the state of international shipping
    these days.


    --
    Johann | email: invalid -> com | www.myrkraverk.com/blog/
    I'm not from the Internet, I just work there. | twitter: @myrkraverk

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From T. Ment@21:1/5 to Johann 'Myrkraverk' Oskarsson on Wed May 27 21:21:13 2020
    On Thu, 28 May 2020 03:10:31 +0800, Johann 'Myrkraverk' Oskarsson wrote:

    I am experimenting with PCI device access.  I am able to read the
    physical address from the config address space with the outpd()/
    inpd() functions; specifically d0000008 in my case (3Dfx Voodoo
    in DOSBox).  And predictably, if I try it directly, I get an
    exception thrown.

    I figured this out. I use DPMI to convert the address.

    Glad you worked it out, DOSBox and all. Curious about your goal.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)