int pp_check(int key, int pp, int nx)

{

    int access;



    /* Compute access rights */

    /* When pp is 3/7, the result is undefined. Set it to noaccess */

    access = 0;

    if (key == 0) {

        switch (pp) {

        case 0x0:

        case 0x1:

        case 0x2:

            access |= PAGE_WRITE;

            /* No break here */

        case 0x3:

        case 0x6:

            access |= PAGE_READ;

            break;

        }

    } else {

        switch (pp) {

        case 0x0:

        case 0x6:

            access = 0;

            break;

        case 0x1:

        case 0x3:

            access = PAGE_READ;

            break;

        case 0x2:

            access = PAGE_READ | PAGE_WRITE;

            break;

        }

    }

    if (nx == 0) {

        access |= PAGE_EXEC;

    }



    return access;

}

int pp_check(int key, int pp, int nx)

{

    int access;



    

    

    access = 0;

    if (key == 0) {

        switch (pp) {

        case 0x0:

        case 0x1:

        case 0x2:

            access |= PAGE_WRITE;

            

        case 0x3:

        case 0x6:

            access |= PAGE_READ;

            break;

        }

    } else {

        switch (pp) {

        case 0x0:

        case 0x6:

            access = 0;

            break;

        case 0x1:

        case 0x3:

            access = PAGE_READ;

            break;

        case 0x2:

            access = PAGE_READ | PAGE_WRITE;

            break;

        }

    }

    if (nx == 0) {

        access |= PAGE_EXEC;

    }



    return access;

}

int FUNC_0(int VAR_0, int VAR_1, int VAR_2)

{

    int VAR_3;



    

    

    VAR_3 = 0;

    if (VAR_0 == 0) {

        switch (VAR_1) {

        case 0x0:

        case 0x1:

        case 0x2:

            VAR_3 |= PAGE_WRITE;

            

        case 0x3:

        case 0x6:

            VAR_3 |= PAGE_READ;

            break;

        }

    } else {

        switch (VAR_1) {

        case 0x0:

        case 0x6:

            VAR_3 = 0;

            break;

        case 0x1:

        case 0x3:

            VAR_3 = PAGE_READ;

            break;

        case 0x2:

            VAR_3 = PAGE_READ | PAGE_WRITE;

            break;

        }

    }

    if (VAR_2 == 0) {

        VAR_3 |= PAGE_EXEC;

    }



    return VAR_3;

}

int FUNC_0(int VAR_0, int VAR_1, int VAR_2)
{ int VAR_3; VAR_3 = 0; if (VAR_0 == 0) { switch (VAR_1) { case 0x0:
case 0x1:
case 0x2:
VAR_3 |= PAGE_WRITE; case 0x3:
case 0x6:
VAR_3 |= PAGE_READ; break; } } else { switch (VAR_1) { case 0x0:
case 0x6:
VAR_3 = 0; break; case 0x1:
case 0x3:
VAR_3 = PAGE_READ; break; case 0x2:
VAR_3 = PAGE_READ | PAGE_WRITE; break; } } if (VAR_2 == 0) { VAR_3 |= PAGE_EXEC; } return VAR_3; }