x86: Halt on exit
PATCH 1/1 x86: Halt on exit
In some cases, shutdown through the test device and Bochs might fail. Just hang in a loop that executes halt in such cases.
--- lib/x86/io.c | 4 ++++ 1 file changed, 4 insertions(+)
lib/x86/io.c +4 -0
@@ -99,6 +99,10 @@ void exit(int code)#else asmvolatile ("out %0, %1" : :"a" (code),"d" ((short )0xf4 ));#endif +/* Fallback */ +while (1 ) { + asmvolatile ("hlt" :::"memory" ); + }__builtin_unreachable (); }
Signature · 1 line
2.17.1
Err… kvm-unit-tests patch if there is any doubt.
Quoted 27 lines · Nadav Amit
In some cases, shutdown through the test device and Bochs might fail. Just hang in a loop that executes halt in such cases.
Signed-off-by Nadav Amit <[email protected]>---
lib/x86/io.c| 4 ++++1 file changed, 4 insertions(+)lib/x86/io.c +4
-0@@ -99,6 +99,10 @@ void exit(int code)#else asmvolatile ("out %0, %1" : :"a" (code),"d" ((short )0xf4 ));#endif +/* Fallback */ +while (1 ) { + asmvolatile ("hlt" :::"memory" ); + }__builtin_unreachable (); }Signature · 1 line
2.17.1
Quoted 2 lines · Nadav Amit
Err… kvm-unit-tests patch if there is any doubt.
you should contain kvm-unit-tests in the subject as [kvm-unit-tests PATCH]
otherwise, we don't know it's a kvm-unit-tests patch.
Quoted 29 lines
Quoted 27 lines · Nadav Amit
In some cases, shutdown through the test device and Bochs might fail. Just hang in a loop that executes halt in such cases.
Signed-off-by Nadav Amit <[email protected]>---
lib/x86/io.c| 4 ++++1 file changed, 4 insertions(+)lib/x86/io.c +4
-0@@ -99,6 +99,10 @@ void exit(int code)#else asmvolatile ("out %0, %1" : :"a" (code),"d" ((short )0xf4 ));#endif +/* Fallback */ +while (1 ) { + asmvolatile ("hlt" :::"memory" ); + }__builtin_unreachable (); }Signature · 1 line
2.17.1
Quoted 8 lines · Xiaoyao Li
Quoted 1 line · Nadav Amit
Err… kvm-unit-tests patch if there is any doubt.
you should contain kvm-unit-tests in the subject as [kvm-unit-tests PATCH]
otherwise, we don't know it's a kvm-unit-tests patch.
Thanks, I know. The “Err…” meant to say “Oops, I forgot the --subject-prefix, please excuse me."
Quoted 28 lines
Quoted 28 lines
Quoted 28 lines · Nadav Amit
In some cases, shutdown through the test device and Bochs might fail. Just hang in a loop that executes halt in such cases.
Signed-off-by Nadav Amit <[email protected]>---
lib/x86/io.c| 4 ++++1 file changed, 4 insertions(+)lib/x86/io.c +4
-0@@ -99,6 +99,10 @@ void exit(int code)#else asmvolatile ("out %0, %1" : :"a" (code),"d" ((short )0xf4 ));#endif +/* Fallback */ +while (1 ) { + asmvolatile ("hlt" :::"memory" ); + }__builtin_unreachable (); }Signature · 1 line
2.17.1
2019-05-09 12:50-0700, Nadav Amit:
Quoted 10 lines
In some cases, shutdown through the test device and Bochs might fail. Just hang in a loop that executes halt in such cases.
Signed-off-by Nadav Amit <[email protected]>--- lib/x86/io.c | 4 ++++ 1 file changed, 4 insertions(+)
lib/x86/io.c void exit(int code) · line 106
Quoted 8 lines
lib/x86/io.c +4
-0@@ -99,6 +99,10 @@ void exit(int code)#else asmvolatile ("out %0, %1" : :"a" (code),"d" ((short )0xf4 ));#endif +/* Fallback */ +while (1 ) { + asmvolatile ("hlt" :::"memory" ); + }__builtin_unreachable ();
Looks good, we can also drop the __builtin_unreachable() now.