acpi_integer operand1)
{
+ ACPI_FUNCTION_ENTRY ();
+
switch (opcode) {
case AML_ADD_OP: /* Add (Operand0, Operand1, Result) */
* FUNCTION: acpi_ex_do_logical_op
*
* PARAMETERS: Opcode - AML opcode
- * Operand0 - Integer operand #0
- * Operand1 - Integer operand #1
+ * obj_desc0 - operand #0
+ * obj_desc1 - operand #1
*
* RETURN: TRUE/FALSE result of the operation
*
* DESCRIPTION: Execute a logical AML opcode. The purpose of having all of the
* functions here is to prevent a lot of pointer dereferencing
* to obtain the operands and to simplify the generation of the
- * logical value.
+ * logical value. Both operands must already be validated as
+ * 1) Both the same type, and
+ * 2) Either Integer, Buffer, or String type.
*
* Note: cleanest machine code seems to be produced by the code
* below, rather than using statements of the form:
u8
acpi_ex_do_logical_op (
u16 opcode,
- acpi_integer operand0,
- acpi_integer operand1)
+ union acpi_operand_object *obj_desc0,
+ union acpi_operand_object *obj_desc1)
{
+ acpi_integer operand0;
+ acpi_integer operand1;
+ u8 *ptr0;
+ u8 *ptr1;
+ u32 length0;
+ u32 length1;
+ u32 i;
- switch (opcode) {
+ ACPI_FUNCTION_ENTRY ();
- case AML_LAND_OP: /* LAnd (Operand0, Operand1) */
- if (operand0 && operand1) {
- return (TRUE);
- }
- break;
+ if (ACPI_GET_OBJECT_TYPE (obj_desc0) == ACPI_TYPE_INTEGER) {
+ /* Both operands are of type integer */
+ operand0 = obj_desc0->integer.value;
+ operand1 = obj_desc1->integer.value;
- case AML_LEQUAL_OP: /* LEqual (Operand0, Operand1) */
+ switch (opcode) {
+ case AML_LAND_OP: /* LAnd (Operand0, Operand1) */
- if (operand0 == operand1) {
- return (TRUE);
- }
- break;
+ if (operand0 && operand1) {
+ return (TRUE);
+ }
+ break;
+ case AML_LEQUAL_OP: /* LEqual (Operand0, Operand1) */
- case AML_LGREATER_OP: /* LGreater (Operand0, Operand1) */
+ if (operand0 == operand1) {
+ return (TRUE);
+ }
+ break;
- if (operand0 > operand1) {
- return (TRUE);
- }
- break;
+ case AML_LGREATER_OP: /* LGreater (Operand0, Operand1) */
+ if (operand0 > operand1) {
+ return (TRUE);
+ }
+ break;
- case AML_LLESS_OP: /* LLess (Operand0, Operand1) */
+ case AML_LLESS_OP: /* LLess (Operand0, Operand1) */
- if (operand0 < operand1) {
- return (TRUE);
+ if (operand0 < operand1) {
+ return (TRUE);
+ }
+ break;
+
+ case AML_LOR_OP: /* LOr (Operand0, Operand1) */
+
+ if (operand0 || operand1) {
+ return (TRUE);
+ }
+ break;
+
+ default:
+ break;
}
- break;
+ }
+ else {
+ /*
+ * Case for Buffer/String objects.
+ * NOTE: takes advantage of common Buffer/String object fields
+ */
+ length0 = obj_desc0->buffer.length;
+ ptr0 = obj_desc0->buffer.pointer;
+ length1 = obj_desc1->buffer.length;
+ ptr1 = obj_desc1->buffer.pointer;
- case AML_LOR_OP: /* LOr (Operand0, Operand1) */
+ switch (opcode) {
+ case AML_LEQUAL_OP: /* LEqual (Operand0, Operand1) */
- if (operand0 || operand1) {
+ /* Length and all bytes must be equal */
+
+ if (length0 != length1) {
+ return (FALSE);
+ }
+
+ for (i = 0; i < length0; i++) {
+ if (ptr0[i] != ptr1[i]) {
+ return (FALSE);
+ }
+ }
return (TRUE);
- }
- break;
- default:
- break;
+ case AML_LGREATER_OP: /* LGreater (Operand0, Operand1) */
+
+ /* Check lengths first */
+
+ if (length0 > length1) {
+ return (TRUE);
+ }
+ else if (length0 < length1) {
+ return (FALSE);
+ }
+
+ /* Lengths equal, now scan the data */
+
+ for (i = 0; i < length0; i++) {
+ if (ptr0[i] > ptr1[i]) {
+ return (TRUE);
+ }
+ }
+ return (FALSE);
+
+ case AML_LLESS_OP: /* LLess (Operand0, Operand1) */
+
+ /* Check lengths first */
+
+ if (length0 < length1) {
+ return (TRUE);
+ }
+ else if (length0 > length1) {
+ return (FALSE);
+ }
+
+ /* Lengths equal, now scan the data */
+
+ for (i = 0; i < length0; i++) {
+ if (ptr0[i] < ptr1[i]) {
+ return (TRUE);
+ }
+ }
+ return (FALSE);
+
+ default:
+ break;
+ }
}
return (FALSE);
#define ARGI_CREATE_FIELD_OP ARGI_LIST4 (ARGI_BUFFER, ARGI_INTEGER, ARGI_INTEGER, ARGI_REFERENCE)
#define ARGI_CREATE_QWORD_FIELD_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_REFERENCE)
#define ARGI_CREATE_WORD_FIELD_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_REFERENCE)
-#define ARGI_DATA_REGION_OP ARGI_LIST3 (ARGI_STRING, ARGI_STRING, ARGI_STRING)
+#define ARGI_DATA_REGION_OP ARGI_LIST3 (ARGI_STRING, ARGI_STRING, ARGI_STRING)
#define ARGI_DEBUG_OP ARG_NONE
#define ARGI_DECREMENT_OP ARGI_LIST1 (ARGI_INTEGER_REF)
#define ARGI_DEREF_OF_OP ARGI_LIST1 (ARGI_REF_OR_STRING)
#define ARGI_INDEX_FIELD_OP ARGI_INVALID_OPCODE
#define ARGI_INDEX_OP ARGI_LIST3 (ARGI_COMPLEXOBJ, ARGI_INTEGER, ARGI_TARGETREF)
#define ARGI_LAND_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_INTEGER)
-#define ARGI_LEQUAL_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_INTEGER)
-#define ARGI_LGREATER_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_INTEGER)
+#define ARGI_LEQUAL_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_COMPUTEDATA)
+#define ARGI_LGREATER_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_COMPUTEDATA)
#define ARGI_LGREATEREQUAL_OP ARGI_INVALID_OPCODE
-#define ARGI_LLESS_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_INTEGER)
+#define ARGI_LLESS_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_COMPUTEDATA)
#define ARGI_LLESSEQUAL_OP ARGI_INVALID_OPCODE
#define ARGI_LNOT_OP ARGI_LIST1 (ARGI_INTEGER)
#define ARGI_LNOTEQUAL_OP ARGI_INVALID_OPCODE
*
* FUNCTION: acpi_ut_initialize_buffer
*
- * PARAMETERS: required_length - Length needed
- * Buffer - Buffer to be validated
+ * PARAMETERS: Buffer - Buffer to be validated
+ * required_length - Length needed
*
* RETURN: Status
*
*
* FUNCTION: acpi_ut_find_allocation
*
- * PARAMETERS: Allocation - Address of allocated memory
+ * PARAMETERS: list_id - Memory list to search
+ * Allocation - Address of allocated memory
*
* RETURN: A list element if found; NULL otherwise.
*
*
* FUNCTION: acpi_ut_track_allocation
*
- * PARAMETERS: Allocation - Address of allocated memory
+ * PARAMETERS: list_id - Memory list to search
+ * Allocation - Address of allocated memory
* Size - Size of the allocation
* alloc_type - MEM_MALLOC or MEM_CALLOC
* Component - Component type of caller
*
* FUNCTION: acpi_ut_remove_allocation
*
- * PARAMETERS: Allocation - Address of allocated memory
+ * PARAMETERS: list_id - Memory list to search
+ * Allocation - Address of allocated memory
* Component - Component type of caller
* Module - Source file name of caller
* Line - Line number of caller