x86: realmode: use ARRAY_SIZE in test_long_jmp
Paolo Bonzini
maintainerPATCH 1/1 x86: realmode: use ARRAY_SIZE in test_long_jmp
Make the code a little bit more robust and self-explanatory.
Signed-off-by Paolo Bonzini <[email protected]>
--- x86/realmode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
x86/realmode.c +1 -1
@@ -606,7 +606,7 @@ static void test_long_jmp(void)u32 esp[16 ]; inregs = (struct regs ){0 }; - inregs.esp = (u32)(esp+16 ); + inregs.esp = (u32)&esp[ARRAY_SIZE (esp)];MK_INSN (long_jmp,"call 1f\n\t" "jmp 2f\n\t" "1: jmp $0, $test_function\n\t"
Signature · 1 line
2.21.0
Quoted 22 lines · Paolo Bonzini
Make the code a little bit more robust and self-explanatory.
Signed-off-by Paolo Bonzini <[email protected]>--- x86/realmode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)x86/realmode.c +1
-2@@ -606,7 +606,7 @@ static void test_long_jmp(void)u32 esp[16 ]; inregs = (struct regs ){0 }; - inregs.esp = (u32)(esp+16 ); + inregs.esp = (u32)&esp[ARRAY_SIZE (esp)];MK_INSN (long_jmp,"call 1f\n\t" "jmp 2f\n\t" "1: jmp $0, $test_function\n\t" --
Quoted 1 line
2.21.0
Definitely an improvement.
Reviewed-by Jim Mattson <[email protected]>