⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 exmisc.c

📁 Linux Kernel 2.6.9 for OMAP1710
💻 C
📖 第 1 页 / 共 2 页
字号:
		}		/* Concatenate the strings */		ACPI_STRCPY (new_buf, obj_desc1->string.pointer);		ACPI_STRCPY (new_buf + obj_desc1->string.length,				  obj_desc2->string.pointer);		/* Complete the String object initialization */		return_desc->string.pointer = new_buf;		return_desc->string.length = obj_desc1->string.length +				   obj_desc2->string.length;		break;	case ACPI_TYPE_BUFFER:		/* Result of two Buffers is a Buffer */		return_desc = acpi_ut_create_buffer_object (				   (acpi_size) obj_desc1->buffer.length +				   (acpi_size) obj_desc2->buffer.length);		if (!return_desc) {			return (AE_NO_MEMORY);		}		new_buf = (char *) return_desc->buffer.pointer;		/* Concatenate the buffers */		ACPI_MEMCPY (new_buf, obj_desc1->buffer.pointer,				  obj_desc1->buffer.length);		ACPI_MEMCPY (new_buf + obj_desc1->buffer.length, obj_desc2->buffer.pointer,				   obj_desc2->buffer.length);		break;	default:		/* Invalid object type, should not happen here */		ACPI_REPORT_ERROR (("Concat - invalid obj type: %X\n",				ACPI_GET_OBJECT_TYPE (obj_desc1)));		status = AE_AML_INTERNAL;		return_desc = NULL;	}	*actual_return_desc = return_desc;	return (AE_OK);cleanup:	acpi_ut_remove_reference (return_desc);	return (status);}/******************************************************************************* * * FUNCTION:    acpi_ex_do_math_op * * PARAMETERS:  Opcode              - AML opcode *              Operand0            - Integer operand #0 *              Operand1            - Integer operand #1 * * RETURN:      Integer result of the operation * * DESCRIPTION: Execute a math AML opcode. The purpose of having all of the *              math functions here is to prevent a lot of pointer dereferencing *              to obtain the operands. * ******************************************************************************/acpi_integeracpi_ex_do_math_op (	u16                             opcode,	acpi_integer                    operand0,	acpi_integer                    operand1){	ACPI_FUNCTION_ENTRY ();	switch (opcode) {	case AML_ADD_OP:                /* Add (Operand0, Operand1, Result) */		return (operand0 + operand1);	case AML_BIT_AND_OP:            /* And (Operand0, Operand1, Result) */		return (operand0 & operand1);	case AML_BIT_NAND_OP:           /* NAnd (Operand0, Operand1, Result) */		return (~(operand0 & operand1));	case AML_BIT_OR_OP:             /* Or (Operand0, Operand1, Result) */		return (operand0 | operand1);	case AML_BIT_NOR_OP:            /* NOr (Operand0, Operand1, Result) */		return (~(operand0 | operand1));	case AML_BIT_XOR_OP:            /* XOr (Operand0, Operand1, Result) */		return (operand0 ^ operand1);	case AML_MULTIPLY_OP:           /* Multiply (Operand0, Operand1, Result) */		return (operand0 * operand1);	case AML_SHIFT_LEFT_OP:         /* shift_left (Operand, shift_count, Result) */		return (operand0 << operand1);	case AML_SHIFT_RIGHT_OP:        /* shift_right (Operand, shift_count, Result) */		return (operand0 >> operand1);	case AML_SUBTRACT_OP:           /* Subtract (Operand0, Operand1, Result) */		return (operand0 - operand1);	default:		return (0);	}}/******************************************************************************* * * FUNCTION:    acpi_ex_do_logical_op * * PARAMETERS:  Opcode              - AML opcode *              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.  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: *                  Result = (Operand0 == Operand1); * ******************************************************************************/u8acpi_ex_do_logical_op (	u16                             opcode,	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;	ACPI_FUNCTION_ENTRY ();	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;		switch (opcode) {		case AML_LAND_OP:               /* LAnd (Operand0, Operand1) */			if (operand0 && operand1) {				return (TRUE);			}			break;		case AML_LEQUAL_OP:             /* LEqual (Operand0, Operand1) */			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) */			if (operand0 < operand1) {				return (TRUE);			}			break;		case AML_LOR_OP:                 /* LOr (Operand0, Operand1) */			if (operand0 || operand1) {				return (TRUE);			}			break;		default:			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;		switch (opcode) {		case AML_LEQUAL_OP:             /* LEqual (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);		case AML_LGREATER_OP:           /* LGreater (Operand0, Operand1) */			/* Lexicographic compare:  Scan the 1-to-1 data */			for (i = 0; (i < length0) && (i < length1); i++) {				if (ptr0[i] > ptr1[i]) {					return (TRUE);				}			}			/* Bytes match, now check lengths */			if (length0 > length1) {				return (TRUE);			}			/* Length0 <= Length1 */			return (FALSE);		case AML_LLESS_OP:              /* LLess (Operand0, Operand1) */			/* Lexicographic compare:  Scan the 1-to-1 data */			for (i = 0; (i < length0) && (i < length1); i++) {				if (ptr0[i] < ptr1[i]) {					return (TRUE);				}			}			/* Bytes match, now check lengths */			if (length0 < length1) {				return (TRUE);			}			/* Length0 >= Length1 */			return (FALSE);		default:			break;		}	}	return (FALSE);}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -