mirror of
https://github.com/acpica/acpica/
synced 2025-02-24 09:24:08 +03:00
Clib: Add -nostdinc support for EFI layer
This patch adds sprintf()/snprintf()/vsnprintf()/printf()/vfprintf() support for OSPMs that have ACPI_USE_SYSTEM_CLIBRARY defined but do not have ACPI_USE_STANDARD_HEADERS defined. This patch also converts the entire EFI porting layer to use the standard system Clibrary and implements GNU EFI specific standard Clibrary stdio operations. -fno-builtin is required for GCC to avoid optimization performed printf(). This optimization cannot be automatically disabled by specifying -nostdlib. Please refer to the Link 1 for the details. -iwithprefix include is required to include <stdarg.h> which contains compiler specific implementation of vargs. It is unclear why there is the vargs macros defined for OSPMs that do not have ACPI_USE_SYSTEM_CLIBRARY defined. After applying this patch, this special vargs implementation should also get deleted. Standard C header files shouldn't be included here and there throughout the entire ACPICA code base. This patch corrects some of them. Lv Zheng. Link 1: http://www.ciselant.de/projects/gcc_printf/gcc_printf.html Signed-off-by: Lv Zheng <lv.zheng@intel.com>
This commit is contained in:
parent
831b85c7b5
commit
70e4161656
@ -95,17 +95,23 @@ LD = ld
|
||||
OBJCOPY = objcopy
|
||||
|
||||
CFLAGS = \
|
||||
--save-temps\
|
||||
-nostdinc\
|
||||
-nostdlib\
|
||||
-std=c99\
|
||||
-U__linux__\
|
||||
-U_LINUX\
|
||||
-D_GNU_EFI\
|
||||
-D_GNU_SOURCE\
|
||||
-fno-builtin\
|
||||
-iwithprefix include\
|
||||
-fno-stack-protector\
|
||||
-fno-strict-aliasing\
|
||||
-fpic\
|
||||
-fshort-wchar\
|
||||
-I$(ACPICA_INCLUDE)
|
||||
LDFLAGS = \
|
||||
-nostdinc\
|
||||
-nostdlib\
|
||||
-znocombreloc\
|
||||
-Bsymbolic
|
||||
|
@ -38,8 +38,8 @@ OBJECTS = \
|
||||
$(OBJDIR)/tbxfroot.o\
|
||||
$(OBJDIR)/utascii.o\
|
||||
$(OBJDIR)/utbuffer.o\
|
||||
$(OBJDIR)/utdebug.o\
|
||||
$(OBJDIR)/utclib.o\
|
||||
$(OBJDIR)/utdebug.o\
|
||||
$(OBJDIR)/utexcep.o\
|
||||
$(OBJDIR)/utglobal.o\
|
||||
$(OBJDIR)/utmath.o\
|
||||
|
@ -118,7 +118,6 @@
|
||||
#include "acapps.h"
|
||||
#include "actables.h"
|
||||
#include "acutils.h"
|
||||
#include <errno.h>
|
||||
|
||||
#define _COMPONENT ACPI_UTILITIES
|
||||
ACPI_MODULE_NAME ("acfileio")
|
||||
@ -352,7 +351,7 @@ AcGetOneTableFromFile (
|
||||
|
||||
/* Allocate a buffer for the entire table */
|
||||
|
||||
Table = AcpiOsAllocate ((size_t) TableHeader.Length);
|
||||
Table = AcpiOsAllocate ((ACPI_SIZE) TableHeader.Length);
|
||||
if (!Table)
|
||||
{
|
||||
return (AE_NO_MEMORY);
|
||||
@ -460,7 +459,7 @@ AcValidateTableHeader (
|
||||
long TableOffset)
|
||||
{
|
||||
ACPI_TABLE_HEADER TableHeader;
|
||||
size_t Actual;
|
||||
ACPI_SIZE Actual;
|
||||
long OriginalOffset;
|
||||
UINT32 FileSize;
|
||||
UINT32 i;
|
||||
|
@ -119,8 +119,6 @@
|
||||
#include "acparser.h"
|
||||
#include "acdebug.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
/*
|
||||
* This is an os-independent implementation of line-editing services needed
|
||||
* by the AcpiExec utility. It uses getchar() and putchar() and the existing
|
||||
|
@ -116,7 +116,6 @@
|
||||
#include "acpi.h"
|
||||
#include "accommon.h"
|
||||
#include "acapps.h"
|
||||
#include <stdio.h>
|
||||
|
||||
#define _COMPONENT ACPI_TOOLS
|
||||
ACPI_MODULE_NAME ("cmfsize")
|
||||
|
@ -118,7 +118,6 @@
|
||||
#include "accommon.h"
|
||||
#include "acdebug.h"
|
||||
#include "actables.h"
|
||||
#include <stdio.h>
|
||||
#ifdef ACPI_APPLICATION
|
||||
#include "acapps.h"
|
||||
#endif
|
||||
|
@ -336,7 +336,7 @@ AcpiUtDumpBufferToFile (
|
||||
|
||||
if (!Buffer)
|
||||
{
|
||||
AcpiUtFilePrintf (File, "Null Buffer Pointer in DumpBuffer!\n");
|
||||
fprintf (File, "Null Buffer Pointer in DumpBuffer!\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -351,7 +351,7 @@ AcpiUtDumpBufferToFile (
|
||||
{
|
||||
/* Print current offset */
|
||||
|
||||
AcpiUtFilePrintf (File, "%6.4X: ", (BaseOffset + i));
|
||||
fprintf (File, "%6.4X: ", (BaseOffset + i));
|
||||
|
||||
/* Print 16 hex chars */
|
||||
|
||||
@ -361,7 +361,7 @@ AcpiUtDumpBufferToFile (
|
||||
{
|
||||
/* Dump fill spaces */
|
||||
|
||||
AcpiUtFilePrintf (File, "%*s", ((Display * 2) + 1), " ");
|
||||
fprintf (File, "%*s", ((Display * 2) + 1), " ");
|
||||
j += Display;
|
||||
continue;
|
||||
}
|
||||
@ -371,28 +371,28 @@ AcpiUtDumpBufferToFile (
|
||||
case DB_BYTE_DISPLAY:
|
||||
default: /* Default is BYTE display */
|
||||
|
||||
AcpiUtFilePrintf (File, "%02X ", Buffer[(ACPI_SIZE) i + j]);
|
||||
fprintf (File, "%02X ", Buffer[(ACPI_SIZE) i + j]);
|
||||
break;
|
||||
|
||||
case DB_WORD_DISPLAY:
|
||||
|
||||
ACPI_MOVE_16_TO_32 (&Temp32, &Buffer[(ACPI_SIZE) i + j]);
|
||||
AcpiUtFilePrintf (File, "%04X ", Temp32);
|
||||
fprintf (File, "%04X ", Temp32);
|
||||
break;
|
||||
|
||||
case DB_DWORD_DISPLAY:
|
||||
|
||||
ACPI_MOVE_32_TO_32 (&Temp32, &Buffer[(ACPI_SIZE) i + j]);
|
||||
AcpiUtFilePrintf (File, "%08X ", Temp32);
|
||||
fprintf (File, "%08X ", Temp32);
|
||||
break;
|
||||
|
||||
case DB_QWORD_DISPLAY:
|
||||
|
||||
ACPI_MOVE_32_TO_32 (&Temp32, &Buffer[(ACPI_SIZE) i + j]);
|
||||
AcpiUtFilePrintf (File, "%08X", Temp32);
|
||||
fprintf (File, "%08X", Temp32);
|
||||
|
||||
ACPI_MOVE_32_TO_32 (&Temp32, &Buffer[(ACPI_SIZE) i + j + 4]);
|
||||
AcpiUtFilePrintf (File, "%08X ", Temp32);
|
||||
fprintf (File, "%08X ", Temp32);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -403,29 +403,29 @@ AcpiUtDumpBufferToFile (
|
||||
* Print the ASCII equivalent characters but watch out for the bad
|
||||
* unprintable ones (printable chars are 0x20 through 0x7E)
|
||||
*/
|
||||
AcpiUtFilePrintf (File, " ");
|
||||
fprintf (File, " ");
|
||||
for (j = 0; j < 16; j++)
|
||||
{
|
||||
if (i + j >= Count)
|
||||
{
|
||||
AcpiUtFilePrintf (File, "\n");
|
||||
fprintf (File, "\n");
|
||||
return;
|
||||
}
|
||||
|
||||
BufChar = Buffer[(ACPI_SIZE) i + j];
|
||||
if (isprint (BufChar))
|
||||
{
|
||||
AcpiUtFilePrintf (File, "%c", BufChar);
|
||||
fprintf (File, "%c", BufChar);
|
||||
}
|
||||
else
|
||||
{
|
||||
AcpiUtFilePrintf (File, ".");
|
||||
fprintf (File, ".");
|
||||
}
|
||||
}
|
||||
|
||||
/* Done with that line. */
|
||||
|
||||
AcpiUtFilePrintf (File, "\n");
|
||||
fprintf (File, "\n");
|
||||
i += 16;
|
||||
}
|
||||
|
||||
|
@ -163,7 +163,7 @@
|
||||
ACPI_MODULE_NAME ("utclib")
|
||||
|
||||
|
||||
#ifndef ACPI_USE_SYSTEM_CLIBRARY /* Entire module */
|
||||
#if defined(ACPI_USE_SYSTEM_CLIBRARY) && !defined(ACPI_USE_STANDARD_HEADERS)
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
@ -987,4 +987,4 @@ const UINT8 AcpiGbl_Ctypes[257] = {
|
||||
};
|
||||
|
||||
|
||||
#endif /* ACPI_USE_SYSTEM_CLIBRARY */
|
||||
#endif /* ACPI_USE_SYSTEM_CLIBRARY && !ACPI_USE_STANDARD_HEADERS */
|
||||
|
@ -804,7 +804,7 @@ AcpiLogError (
|
||||
va_list Args;
|
||||
|
||||
va_start (Args, Format);
|
||||
(void) AcpiUtFileVprintf (ACPI_FILE_ERR, Format, Args);
|
||||
(void) vfprintf (ACPI_FILE_ERR, Format, Args);
|
||||
va_end (Args);
|
||||
}
|
||||
|
||||
|
@ -268,8 +268,6 @@ AcpiUtGetExpectedReturnTypes (
|
||||
******************************************************************************/
|
||||
|
||||
#if (defined ACPI_ASL_COMPILER || defined ACPI_HELP_APP)
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
/* Local prototypes */
|
||||
|
||||
|
@ -120,6 +120,8 @@
|
||||
ACPI_MODULE_NAME ("utprint")
|
||||
|
||||
|
||||
#if defined(ACPI_USE_SYSTEM_CLIBRARY) && !defined(ACPI_USE_STANDARD_HEADERS)
|
||||
|
||||
#define ACPI_FORMAT_SIGN 0x01
|
||||
#define ACPI_FORMAT_SIGN_PLUS 0x02
|
||||
#define ACPI_FORMAT_SIGN_PLUS_SPACE 0x04
|
||||
@ -488,7 +490,7 @@ AcpiUtFormatNumber (
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiUtVsnprintf
|
||||
* FUNCTION: vsnprintf
|
||||
*
|
||||
* PARAMETERS: String - String with boundary
|
||||
* Size - Boundary of the string
|
||||
@ -502,7 +504,7 @@ AcpiUtFormatNumber (
|
||||
******************************************************************************/
|
||||
|
||||
int
|
||||
AcpiUtVsnprintf (
|
||||
vsnprintf (
|
||||
char *String,
|
||||
ACPI_SIZE Size,
|
||||
const char *Format,
|
||||
@ -785,7 +787,7 @@ AcpiUtVsnprintf (
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiUtSnprintf
|
||||
* FUNCTION: snprintf
|
||||
*
|
||||
* PARAMETERS: String - String with boundary
|
||||
* Size - Boundary of the string
|
||||
@ -798,7 +800,7 @@ AcpiUtVsnprintf (
|
||||
******************************************************************************/
|
||||
|
||||
int
|
||||
AcpiUtSnprintf (
|
||||
snprintf (
|
||||
char *String,
|
||||
ACPI_SIZE Size,
|
||||
const char *Format,
|
||||
@ -809,7 +811,38 @@ AcpiUtSnprintf (
|
||||
|
||||
|
||||
va_start (Args, Format);
|
||||
Length = AcpiUtVsnprintf (String, Size, Format, Args);
|
||||
Length = vsnprintf (String, Size, Format, Args);
|
||||
va_end (Args);
|
||||
|
||||
return (Length);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: sprintf
|
||||
*
|
||||
* PARAMETERS: String - String with boundary
|
||||
* Format, ... - Standard printf format
|
||||
*
|
||||
* RETURN: Number of bytes actually written.
|
||||
*
|
||||
* DESCRIPTION: Formatted output to a string.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
int
|
||||
sprintf (
|
||||
char *String,
|
||||
const char *Format,
|
||||
...)
|
||||
{
|
||||
va_list Args;
|
||||
int Length;
|
||||
|
||||
|
||||
va_start (Args, Format);
|
||||
Length = vsnprintf (String, ACPI_UINT32_MAX, Format, Args);
|
||||
va_end (Args);
|
||||
|
||||
return (Length);
|
||||
@ -819,7 +852,69 @@ AcpiUtSnprintf (
|
||||
#ifdef ACPI_APPLICATION
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiUtFileVprintf
|
||||
* FUNCTION: vprintf
|
||||
*
|
||||
* PARAMETERS: Format - Standard printf format
|
||||
* Args - Argument list
|
||||
*
|
||||
* RETURN: Number of bytes actually written.
|
||||
*
|
||||
* DESCRIPTION: Formatted output to stdout using argument list pointer.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
int
|
||||
vprintf (
|
||||
const char *Format,
|
||||
va_list Args)
|
||||
{
|
||||
ACPI_CPU_FLAGS Flags;
|
||||
int Length;
|
||||
|
||||
|
||||
Flags = AcpiOsAcquireLock (AcpiGbl_PrintLock);
|
||||
Length = vsnprintf (AcpiGbl_PrintBuffer,
|
||||
sizeof (AcpiGbl_PrintBuffer), Format, Args);
|
||||
|
||||
(void) AcpiOsWriteFile (ACPI_FILE_OUT, AcpiGbl_PrintBuffer, Length, 1);
|
||||
AcpiOsReleaseLock (AcpiGbl_PrintLock, Flags);
|
||||
|
||||
return (Length);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: printf
|
||||
*
|
||||
* PARAMETERS: Format, ... - Standard printf format
|
||||
*
|
||||
* RETURN: Number of bytes actually written.
|
||||
*
|
||||
* DESCRIPTION: Formatted output to stdout.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
int
|
||||
printf (
|
||||
const char *Format,
|
||||
...)
|
||||
{
|
||||
va_list Args;
|
||||
int Length;
|
||||
|
||||
|
||||
va_start (Args, Format);
|
||||
Length = vprintf (Format, Args);
|
||||
va_end (Args);
|
||||
|
||||
return (Length);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: vfprintf
|
||||
*
|
||||
* PARAMETERS: File - File descriptor
|
||||
* Format - Standard printf format
|
||||
@ -832,8 +927,8 @@ AcpiUtSnprintf (
|
||||
******************************************************************************/
|
||||
|
||||
int
|
||||
AcpiUtFileVprintf (
|
||||
ACPI_FILE File,
|
||||
vfprintf (
|
||||
FILE *File,
|
||||
const char *Format,
|
||||
va_list Args)
|
||||
{
|
||||
@ -842,7 +937,7 @@ AcpiUtFileVprintf (
|
||||
|
||||
|
||||
Flags = AcpiOsAcquireLock (AcpiGbl_PrintLock);
|
||||
Length = AcpiUtVsnprintf (AcpiGbl_PrintBuffer,
|
||||
Length = vsnprintf (AcpiGbl_PrintBuffer,
|
||||
sizeof (AcpiGbl_PrintBuffer), Format, Args);
|
||||
|
||||
(void) AcpiOsWriteFile (File, AcpiGbl_PrintBuffer, Length, 1);
|
||||
@ -854,7 +949,7 @@ AcpiUtFileVprintf (
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiUtFilePrintf
|
||||
* FUNCTION: fprintf
|
||||
*
|
||||
* PARAMETERS: File - File descriptor
|
||||
* Format, ... - Standard printf format
|
||||
@ -866,8 +961,8 @@ AcpiUtFileVprintf (
|
||||
******************************************************************************/
|
||||
|
||||
int
|
||||
AcpiUtFilePrintf (
|
||||
ACPI_FILE File,
|
||||
fprintf (
|
||||
FILE *File,
|
||||
const char *Format,
|
||||
...)
|
||||
{
|
||||
@ -876,9 +971,10 @@ AcpiUtFilePrintf (
|
||||
|
||||
|
||||
va_start (Args, Format);
|
||||
Length = AcpiUtFileVprintf (File, Format, Args);
|
||||
Length = vfprintf (File, Format, Args);
|
||||
va_end (Args);
|
||||
|
||||
return (Length);
|
||||
}
|
||||
#endif
|
||||
#endif /* ACPI_USE_SYSTEM_CLIBRARY && !ACPI_USE_STANDARD_HEADERS */
|
||||
|
@ -116,12 +116,6 @@
|
||||
#ifndef _ACAPPS
|
||||
#define _ACAPPS
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef _MSC_VER /* disable some level-4 warnings */
|
||||
#pragma warning(disable:4100) /* warning C4100: unreferenced formal parameter */
|
||||
#endif
|
||||
|
||||
/* Common info for tool signons */
|
||||
|
||||
#define ACPICA_NAME "Intel ACPI Component Architecture"
|
||||
|
@ -236,4 +236,61 @@ int
|
||||
toupper (
|
||||
int c);
|
||||
|
||||
/*
|
||||
* utprint - printf/vprintf output functions
|
||||
*/
|
||||
const char *
|
||||
AcpiUtScanNumber (
|
||||
const char *String,
|
||||
UINT64 *NumberPtr);
|
||||
|
||||
const char *
|
||||
AcpiUtPrintNumber (
|
||||
char *String,
|
||||
UINT64 Number);
|
||||
|
||||
int
|
||||
vsnprintf (
|
||||
char *String,
|
||||
ACPI_SIZE Size,
|
||||
const char *Format,
|
||||
va_list Args);
|
||||
|
||||
int
|
||||
snprintf (
|
||||
char *String,
|
||||
ACPI_SIZE Size,
|
||||
const char *Format,
|
||||
...);
|
||||
|
||||
int
|
||||
sprintf (
|
||||
char *String,
|
||||
const char *Format,
|
||||
...);
|
||||
|
||||
#ifdef ACPI_APPLICATION
|
||||
int
|
||||
vprintf (
|
||||
const char *Format,
|
||||
va_list Args);
|
||||
|
||||
int
|
||||
printf (
|
||||
const char *Format,
|
||||
...);
|
||||
|
||||
int
|
||||
vfprintf (
|
||||
FILE *File,
|
||||
const char *Format,
|
||||
va_list Args);
|
||||
|
||||
int
|
||||
fprintf (
|
||||
FILE *File,
|
||||
const char *Format,
|
||||
...);
|
||||
#endif
|
||||
|
||||
#endif /* _ACCLIB_H */
|
||||
|
@ -131,9 +131,9 @@
|
||||
#include "acglobal.h" /* All global variables */
|
||||
#include "achware.h" /* Hardware defines and interfaces */
|
||||
#include "acutils.h" /* Utility interfaces */
|
||||
#ifndef ACPI_USE_SYSTEM_CLIBRARY
|
||||
#if defined(ACPI_USE_SYSTEM_CLIBRARY) && !defined(ACPI_USE_STANDARD_HEADERS)
|
||||
#include "acclib.h" /* C library interfaces */
|
||||
#endif /* !ACPI_USE_SYSTEM_CLIBRARY */
|
||||
#endif /* ACPI_USE_SYSTEM_CLIBRARY && !ACPI_USE_STANDARD_HEADERS */
|
||||
|
||||
|
||||
#endif /* __ACCOMMON_H__ */
|
||||
|
@ -1139,48 +1139,6 @@ AcpiAhMatchUuid (
|
||||
UINT8 *Data);
|
||||
|
||||
|
||||
/*
|
||||
* utprint - printf/vprintf output functions
|
||||
*/
|
||||
const char *
|
||||
AcpiUtScanNumber (
|
||||
const char *String,
|
||||
UINT64 *NumberPtr);
|
||||
|
||||
const char *
|
||||
AcpiUtPrintNumber (
|
||||
char *String,
|
||||
UINT64 Number);
|
||||
|
||||
int
|
||||
AcpiUtVsnprintf (
|
||||
char *String,
|
||||
ACPI_SIZE Size,
|
||||
const char *Format,
|
||||
va_list Args);
|
||||
|
||||
int
|
||||
AcpiUtSnprintf (
|
||||
char *String,
|
||||
ACPI_SIZE Size,
|
||||
const char *Format,
|
||||
...);
|
||||
|
||||
#ifdef ACPI_APPLICATION
|
||||
int
|
||||
AcpiUtFileVprintf (
|
||||
ACPI_FILE File,
|
||||
const char *Format,
|
||||
va_list Args);
|
||||
|
||||
int
|
||||
AcpiUtFilePrintf (
|
||||
ACPI_FILE File,
|
||||
const char *Format,
|
||||
...);
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* utuuid -- UUID support functions
|
||||
*/
|
||||
|
@ -116,12 +116,6 @@
|
||||
#ifndef __ACEFI_H__
|
||||
#define __ACEFI_H__
|
||||
|
||||
#include <stdarg.h>
|
||||
#if defined(_GNU_EFI)
|
||||
#include <stdint.h>
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#if defined(__x86_64__)
|
||||
#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7))
|
||||
#define USE_MS_ABI 1
|
||||
@ -136,16 +130,6 @@
|
||||
#define EFIAPI
|
||||
#endif
|
||||
|
||||
typedef uint8_t UINT8;
|
||||
typedef uint16_t UINT16;
|
||||
typedef int16_t INT16;
|
||||
typedef uint32_t UINT32;
|
||||
typedef int32_t INT32;
|
||||
typedef uint64_t UINT64;
|
||||
typedef int64_t INT64;
|
||||
typedef uint8_t BOOLEAN;
|
||||
typedef uint16_t CHAR16;
|
||||
|
||||
#define VOID void
|
||||
|
||||
#if defined(__ia64__) || defined(__x86_64__)
|
||||
@ -166,8 +150,8 @@ typedef uint16_t CHAR16;
|
||||
|
||||
#endif
|
||||
|
||||
typedef uint64_t UINTN;
|
||||
typedef int64_t INTN;
|
||||
#define UINTN uint64_t
|
||||
#define INTN int64_t
|
||||
|
||||
#define EFIERR(a) (0x8000000000000000 | a)
|
||||
|
||||
@ -176,13 +160,14 @@ typedef int64_t INTN;
|
||||
#define ACPI_MACHINE_WIDTH 32
|
||||
#define ACPI_USE_NATIVE_DIVIDE
|
||||
|
||||
typedef uint32_t UINTN;
|
||||
typedef int32_t INTN;
|
||||
#define UINTN uint32_t
|
||||
#define INTN int32_t
|
||||
|
||||
#define EFIERR(a) (0x80000000 | a)
|
||||
|
||||
#endif
|
||||
|
||||
#define CHAR16 uint16_t
|
||||
|
||||
#ifdef USE_EFI_FUNCTION_WRAPPER
|
||||
#define __VA_NARG__(...) \
|
||||
@ -306,10 +291,9 @@ UINT64 efi_call10(void *func, UINT64 arg1, UINT64 arg2, UINT64 arg3,
|
||||
|
||||
#include "acgcc.h"
|
||||
|
||||
#undef ACPI_USE_SYSTEM_CLIBRARY
|
||||
#undef ACPI_USE_STANDARD_HEADERS
|
||||
#undef ACPI_USE_NATIVE_DIVIDE
|
||||
#define ACPI_USE_SYSTEM_INTTYPES
|
||||
#undef ACPI_USE_SYSTEM_INTTYPES
|
||||
|
||||
/*
|
||||
* Math helpers
|
||||
@ -340,8 +324,8 @@ struct _EFI_SYSTEM_TABLE;
|
||||
extern struct _EFI_SYSTEM_TABLE *ST;
|
||||
extern struct _EFI_BOOT_SERVICES *BS;
|
||||
|
||||
#define ACPI_FILE struct _SIMPLE_TEXT_OUTPUT_INTERFACE *
|
||||
#define ACPI_FILE_OUT ST->ConOut
|
||||
#define ACPI_FILE_ERR ST->ConOut
|
||||
#define FILE struct _SIMPLE_TEXT_OUTPUT_INTERFACE
|
||||
#define stdout ST->ConOut
|
||||
#define stderr ST->ConOut
|
||||
|
||||
#endif /* __ACEFI_H__ */
|
||||
|
@ -422,12 +422,47 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#ifdef ACPI_APPLICATION
|
||||
#include <stdio.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#include <sys/stat.h>
|
||||
#endif
|
||||
|
||||
#endif /* ACPI_USE_STANDARD_HEADERS */
|
||||
#else /* ACPI_USE_STANDARD_HEADERS */
|
||||
|
||||
/* We will be linking to the standard Clib functions */
|
||||
#ifdef ACPI_USE_COMPILER_VA
|
||||
|
||||
#else
|
||||
/*
|
||||
* We will be linking to the standard Clib functions, but stdarg.h is
|
||||
* compiler specific, this works for linux kernel.
|
||||
*/
|
||||
#include <stdarg.h>
|
||||
|
||||
#else /* ACPI_USE_COMPILER_VA */
|
||||
|
||||
#ifndef va_arg
|
||||
|
||||
#ifndef _VALIST
|
||||
#define _VALIST
|
||||
typedef char *va_list;
|
||||
#endif /* _VALIST */
|
||||
|
||||
/* Storage alignment properties */
|
||||
|
||||
#define _AUPBND (sizeof (ACPI_NATIVE_INT) - 1)
|
||||
#define _ADNBND (sizeof (ACPI_NATIVE_INT) - 1)
|
||||
|
||||
/* Variable argument list macro definitions */
|
||||
|
||||
#define _Bnd(X, bnd) (((sizeof (X)) + (bnd)) & (~(bnd)))
|
||||
#define va_arg(ap, T) (*(T *)(((ap) += (_Bnd (T, _AUPBND))) - (_Bnd (T,_ADNBND))))
|
||||
#define va_end(ap) (ap = (va_list) NULL)
|
||||
#define va_start(ap, A) (void) ((ap) = (((char *) &(A)) + (_Bnd (A,_AUPBND))))
|
||||
|
||||
#endif /* va_arg */
|
||||
|
||||
#endif /* ACPI_USE_COMPILER_VA */
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
@ -435,6 +470,19 @@
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
typedef signed char int8_t;
|
||||
typedef short int int16_t;
|
||||
typedef int int32_t;
|
||||
typedef unsigned char uint8_t;
|
||||
typedef unsigned short int uint16_t;
|
||||
typedef unsigned int uint32_t;
|
||||
typedef COMPILER_DEPENDENT_INT64 int64_t;
|
||||
typedef COMPILER_DEPENDENT_UINT64 uint64_t;
|
||||
|
||||
#endif /* ACPI_USE_STANDARD_HEADERS */
|
||||
|
||||
#else /* ACPI_USE_SYSTEM_CLIBRARY */
|
||||
|
||||
/*
|
||||
* Use local definitions of C library macros and functions. These function
|
||||
* implementations may not be as efficient as an inline or assembly code
|
||||
@ -466,9 +514,7 @@ typedef char *va_list;
|
||||
|
||||
#endif /* ACPI_USE_SYSTEM_CLIBRARY */
|
||||
|
||||
#ifndef ACPI_FILE
|
||||
#ifdef ACPI_APPLICATION
|
||||
#include <stdio.h>
|
||||
#define ACPI_FILE FILE *
|
||||
#define ACPI_FILE_OUT stdout
|
||||
#define ACPI_FILE_ERR stderr
|
||||
@ -477,6 +523,5 @@ typedef char *va_list;
|
||||
#define ACPI_FILE_OUT NULL
|
||||
#define ACPI_FILE_ERR NULL
|
||||
#endif /* ACPI_APPLICATION */
|
||||
#endif /* ACPI_FILE */
|
||||
|
||||
#endif /* __ACENV_H__ */
|
||||
|
@ -116,6 +116,10 @@
|
||||
#ifndef __ACGCC_H__
|
||||
#define __ACGCC_H__
|
||||
|
||||
/* Allow inclusion of stdarg.h */
|
||||
|
||||
#define ACPI_USE_COMPILER_VA
|
||||
|
||||
#define ACPI_INLINE __inline__
|
||||
|
||||
/* Function name is used for debug output. Non-ANSI, compiler-dependent */
|
||||
|
@ -245,11 +245,9 @@
|
||||
|
||||
#else /* !__KERNEL__ */
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
#include <unistd.h>
|
||||
#define ACPI_USE_SYSTEM_CLIBRARY
|
||||
#define ACPI_USE_STANDARD_HEADERS
|
||||
|
||||
/* Define/disable kernel-specific declarators */
|
||||
|
||||
|
@ -225,6 +225,10 @@
|
||||
#pragma warning( disable : 4295 ) /* needed for acpredef.h array */
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER /* disable some level-4 warnings */
|
||||
#pragma warning(disable:4100) /* warning C4100: unreferenced formal parameter */
|
||||
#endif
|
||||
|
||||
|
||||
/* Debug support. */
|
||||
|
||||
|
@ -827,7 +827,7 @@ AcpiOsVprintf (
|
||||
va_list Args)
|
||||
{
|
||||
|
||||
(void) AcpiUtFileVprintf (ACPI_FILE_OUT, Format, Args);
|
||||
(void) vfprintf (ACPI_FILE_OUT, Format, Args);
|
||||
}
|
||||
|
||||
|
||||
|
@ -128,12 +128,6 @@
|
||||
#include "accommon.h"
|
||||
#include "actables.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
|
||||
/* Globals */
|
||||
|
||||
EXTERN BOOLEAN INIT_GLOBAL (Gbl_SummaryMode, FALSE);
|
||||
|
@ -295,13 +295,13 @@ ApDumpTableBuffer (
|
||||
* Note: simplest to just always emit a 64-bit address. AcpiXtract
|
||||
* utility can handle this.
|
||||
*/
|
||||
AcpiUtFilePrintf (Gbl_OutputFile, "%4.4s @ 0x%8.8X%8.8X\n",
|
||||
fprintf (Gbl_OutputFile, "%4.4s @ 0x%8.8X%8.8X\n",
|
||||
Table->Signature, ACPI_FORMAT_UINT64 (Address));
|
||||
|
||||
AcpiUtDumpBufferToFile (Gbl_OutputFile,
|
||||
ACPI_CAST_PTR (UINT8, Table), TableLength,
|
||||
DB_BYTE_DISPLAY, 0);
|
||||
AcpiUtFilePrintf (Gbl_OutputFile, "\n");
|
||||
fprintf (Gbl_OutputFile, "\n");
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
@ -225,7 +225,7 @@ ApWriteToBinaryFile (
|
||||
char Filename[ACPI_NAME_SIZE + 16];
|
||||
char InstanceStr [16];
|
||||
ACPI_FILE File;
|
||||
size_t Actual;
|
||||
ACPI_SIZE Actual;
|
||||
UINT32 TableLength;
|
||||
|
||||
|
||||
@ -254,7 +254,7 @@ ApWriteToBinaryFile (
|
||||
|
||||
if (Instance > 0)
|
||||
{
|
||||
AcpiUtSnprintf (InstanceStr, sizeof (InstanceStr), "%u", Instance);
|
||||
snprintf (InstanceStr, sizeof (InstanceStr), "%u", Instance);
|
||||
strcat (Filename, InstanceStr);
|
||||
}
|
||||
|
||||
@ -311,7 +311,7 @@ ApGetTableFromFile (
|
||||
ACPI_TABLE_HEADER *Buffer = NULL;
|
||||
ACPI_FILE File;
|
||||
UINT32 FileSize;
|
||||
size_t Actual;
|
||||
ACPI_SIZE Actual;
|
||||
|
||||
|
||||
/* Must use binary mode */
|
||||
|
Loading…
x
Reference in New Issue
Block a user