core/win32/os.c
/* translate platform independent protection bits to native flags */
translate platform independent protection bits to native flags
translate platform independent protection bits to native flags
int
memprot_to_osprot(uint prot)
{
    uint os_prot = 0;
    if (TEST(MEMPROT_EXEC, prot)) {
        if (!TEST(MEMPROT_READ, prot)) {
            ASSERT(!TEST(MEMPROT_WRITE, prot));
            os_prot = PAGE_EXECUTE;
        } else if (TEST(MEMPROT_WRITE, prot))
            os_prot = PAGE_EXECUTE_READWRITE;
        else
            os_prot = PAGE_EXECUTE_READ;
    } else if (TEST(MEMPROT_READ, prot)) {
        if (TEST(MEMPROT_WRITE, prot))
            os_prot = PAGE_READWRITE;
        else
            os_prot = PAGE_READONLY;
    } else
        os_prot = PAGE_NOACCESS;
    return os_prot;
}
int memprot_to_osprot ( uint prot ) { uint os_prot = 0 ; if ( TEST ( MEMPROT_EXEC , prot ) ) { if ( ! TEST ( MEMPROT_READ , prot ) ) { ASSERT ( ! TEST ( MEMPROT_WRITE , prot ) ) ; os_prot = PAGE_EXECUTE ; } else if ( TEST ( MEMPROT_WRITE , prot ) ) os_prot = PAGE_EXECUTE_READWRITE ; else os_prot = PAGE_EXECUTE_READ ; } else if ( TEST ( MEMPROT_READ , prot ) ) { if ( TEST ( MEMPROT_WRITE , prot ) ) os_prot = PAGE_READWRITE ; else os_prot = PAGE_READONLY ; } else os_prot = PAGE_NOACCESS ; return os_prot ; }
translate platform independent protection bits to native flags
translate platform independent protection bits to native flags