[PATCH 07/11] acpica + lib: fix assemble/dissassemble to work with new ACPICA core
Colin King
colin.king at canonical.com
Wed Apr 11 23:50:52 UTC 2012
From: Colin Ian King <colin.king at canonical.com>
Signed-off-by: Colin Ian King <colin.king at canonical.com>
---
src/acpica/source/compiler/fwts_iasl_interface.c | 15 +++++++++++----
src/lib/src/fwts_iasl.c | 10 +++++-----
2 files changed, 16 insertions(+), 9 deletions(-)
diff --git a/src/acpica/source/compiler/fwts_iasl_interface.c b/src/acpica/source/compiler/fwts_iasl_interface.c
index b4be8ef..ada4326 100644
--- a/src/acpica/source/compiler/fwts_iasl_interface.c
+++ b/src/acpica/source/compiler/fwts_iasl_interface.c
@@ -37,9 +37,11 @@ static void init_asl_core(void)
Gbl_Files[i].Handle = NULL;
Gbl_Files[i].Filename = NULL;
}
-
+
Gbl_Files[ASL_FILE_STDOUT].Handle = stdout;
Gbl_Files[ASL_FILE_STDOUT].Filename = "STDOUT";
+ Gbl_Files[ASL_FILE_STDERR].Handle = stdout;
+ Gbl_Files[ASL_FILE_STDERR].Filename = "STDOUT";
}
int fwts_iasl_disassemble_aml(const char *aml, const char *outputfile)
@@ -55,10 +57,11 @@ int fwts_iasl_disassemble_aml(const char *aml, const char *outputfile)
/* Child */
init_asl_core();
+ /* Setup ACPICA disassembler globals */
Gbl_DisasmFlag = TRUE;
Gbl_DoCompile = FALSE;
Gbl_OutputFilenamePrefix = (char*)outputfile;
- Gbl_UseDefaultAmlFilename = FALSE;
+ Gbl_UseDefaultAmlFilename = FALSE;
/* Throw away noisy errors */
freopen("/dev/null", "w", stderr);
@@ -82,7 +85,7 @@ int fwts_iasl_assemble_aml(const char *source, char **output)
char buffer[8192];
int n;
int len = 0;
- int status;
+ int status;
FILE *fp;
if (pipe(pipefds) < 0)
@@ -104,8 +107,12 @@ int fwts_iasl_assemble_aml(const char *source, char **output)
}
close(pipefds[0]);
+ /* Setup ACPICA compiler globals */
Gbl_DisasmFlag = FALSE;
Gbl_DoCompile = TRUE;
+ Gbl_PreprocessFlag = FALSE;
+ Gbl_UseDefaultAmlFilename = FALSE;
+ Gbl_OutputFilenamePrefix = source;
status = AslDoOnePathname(source, AslDoOneFile);
@@ -116,7 +123,7 @@ int fwts_iasl_assemble_aml(const char *source, char **output)
default:
/* Parent */
close(pipefds[1]);
-
+
while ((n = read(pipefds[0], buffer, sizeof(buffer))) > 0) {
data = realloc(data, len + n + 1);
memcpy(data + len, buffer, n);
diff --git a/src/lib/src/fwts_iasl.c b/src/lib/src/fwts_iasl.c
index d6c8676..d75d997 100644
--- a/src/lib/src/fwts_iasl.c
+++ b/src/lib/src/fwts_iasl.c
@@ -169,18 +169,18 @@ int fwts_iasl_reassemble(fwts_framework *fw,
/* Now we have a disassembled source in tmpfile, so let's assemble it */
if (fwts_iasl_assemble_aml(tmpfile, &output_text) < 0) {
- (void)unlink(tmpfile);
+ (void)unlink(amlfile);
(void)unlink(tmpfile);
free(output_text);
return FWTS_ERROR;
}
+ /* Remove these now we don't need them */
(void)unlink(tmpfile);
+ (void)unlink(amlfile);
- /* For some reason that I've not yet fathomed the ACPICA assembler
- leaves a .src file lying around so let's remove it to be tidy */
-
- snprintf(tmpfile, sizeof(tmpfile), "/tmp/fwts_iasl_%d.src", pid);
+ /* And remove aml file generated from ACPICA compiler */
+ snprintf(tmpfile, sizeof(tmpfile), "/tmp/fwts_iasl_%d.aml", pid);
(void)unlink(tmpfile);
*iasl_errors = fwts_list_from_text(output_text);
--
1.7.9.5
More information about the fwts-devel
mailing list