Added internal divide functions for 64-bit integer divide/modulo

date	2001.09.14.23.05.00;	author rmoore1;	state Exp;
This commit is contained in:
aystarik 2005-06-29 20:24:08 +00:00
parent 617fbcbcd5
commit ca94e68b64
3 changed files with 30 additions and 50 deletions

View File

@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acgcc.h - GCC specific defines, etc.
* $Revision: 1.9 $
* $Revision: 1.10 $
*
*****************************************************************************/
@ -185,6 +185,7 @@
#else /* DO IA32 */
#define COMPILER_DEPENDENT_UINT64 unsigned long long
#define ACPI_ASM_MACROS
#define causeinterrupt(level)
@ -231,6 +232,21 @@
:"=a"(Acq),"=c"(dummy):"c"(GLptr),"i"(~3L):"dx"); \
} while(0)
/*
* Math helper asm macros
*/
#define ACPI_DIV_64_BY_32(n_hi, n_lo, d32, q32, r32) \
asm("divl %2;" \
:"=a"(q32), "=d"(r32) \
:"r"(d32), \
"0"(n_hi), "1"(n_lo));
#define ACPI_SHIFT_RIGHT_64(n_hi, n_lo) \
asm("shrl $1,%1;" \
"rcrl $1,%2;");
/*! [End] no source code translation !*/
#endif /* IA 32 */

View File

@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: aclinux.h - OS specific defines, etc.
* $Revision: 1.16 $
* $Revision: 1.14 $
*
*****************************************************************************/
@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
* All rights reserved.
*
* 2. License
@ -133,8 +133,6 @@
#define strtoul simple_strtoul
#define ACPI_WBINVD wbinvd()
#else
#include <stdarg.h>

View File

@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acmsvc.h - VC specific defines, etc.
* $Revision: 1.12 $
* $Revision: 1.5 $
*
*****************************************************************************/
@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
* All rights reserved.
*
* 2. License
@ -117,56 +117,27 @@
#ifndef __ACMSVC_H__
#define __ACMSVC_H__
#define COMPILER_DEPENDENT_INT64 __int64
#define COMPILER_DEPENDENT_UINT64 unsigned __int64
#define COMPILER_DEPENDENT_UINT64 unsigned __int64
/*
* Calling conventions:
*
* ACPI_SYSTEM_XFACE - Interfaces to host OS (handlers, threads)
* ACPI_EXTERNAL_XFACE - External ACPI interfaces
* ACPI_INTERNAL_XFACE - Internal ACPI interfaces
* ACPI_INTERNAL_VAR_XFACE - Internal variable-parameter list interfaces
*/
#define ACPI_SYSTEM_XFACE __cdecl
#define ACPI_EXTERNAL_XFACE
#define ACPI_INTERNAL_XFACE
#define ACPI_INTERNAL_VAR_XFACE __cdecl
#ifndef _LINT
/*
* Math helper functions
*/
#define ACPI_DIV_64_BY_32(n_hi, n_lo, d32, q32, r32) \
{ \
__asm mov edx, n_hi \
__asm mov eax, n_lo \
__asm div d32 \
__asm mov q32, eax \
__asm mov r32, edx \
_asm mov edx, n_hi \
_asm mov eax, n_lo \
_asm div d32 \
_asm mov q32, eax \
_asm mov r32, edx \
}
#define ACPI_SHIFT_RIGHT_64(n_hi, n_lo) \
{ \
__asm shr n_hi, 1 \
__asm rcr n_lo, 1 \
}
#else
/* Fake versions to make lint happy */
#define ACPI_DIV_64_BY_32(n_hi, n_lo, d32, q32, r32) \
{ \
q32 = n_hi / d32; \
r32 = n_lo / d32; \
_asm shr n_hi, 1 \
_asm rcr n_lo, 1 \
}
#define ACPI_SHIFT_RIGHT_64(n_hi, n_lo) \
{ \
n_hi >>= 1; \
n_lo >>= 1; \
}
#endif
/* warn C4100: unreferenced formal parameter */
#pragma warning(disable:4100)
@ -177,10 +148,5 @@
/* warn C4706: assignment within conditional expression */
#pragma warning(disable:4706)
/* This macro is used to tag functions as "printf-like" because
* some compilers can catch printf format string problems. MSVC
* doesn't, so this is proprocessed away.
*/
#define ACPI_PRINTF_LIKE_FUNC
#endif /* __ACMSVC_H__ */