Re: allocation of memory

new topic     » goto parent     » topic index » view thread      » older message » newer message

> No I was looking for a way to allocate a specificate location
>
> thanks irv
>
> Bernie Ryan

Perhaps you mean to convert a Physical Base Pointer into a Linear mapped
address... (isnt Protected Mode fun?) (not!)

lemme throw some machine code at ya... (this basically just calls an
interrupt, but using dos_interrupt absolutely will not work (dpmi service
calls don't seem to be available using that (Jacques Deschenes might
know more about this)))

constant linaddr = allocate(46)
poke(linaddr, {
    #60,                    --    0: pusha
    #BB,#00,#00,#00,#00,    --    1: mov ebx, PhysBasePtr (2)
    #89,#D9,                --    6: mov ecx, ebx
    #C1,#EB,#10,            --    8: shr ebx, 16
    #BE,#00,#00,#00,#00,    --    B: mov esi, Size (12)
    #89,#F7,                --   10: mov edi, esi
    #C1,#EE,#10,            --   12: shr esi, 16
    #B8,#00,#08,#00,#00,    --   15: mov eax, #800
    #CD,#31,                --   1A: int #31
    #C1,#E3,#10,            --   1C: shl ebx, 16
    #66,#89,#CB,            --   1F: mov bx, cx
    #89,#1D,#E2,#AF,#E4,#82,--   22: mov [@linear], ebx
    #61,                    --   28: popa
    #C3,                    --   29: ret
    #00,#00,#00,#00})       --   2A: linear: dd 0 (42)
poke4(linaddr + 36, linaddr + 42) -- @linear

poke4(linaddr + 2, PhysBasePtr)  ---- you supply these
poke4(linaddr + 12, Size)        -- (size in bytes)

call(linaddr)

your linear address = peek4(linaddr + 42)


What is this good for?  I've used it to get the VESA linear frame buffer,
perhaps it can be used to access other memory mapped devices...

Later dudez,
 _______  ______  _______  ______
[    _  \[    _ ][ _   _ ][    _ ]
[/| [_] |[/| [_\][/ | | \][/| [_\]
  |  ___/  |  _]    | |     |  _]
[\| [/]  [\| [_/] [\| |/] [\| [_/]
[_____]  [______] [_____] [______]
xseal at harborside.com  ICQ:13466657
http://www.harborside.com/home/x/xseal/euphoria/

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu