[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [MiNT] Memprot status on XaAES system window



Jo Even Skarstein wrote:

> On Wed, 2011-10-05 at 17:36 +0000, Helmut Karlowski wrote:
>
> > The memprot-test in XaAES is nothing complicated, it never failed for me.
>
> Your test doesn't look correct to me. This is your test:
>
> long has_mprot = Ssystem(S_OSFEATURES,0,0);
>
> int l = sprintf( s, sizeof(s)-1, xa_strings[RS_MEMPROT], has_mprot ?
> xa_strings[RS_ON] : xa_strings[RS_OFF] );
>
> Your test will always return RS_ON as long as the kernel is compiled
> with crypto support. From ssystem.h:
>
> /* A bitfield specifying the built-in system features.
>  * Each '1' means that the feature is present:
>  * ---
>  * 0 - memory protection support (1 = enabled)
>  * 1 - virtual memory support (1 = enabled)
>  * 2 - storage encryption (1 = supported)
>  * 3-31 reserved bits
>  * ---
>  */
>
> Your test should be:
>
> long has_mprot = (Ssystem(S_OSFEATURES,0,0) & 1);
>
> But I might be wrong. I often am when I try to be clever ;)

You might be right as well ;-)

I used the (outdated as I know now) documentation from newcalls.html:


---------------+--------------------------------------------------------------------------------------------------------
               | Returns a 32-bit positive value specifying the state of kernel features. Encoding:
               |
               |bits    meaning
 S_OSFEATURES  |----    -------
   (0x0007)    |0       memory protection (1 = turned on)
               |1       virtual memory (1 = turned on)
               |2-31    reserved for future usage
               |
               | This call has an informative purpose only and you cannot toggle anything with it.


As there is no VM I was too lazy. Fixed, thanks.


-Helmut