Memory map
  • Priest of the Order of the Butterfly
    Priest of the Order of the Butterfly
    ausPPC
    Posts: 543 from 2007/8/6
    From: Pending...
    After going through some of the documentation available to me I'm still unsure about how a program can discover the upper and lower limits of system memory. On Pegasos, Efika and Mac, is system memory in a contiguous range? Or is it still broken up as on 68k Amigas?

    While I'm asking technical questions, I'm also lacking information on the structure of segments - as in LoadSeg() segments. Is it still the case that NewLoadSeg() and InternalLoadSeg() only have tags as a yet to be implemented feature?
    PPC assembly ain't so bad... ;)
  • »12.01.11 - 11:04
    Profile Visit Website
  • Yokemate of Keyboards
    Yokemate of Keyboards
    Andreas_Wolf
    Posts: 12080 from 2003/5/22
    From: Germany
    > On Pegasos, Efika and Mac, is system memory in a contiguous range?
    > Or is it still broken up as on 68k Amigas?

    I guess that article could shed some light:

    http://library.morph.zone/In-depth:_The_New_MorphOS_Memory_System
    https://morph.zone/modules/news/article.php?storyid=1598
  • »12.01.11 - 12:33
    Profile
  • MorphOS Developer
    Piru
    Posts: 576 from 2003/2/24
    From: finland, the l...
    Quote:

    After going through some of the documentation available to me I'm still unsure about how a program can discover the upper and lower limits of system memory. On Pegasos, Efika and Mac, is system memory in a contiguous range? Or is it still broken up as on 68k Amigas?

    It can be broken up (although in practice it mostly is single contiguois chunk). You can Forbid() and walk thru MemList in execbase. Note however that there is a fake chipmem struct MemHeader entry there that must be skipped. mh_Lower and mh_Upper designate the beginning and the end of the memory area.

    Quote:

    While I'm asking technical questions, I'm also lacking information on the structure of segments - as in LoadSeg() segments.

    Basically each segment appears as:
    Code:

    offset type description
    -4 ULONG chunk allocation size
    0 BPTR next BPTR pointer or 0
    4 ... data

    The hunks are chained with the next BPTR pointers. The last hunk has 0 next pointer. This is exactly the same as with amigaos 68k.

    When executing code the first segment is jumped into in 68k mode. For PowerUP and native MorphOS applications there is a small stub hunk that gates the execution to PPC mode.

    Quote:

    Is it still the case that NewLoadSeg() and InternalLoadSeg() only have tags as a yet to be implemented feature?

    There are no tags defined. Finer control on loading elf objects can be gained by using objdata.library (although documentation on this subject is most likely lacking).

    [ Edited by Piru on 2011/1/12 15:07 ]
  • »12.01.11 - 13:05
    Profile