core/win32/os.c
/* returns osprot flags preserving all native protection flags except
 * for RWX, which are replaced according to memprot */
returns osprot flags preserving all native protection flags except
for RWX, which are replaced according to memprot
returns osprot flags preserving all native protection flags except for RWX which are replaced according to memprot
uint
osprot_replace_memprot(uint old_osprot, uint memprot)
{
    uint old_qualifiers = 
        old_osprot & PAGE_PROTECTION_QUALIFIERS;
    uint new_osprot = memprot_to_osprot(memprot);
    if (prot_is_copyonwrite(old_osprot) && prot_is_writable(new_osprot))
        new_osprot = osprot_add_writecopy(new_osprot);
    new_osprot |= old_qualifiers;
    return new_osprot;
}
uint osprot_replace_memprot ( uint old_osprot , uint memprot ) { uint old_qualifiers = old_osprot & PAGE_PROTECTION_QUALIFIERS ; uint new_osprot = memprot_to_osprot ( memprot ) ; if ( prot_is_copyonwrite ( old_osprot ) && prot_is_writable ( new_osprot ) ) new_osprot = osprot_add_writecopy ( new_osprot ) ; new_osprot |= old_qualifiers ; return new_osprot ; }
returns osprot flags preserving all native protection flags except
 for RWX, which are replaced according to memprot
returns osprot flags preserving all native protection flags except for RWX which are replaced according to memprot
/* preserve any old WRITECOPY 'flag' if page hasn't been touched */