xtensa: ISS: define simc_exit and use it instead of inline asm

A number of ISS platform functions use inline assembly to invoke
simulator exit, not all correctly. Define simc_exit(exit_code) and use
it instead of inline assembly.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
This commit is contained in:
Max Filippov 2016-09-20 17:26:48 -07:00
parent 70feca7199
commit feec273a2b
2 changed files with 10 additions and 3 deletions

View File

@ -76,6 +76,11 @@ static inline int __simc(int a, int b, int c, int d)
return ret;
}
static inline int simc_exit(int exit_code)
{
return __simc(SYS_exit, exit_code, 0, 0);
}
static inline int simc_open(const char *file, int flags, int mode)
{
return __simc(SYS_open, (int) file, flags, mode);

View File

@ -32,6 +32,8 @@
#include <asm/platform.h>
#include <asm/bootparam.h>
#include <platform/simcall.h>
void __init platform_init(bp_tag_t* bootparam)
{
@ -41,13 +43,13 @@ void __init platform_init(bp_tag_t* bootparam)
void platform_halt(void)
{
pr_info(" ** Called platform_halt() **\n");
__asm__ __volatile__("movi a2, 1\nsimcall\n");
simc_exit(0);
}
void platform_power_off(void)
{
pr_info(" ** Called platform_power_off() **\n");
__asm__ __volatile__("movi a2, 1\nsimcall\n");
simc_exit(0);
}
void platform_restart(void)
{
@ -80,7 +82,7 @@ void platform_heartbeat(void)
static int
iss_panic_event(struct notifier_block *this, unsigned long event, void *ptr)
{
__asm__ __volatile__("movi a2, -1; simcall\n");
simc_exit(1);
return NOTIFY_DONE;
}