Operating Systems/OS_Assg2_pipes-main/myexpos/xsm/machine.c
int machine_execute_instruction(int opcode)
{
    switch (opcode)
    {
    case MOV:
    case PORT:
        machine_execute_mov();
        break;

    case ADD:
    case SUB:
    case MUL:
    case DIV:
    case MOD:
        machine_execute_arith(opcode);
        break;

    case INR:
    case DCR:
        machine_execute_unary(opcode);
        break;

    case LT:
    case GT:
    case EQ:
    case NE:
    case GE:
    case LE:
        machine_execute_logical(opcode);
        break;

    case JZ:
    case JNZ:
    case JMP:
        machine_execute_jump(opcode);
        break;

    case PUSH:
    case POP:
        machine_execute_stack(opcode);
        break;

    case CALL:
        machine_execute_call();
        break;

    case RET:
        machine_execute_ret();
        break;

    case BRKP:
        machine_execute_brkp();
        break;

    case INT:
        machine_execute_interrupt();
        break;

    case LOAD:
        machine_execute_disk(XSM_DISKOP_LOAD, FALSE);
        break;

    case LOADI:
        machine_execute_disk(XSM_DISKOP_LOAD, TRUE);
        break;

    case STORE:
        machine_execute_disk(XSM_DISKOP_STORE, FALSE);
        break;

    case ENCRYPT:
        machine_execute_encrypt();
        break;

    case BACKUP:
        machine_execute_backup();
        break;

    case RESTORE:
        machine_execute_restore();
        break;

    case IN:
        machine_schedule_in(_theoptions.console);
        break;

    case INI:
        machine_execute_ini();
        break;

    case OUT:
        machine_execute_print();
        break;

    case IRET:
        machine_execute_iret();
        break;

    case HALT:
        return XSM_HALT;

    case NOP:
        // Do nothing
        break;
    }

    return TRUE;
}
/* Call the function based on the given opcode */
Call the function based on the given opcode
Call the function based on the given opcode
int machine_execute_instruction(int opcode)
{
    switch (opcode)
    {
    case MOV:
    case PORT:
        machine_execute_mov();
        break;
    case ADD:
    case SUB:
    case MUL:
    case DIV:
    case MOD:
        machine_execute_arith(opcode);
        break;
    case INR:
    case DCR:
        machine_execute_unary(opcode);
        break;
    case LT:
    case GT:
    case EQ:
    case NE:
    case GE:
    case LE:
        machine_execute_logical(opcode);
        break;
    case JZ:
    case JNZ:
    case JMP:
        machine_execute_jump(opcode);
        break;
    case PUSH:
    case POP:
        machine_execute_stack(opcode);
        break;
    case CALL:
        machine_execute_call();
        break;
    case RET:
        machine_execute_ret();
        break;
    case BRKP:
        machine_execute_brkp();
        break;
    case INT:
        machine_execute_interrupt();
        break;
    case LOAD:
        machine_execute_disk(XSM_DISKOP_LOAD, FALSE);
        break;
    case LOADI:
        machine_execute_disk(XSM_DISKOP_LOAD, TRUE);
        break;
    case STORE:
        machine_execute_disk(XSM_DISKOP_STORE, FALSE);
        break;
    case ENCRYPT:
        machine_execute_encrypt();
        break;
    case BACKUP:
        machine_execute_backup();
        break;
    case RESTORE:
        machine_execute_restore();
        break;
    case IN:
        machine_schedule_in(_theoptions.console);
        break;
    case INI:
        machine_execute_ini();
        break;
    case OUT:
        machine_execute_print();
        break;
    case IRET:
        machine_execute_iret();
        break;
    case HALT:
        return XSM_HALT;
    case NOP:
        break;
    }
    return TRUE;
}
int machine_execute_instruction ( int opcode ) { switch ( opcode ) { case MOV : case PORT : machine_execute_mov ( ) ; break ; case ADD : case SUB : case MUL : case DIV : case MOD : machine_execute_arith ( opcode ) ; break ; case INR : case DCR : machine_execute_unary ( opcode ) ; break ; case LT : case GT : case EQ : case NE : case GE : case LE : machine_execute_logical ( opcode ) ; break ; case JZ : case JNZ : case JMP : machine_execute_jump ( opcode ) ; break ; case PUSH : case POP : machine_execute_stack ( opcode ) ; break ; case CALL : machine_execute_call ( ) ; break ; case RET : machine_execute_ret ( ) ; break ; case BRKP : machine_execute_brkp ( ) ; break ; case INT : machine_execute_interrupt ( ) ; break ; case LOAD : machine_execute_disk ( XSM_DISKOP_LOAD , FALSE ) ; break ; case LOADI : machine_execute_disk ( XSM_DISKOP_LOAD , TRUE ) ; break ; case STORE : machine_execute_disk ( XSM_DISKOP_STORE , FALSE ) ; break ; case ENCRYPT : machine_execute_encrypt ( ) ; break ; case BACKUP : machine_execute_backup ( ) ; break ; case RESTORE : machine_execute_restore ( ) ; break ; case IN : machine_schedule_in ( _theoptions . console ) ; break ; case INI : machine_execute_ini ( ) ; break ; case OUT : machine_execute_print ( ) ; break ; case IRET : machine_execute_iret ( ) ; break ; case HALT : return XSM_HALT ; case NOP : break ; } return TRUE ; }
Call the function based on the given opcode
Call the function based on the given opcode
// Do nothing