mirror of
https://github.com/ARM-software/arm-trusted-firmware.git
synced 2025-04-22 20:38:03 +00:00
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>
This commit is contained in:
parent
dc59ff3436
commit
8abcdf921a
2 changed files with 8 additions and 4 deletions
|
@ -200,7 +200,7 @@ putc_loop:
|
||||||
cbz x14, putc_done
|
cbz x14, putc_done
|
||||||
adrp x1, console_state
|
adrp x1, console_state
|
||||||
ldrb w1, [x1, :lo12:console_state]
|
ldrb w1, [x1, :lo12:console_state]
|
||||||
ldr x2, [x14, #CONSOLE_T_FLAGS]
|
ldr w2, [x14, #CONSOLE_T_FLAGS]
|
||||||
tst w1, w2
|
tst w1, w2
|
||||||
b.eq putc_continue
|
b.eq putc_continue
|
||||||
ldr x2, [x14, #CONSOLE_T_PUTC]
|
ldr x2, [x14, #CONSOLE_T_PUTC]
|
||||||
|
@ -246,7 +246,7 @@ getc_try_again:
|
||||||
getc_loop:
|
getc_loop:
|
||||||
adrp x0, console_state
|
adrp x0, console_state
|
||||||
ldrb w0, [x0, :lo12:console_state]
|
ldrb w0, [x0, :lo12:console_state]
|
||||||
ldr x1, [x14, #CONSOLE_T_FLAGS]
|
ldr w1, [x14, #CONSOLE_T_FLAGS]
|
||||||
tst w0, w1
|
tst w0, w1
|
||||||
b.eq getc_continue
|
b.eq getc_continue
|
||||||
ldr x1, [x14, #CONSOLE_T_GETC]
|
ldr x1, [x14, #CONSOLE_T_GETC]
|
||||||
|
@ -287,7 +287,7 @@ flush_loop:
|
||||||
cbz x14, flush_done
|
cbz x14, flush_done
|
||||||
adrp x1, console_state
|
adrp x1, console_state
|
||||||
ldrb w1, [x1, :lo12:console_state]
|
ldrb w1, [x1, :lo12:console_state]
|
||||||
ldr x2, [x14, #CONSOLE_T_FLAGS]
|
ldr w2, [x14, #CONSOLE_T_FLAGS]
|
||||||
tst w1, w2
|
tst w1, w2
|
||||||
b.eq flush_continue
|
b.eq flush_continue
|
||||||
ldr x1, [x14, #CONSOLE_T_FLUSH]
|
ldr x1, [x14, #CONSOLE_T_FLUSH]
|
||||||
|
|
|
@ -34,6 +34,10 @@
|
||||||
|
|
||||||
typedef struct console {
|
typedef struct console {
|
||||||
struct console *next;
|
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;
|
u_register_t flags;
|
||||||
int (*putc)(int character, struct console *console);
|
int (*putc)(int character, struct console *console);
|
||||||
int (*getc)(struct console *console);
|
int (*getc)(struct console *console);
|
||||||
|
|
Loading…
Add table
Reference in a new issue