Skip to contentSkip to conversation

aml-build: append opcodes using build_append_byte

PATCH In review Michael S. Tsirkin 2 participants 2 messages Mar 8, 2015 – Mar 9, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 aml-build: append opcodes using build_append_byte

Opcodes are raw bytes, they shouldn't be added
using build_append_int. This only happens to work
with 0 and 1 opcodes.

---
 hw/acpi/aml-build.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
hw/acpi/aml-build.c +3 -3
index ff12b28..e01b8c2 100644
@@ -112,7 +112,7 @@ build_append_namestringv(GArray *array, const char *format, va_list ap)
     switch (seg_count) {
     case 1:
         if (!*s) {
-            build_append_byte(array, 0x0); /* NullName */
+            build_append_byte(array, 0x00); /* NullName */
         } else {
             build_append_nameseg(array, s);
         }
@@ -448,7 +448,7 @@ Aml *aml_and(Aml *arg1, Aml *arg2)
     Aml *var = aml_opcode(0x7B /* AndOp */);
     aml_append(var, arg1);
     aml_append(var, arg2);
-    build_append_int(var->buf, 0x00 /* NullNameOp */);
+    build_append_byte(var->buf, 0x00 /* NullNameOp */);
     return var;
 }
 
@@ -546,7 +546,7 @@ Aml *aml_equal(Aml *arg1, Aml *arg2)
     Aml *var = aml_opcode(0x93 /* LequalOp */);
     aml_append(var, arg1);
     aml_append(var, arg2);
-    build_append_int(var->buf, 0x00); /* NullNameOp */
+    build_append_byte(var->buf, 0x00); /* NullNameOp */
     return var;
 }
 
Signature · 1 line
MST
Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines · On Sun, 8 Mar 2015 16:22:38 +0100 "Michael S. Tsirkin" <[email protected]> wrote:

Opcodes are raw bytes, they shouldn't be added
using build_append_int. This only happens to work
with 0 and 1 opcodes.

Quoted 35 lines
---
 hw/acpi/aml-build.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
hw/acpi/aml-build.c +3 -3
index ff12b28..e01b8c2 100644
@@ -112,7 +112,7 @@ build_append_namestringv(GArray *array, const char *format, va_list ap)
     switch (seg_count) {
     case 1:
         if (!*s) {
-            build_append_byte(array, 0x0); /* NullName */
+            build_append_byte(array, 0x00); /* NullName */
         } else {
             build_append_nameseg(array, s);
         }
@@ -448,7 +448,7 @@ Aml *aml_and(Aml *arg1, Aml *arg2)
     Aml *var = aml_opcode(0x7B /* AndOp */);
     aml_append(var, arg1);
     aml_append(var, arg2);
-    build_append_int(var->buf, 0x00 /* NullNameOp */);
+    build_append_byte(var->buf, 0x00 /* NullNameOp */);
     return var;
 }
 
@@ -546,7 +546,7 @@ Aml *aml_equal(Aml *arg1, Aml *arg2)
     Aml *var = aml_opcode(0x93 /* LequalOp */);
     aml_append(var, arg1);
     aml_append(var, arg2);
-    build_append_int(var->buf, 0x00); /* NullNameOp */
+    build_append_byte(var->buf, 0x00); /* NullNameOp */
     return var;
 }