FreeBSD/sys/contrib/dev/acpica/components/executer/exoparg2.c
/*******************************************************************************
 *
 * FUNCTION:    AcpiExOpcode_2A_2T_1R
 *
 * PARAMETERS:  WalkState           - Current walk state
 *
 * RETURN:      Status
 *
 * DESCRIPTION: Execute a dyadic operator (2 operands) with 2 output targets
 *              and one implicit return value.
 *
 ******************************************************************************/
AcpiExOpcode_2A_2T_1R
PARAMETERS:  WalkState           - Current walk state

Status

Execute a dyadic operator (2 operands) with 2 output targets
and one implicit return value.
AcpiExOpcode_2A_2T_1R PARAMETERS : WalkState - Current walk state Status Execute a dyadic operator ( 2 operands ) with 2 output targets and one implicit return value .
ACPI_STATUS
AcpiExOpcode_2A_2T_1R (
    ACPI_WALK_STATE         *WalkState)
{
    ACPI_OPERAND_OBJECT     **Operand = &WalkState->Operands[0];
    ACPI_OPERAND_OBJECT     *ReturnDesc1 = NULL;
    ACPI_OPERAND_OBJECT     *ReturnDesc2 = NULL;
    ACPI_STATUS             Status;
    ACPI_FUNCTION_TRACE_STR (ExOpcode_2A_2T_1R,
        AcpiPsGetOpcodeName (WalkState->Opcode));
    switch (WalkState->Opcode)
    {
    case AML_DIVIDE_OP:
        ReturnDesc1 = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER);
        if (!ReturnDesc1)
        {
            Status = AE_NO_MEMORY;
            goto Cleanup;
        }
        ReturnDesc2 = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER);
        if (!ReturnDesc2)
        {
            Status = AE_NO_MEMORY;
            goto Cleanup;
        }
        Status = AcpiUtDivide (
            Operand[0]->Integer.Value,
            Operand[1]->Integer.Value,
            &ReturnDesc1->Integer.Value,
            &ReturnDesc2->Integer.Value);
        if (ACPI_FAILURE (Status))
        {
            goto Cleanup;
        }
        break;
    default:
        ACPI_ERROR ((AE_INFO, "Unknown AML opcode 0x%X",
            WalkState->Opcode));
        Status = AE_AML_BAD_OPCODE;
        goto Cleanup;
    }
    Status = AcpiExStore (ReturnDesc2, Operand[2], WalkState);
    if (ACPI_FAILURE (Status))
    {
        goto Cleanup;
    }
    Status = AcpiExStore (ReturnDesc1, Operand[3], WalkState);
    if (ACPI_FAILURE (Status))
    {
        goto Cleanup;
    }
Cleanup:
    AcpiUtRemoveReference (ReturnDesc2);
    if (ACPI_FAILURE (Status))
    {
        AcpiUtRemoveReference (ReturnDesc1);
    }
    else
    {
        WalkState->ResultObj = ReturnDesc1;
    }
    return_ACPI_STATUS (Status);
}
ACPI_STATUS AcpiExOpcode_2A_2T_1R ( ACPI_WALK_STATE * WalkState ) { ACPI_OPERAND_OBJECT * * Operand = & WalkState -> Operands [ 0 ] ; ACPI_OPERAND_OBJECT * ReturnDesc1 = NULL ; ACPI_OPERAND_OBJECT * ReturnDesc2 = NULL ; ACPI_STATUS Status ; ACPI_FUNCTION_TRACE_STR ( ExOpcode_2A_2T_1R , AcpiPsGetOpcodeName ( WalkState -> Opcode ) ) ; switch ( WalkState -> Opcode ) { case AML_DIVIDE_OP : ReturnDesc1 = AcpiUtCreateInternalObject ( ACPI_TYPE_INTEGER ) ; if ( ! ReturnDesc1 ) { Status = AE_NO_MEMORY ; goto Cleanup ; } ReturnDesc2 = AcpiUtCreateInternalObject ( ACPI_TYPE_INTEGER ) ; if ( ! ReturnDesc2 ) { Status = AE_NO_MEMORY ; goto Cleanup ; } Status = AcpiUtDivide ( Operand [ 0 ] -> Integer . Value , Operand [ 1 ] -> Integer . Value , & ReturnDesc1 -> Integer . Value , & ReturnDesc2 -> Integer . Value ) ; if ( ACPI_FAILURE ( Status ) ) { goto Cleanup ; } break ; default : ACPI_ERROR ( ( AE_INFO , " " , WalkState -> Opcode ) ) ; Status = AE_AML_BAD_OPCODE ; goto Cleanup ; } Status = AcpiExStore ( ReturnDesc2 , Operand [ 2 ] , WalkState ) ; if ( ACPI_FAILURE ( Status ) ) { goto Cleanup ; } Status = AcpiExStore ( ReturnDesc1 , Operand [ 3 ] , WalkState ) ; if ( ACPI_FAILURE ( Status ) ) { goto Cleanup ; } Cleanup : AcpiUtRemoveReference ( ReturnDesc2 ) ; if ( ACPI_FAILURE ( Status ) ) { AcpiUtRemoveReference ( ReturnDesc1 ) ; } else { WalkState -> ResultObj = ReturnDesc1 ; } return_ACPI_STATUS ( Status ) ; }
FUNCTION:    AcpiExOpcode_2A_2T_1R
 PARAMETERS:  WalkState           - Current walk state
FUNCTION : AcpiExOpcode_2A_2T_1R PARAMETERS : WalkState - Current walk state
/* Execute the opcode */ /* Divide (Dividend, Divisor, RemainderResult QuotientResult) */ /* Quotient to ReturnDesc1, remainder to ReturnDesc2 */ /* Store the results to the target reference operands */ /*
     * Since the remainder is not returned indirectly, remove a reference to
     * it. Only the quotient is returned indirectly.
     */ /* Delete the return object */ /* Save return object (the remainder) on success */