Memory Map (S390): Difference between revisions

Jump to navigation Jump to search
[unchecked revision][unchecked revision]
Content added Content deleted
No edit summary
m (Bot: Replace deprecated source tag with syntaxhighlight)
 
Line 2: Line 2:


== Detecting memory ==
== Detecting memory ==
<source lang="c">
<syntaxhighlight lang="c">
/* We are going to read in pairs of 1MiB and when we hit the memory limit we
/* We are going to read in pairs of 1MiB and when we hit the memory limit we
* will instantly catch the program exception and stop counting, then it's just
* will instantly catch the program exception and stop counting, then it's just
Line 26: Line 26:
return (size_t)probe;
return (size_t)probe;
}
}
</syntaxhighlight>
</source>


Now there needs to be a function to "catch" the exceptions recognized by the processor:
Now there needs to be a function to "catch" the exceptions recognized by the processor:
<source lang="c">
<syntaxhighlight lang="c">
/* Check if an address is valid - this only catches program exceptions to
/* Check if an address is valid - this only catches program exceptions to
* determine if it's valid or not */
* determine if it's valid or not */
Line 69: Line 69:
return r;
return r;
}
}
</syntaxhighlight>
</source>


Some C compilers are known to crash or even ABEND during compilation if addresses of labels are taken via the && operator, alternatively using direct high-level assembler syntax:
Some C compilers are known to crash or even ABEND during compilation if addresses of labels are taken via the && operator, alternatively using direct high-level assembler syntax:


<source lang="asm">
<syntaxhighlight lang="asm">
* HwCheckAddress
* HwCheckAddress
* IN:
* IN:
Line 114: Line 114:
DC A(AMBIT+CATCHPCR)
DC A(AMBIT+CATCHPCR)
TMPSAVE DS 1D
TMPSAVE DS 1D
</syntaxhighlight>
</source>


== See also ===
== See also ===