summaryrefslogtreecommitdiff
path: root/include/drivers/console.h
diff options
context:
space:
mode:
authorDaniel Boulby <daniel.boulby@arm.com>2018-05-16 16:04:35 +0100
committerDaniel Boulby <daniel.boulby@arm.com>2018-05-17 16:42:41 +0100
commit8abcdf921a0b5fd5c33f1a43706cbb4eca8c8742 (patch)
tree6dc69c649f2b57180962df725b6bb2213efde727 /include/drivers/console.h
parentdc59ff343647c22403a8537f23eba27a7744218e (diff)
Ensure read and write of flags are 32 bit
In 'console_set_scope' and when registering a console, field 'flags' of 'console_t' is assigned a 32-bit value. However, when it is actually used, the functions perform 64-bit reads to access its value. This patch changes all 64-bit reads to 32-bit reads. Change-Id: I181349371409e60065335f078857946fa3c32dc1 Signed-off-by: Daniel Boulby <daniel.boulby@arm.com>
Diffstat (limited to 'include/drivers/console.h')
-rw-r--r--include/drivers/console.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/include/drivers/console.h b/include/drivers/console.h
index 0855170e..a4d89fe9 100644
--- a/include/drivers/console.h
+++ b/include/drivers/console.h
@@ -34,13 +34,17 @@
typedef struct console {
struct console *next;
+ /*
+ * Only the low 32 bits are used. The type is u_register_t to align the
+ * fields of the struct to 64 bits in AArch64 and 32 bits in AArch32
+ */
u_register_t flags;
int (*putc)(int character, struct console *console);
int (*getc)(struct console *console);
int (*flush)(struct console *console);
/* Additional private driver data may follow here. */
} console_t;
-#include <console_assertions.h> /* offset macro assertions for console_t */
+#include <console_assertions.h> /* offset macro assertions for console_t */
/*
* NOTE: There is no publicly accessible console_register() function. Consoles