exec: Add semihosting stubs

This commit is contained in:
Lioncash 2018-02-15 10:48:28 -05:00
parent cdda3aec7f
commit f81894dddb
No known key found for this signature in database
GPG key ID: 4E3C3CC1031BA9C7
17 changed files with 164 additions and 1 deletions

View file

@ -2582,6 +2582,11 @@
#define save_globals save_globals_aarch64
#define scr_write scr_write_aarch64
#define sctlr_write sctlr_write_aarch64
#define semihosting_enabled semihosting_enabled_aarch64
#define semihosting_get_target semihosting_get_target_aarch64
#define semihosting_get_arg semihosting_get_arg_aarch64
#define semihosting_get_argc semihosting_get_argc_aarch64
#define semihosting_get_cmdline semihosting_get_cmdline_aarch64
#define set_bit set_bit_aarch64
#define set_bits set_bits_aarch64
#define set_default_nan_mode set_default_nan_mode_aarch64

View file

@ -2582,6 +2582,11 @@
#define save_globals save_globals_aarch64eb
#define scr_write scr_write_aarch64eb
#define sctlr_write sctlr_write_aarch64eb
#define semihosting_enabled semihosting_enabled_aarch64eb
#define semihosting_get_target semihosting_get_target_aarch64eb
#define semihosting_get_arg semihosting_get_arg_aarch64eb
#define semihosting_get_argc semihosting_get_argc_aarch64eb
#define semihosting_get_cmdline semihosting_get_cmdline_aarch64eb
#define set_bit set_bit_aarch64eb
#define set_bits set_bits_aarch64eb
#define set_default_nan_mode set_default_nan_mode_aarch64eb

View file

@ -2582,6 +2582,11 @@
#define save_globals save_globals_arm
#define scr_write scr_write_arm
#define sctlr_write sctlr_write_arm
#define semihosting_enabled semihosting_enabled_arm
#define semihosting_get_target semihosting_get_target_arm
#define semihosting_get_arg semihosting_get_arg_arm
#define semihosting_get_argc semihosting_get_argc_arm
#define semihosting_get_cmdline semihosting_get_cmdline_arm
#define set_bit set_bit_arm
#define set_bits set_bits_arm
#define set_default_nan_mode set_default_nan_mode_arm

View file

@ -2582,6 +2582,11 @@
#define save_globals save_globals_armeb
#define scr_write scr_write_armeb
#define sctlr_write sctlr_write_armeb
#define semihosting_enabled semihosting_enabled_armeb
#define semihosting_get_target semihosting_get_target_armeb
#define semihosting_get_arg semihosting_get_arg_armeb
#define semihosting_get_argc semihosting_get_argc_armeb
#define semihosting_get_cmdline semihosting_get_cmdline_armeb
#define set_bit set_bit_armeb
#define set_bits set_bits_armeb
#define set_default_nan_mode set_default_nan_mode_armeb

View file

@ -2588,6 +2588,11 @@ symbols = (
'save_globals',
'scr_write',
'sctlr_write',
'semihosting_enabled',
'semihosting_get_target',
'semihosting_get_arg',
'semihosting_get_argc',
'semihosting_get_cmdline',
'set_bit',
'set_bits',
'set_default_nan_mode',

View file

@ -0,0 +1,64 @@
/*
* Semihosting support
*
* Copyright (c) 2015 Imagination Technologies
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, see <http://www.gnu.org/licenses/>.
*/
#ifndef SEMIHOST_H
#define SEMIHOST_H
typedef enum SemihostingTarget {
SEMIHOSTING_TARGET_AUTO = 0,
SEMIHOSTING_TARGET_NATIVE,
SEMIHOSTING_TARGET_GDB
} SemihostingTarget;
#ifdef CONFIG_USER_ONLY
static inline bool semihosting_enabled(void)
{
// UNICORN: Always return false
return false;
// return true;
}
static inline SemihostingTarget semihosting_get_target(void)
{
return SEMIHOSTING_TARGET_AUTO;
}
static inline const char *semihosting_get_arg(int i)
{
return NULL;
}
static inline int semihosting_get_argc(void)
{
return 0;
}
static inline const char *semihosting_get_cmdline(void)
{
return NULL;
}
#else
bool semihosting_enabled(void);
SemihostingTarget semihosting_get_target(void);
const char *semihosting_get_arg(int i);
int semihosting_get_argc(void);
const char *semihosting_get_cmdline(void);
#endif
#endif

View file

@ -2582,6 +2582,11 @@
#define save_globals save_globals_m68k
#define scr_write scr_write_m68k
#define sctlr_write sctlr_write_m68k
#define semihosting_enabled semihosting_enabled_m68k
#define semihosting_get_target semihosting_get_target_m68k
#define semihosting_get_arg semihosting_get_arg_m68k
#define semihosting_get_argc semihosting_get_argc_m68k
#define semihosting_get_cmdline semihosting_get_cmdline_m68k
#define set_bit set_bit_m68k
#define set_bits set_bits_m68k
#define set_default_nan_mode set_default_nan_mode_m68k

View file

@ -2582,6 +2582,11 @@
#define save_globals save_globals_mips
#define scr_write scr_write_mips
#define sctlr_write sctlr_write_mips
#define semihosting_enabled semihosting_enabled_mips
#define semihosting_get_target semihosting_get_target_mips
#define semihosting_get_arg semihosting_get_arg_mips
#define semihosting_get_argc semihosting_get_argc_mips
#define semihosting_get_cmdline semihosting_get_cmdline_mips
#define set_bit set_bit_mips
#define set_bits set_bits_mips
#define set_default_nan_mode set_default_nan_mode_mips

View file

@ -2582,6 +2582,11 @@
#define save_globals save_globals_mips64
#define scr_write scr_write_mips64
#define sctlr_write sctlr_write_mips64
#define semihosting_enabled semihosting_enabled_mips64
#define semihosting_get_target semihosting_get_target_mips64
#define semihosting_get_arg semihosting_get_arg_mips64
#define semihosting_get_argc semihosting_get_argc_mips64
#define semihosting_get_cmdline semihosting_get_cmdline_mips64
#define set_bit set_bit_mips64
#define set_bits set_bits_mips64
#define set_default_nan_mode set_default_nan_mode_mips64

View file

@ -2582,6 +2582,11 @@
#define save_globals save_globals_mips64el
#define scr_write scr_write_mips64el
#define sctlr_write sctlr_write_mips64el
#define semihosting_enabled semihosting_enabled_mips64el
#define semihosting_get_target semihosting_get_target_mips64el
#define semihosting_get_arg semihosting_get_arg_mips64el
#define semihosting_get_argc semihosting_get_argc_mips64el
#define semihosting_get_cmdline semihosting_get_cmdline_mips64el
#define set_bit set_bit_mips64el
#define set_bits set_bits_mips64el
#define set_default_nan_mode set_default_nan_mode_mips64el

View file

@ -2582,6 +2582,11 @@
#define save_globals save_globals_mipsel
#define scr_write scr_write_mipsel
#define sctlr_write sctlr_write_mipsel
#define semihosting_enabled semihosting_enabled_mipsel
#define semihosting_get_target semihosting_get_target_mipsel
#define semihosting_get_arg semihosting_get_arg_mipsel
#define semihosting_get_argc semihosting_get_argc_mipsel
#define semihosting_get_cmdline semihosting_get_cmdline_mipsel
#define set_bit set_bit_mipsel
#define set_bits set_bits_mipsel
#define set_default_nan_mode set_default_nan_mode_mipsel

View file

@ -2582,6 +2582,11 @@
#define save_globals save_globals_powerpc
#define scr_write scr_write_powerpc
#define sctlr_write sctlr_write_powerpc
#define semihosting_enabled semihosting_enabled_powerpc
#define semihosting_get_target semihosting_get_target_powerpc
#define semihosting_get_arg semihosting_get_arg_powerpc
#define semihosting_get_argc semihosting_get_argc_powerpc
#define semihosting_get_cmdline semihosting_get_cmdline_powerpc
#define set_bit set_bit_powerpc
#define set_bits set_bits_powerpc
#define set_default_nan_mode set_default_nan_mode_powerpc

View file

@ -2582,6 +2582,11 @@
#define save_globals save_globals_sparc
#define scr_write scr_write_sparc
#define sctlr_write sctlr_write_sparc
#define semihosting_enabled semihosting_enabled_sparc
#define semihosting_get_target semihosting_get_target_sparc
#define semihosting_get_arg semihosting_get_arg_sparc
#define semihosting_get_argc semihosting_get_argc_sparc
#define semihosting_get_cmdline semihosting_get_cmdline_sparc
#define set_bit set_bit_sparc
#define set_bits set_bits_sparc
#define set_default_nan_mode set_default_nan_mode_sparc

View file

@ -2582,6 +2582,11 @@
#define save_globals save_globals_sparc64
#define scr_write scr_write_sparc64
#define sctlr_write sctlr_write_sparc64
#define semihosting_enabled semihosting_enabled_sparc64
#define semihosting_get_target semihosting_get_target_sparc64
#define semihosting_get_arg semihosting_get_arg_sparc64
#define semihosting_get_argc semihosting_get_argc_sparc64
#define semihosting_get_cmdline semihosting_get_cmdline_sparc64
#define set_bit set_bit_sparc64
#define set_bits set_bits_sparc64
#define set_default_nan_mode set_default_nan_mode_sparc64

View file

@ -32,7 +32,7 @@
#include "exec/helper-proto.h"
#include "exec/helper-gen.h"
#include "exec/semihost.h"
#include "exec/gen-icount.h"
#ifdef CONFIG_USER_ONLY

View file

@ -30,6 +30,7 @@
#include "sysemu/cpus.h"
#include "vl.h"
#include "uc_priv.h"
#include "exec/semihost.h"
#include "crypto/init.h"
#define DEFAULT_RAM_SIZE 128
@ -54,6 +55,34 @@ void cpu_stop_current(struct uc_struct *uc)
}
}
/***********************************************************/
/* Semihosting */
bool semihosting_enabled(void)
{
// UNICORN: Always return false
return false;
}
SemihostingTarget semihosting_get_target(void)
{
return SEMIHOSTING_TARGET_AUTO;
}
const char *semihosting_get_arg(int i)
{
return NULL;
}
int semihosting_get_argc(void)
{
return 0;
}
const char *semihosting_get_cmdline(void)
{
return NULL;
}
/***********************************************************/
/* machine registration */

View file

@ -2582,6 +2582,11 @@
#define save_globals save_globals_x86_64
#define scr_write scr_write_x86_64
#define sctlr_write sctlr_write_x86_64
#define semihosting_enabled semihosting_enabled_x86_64
#define semihosting_get_target semihosting_get_target_x86_64
#define semihosting_get_arg semihosting_get_arg_x86_64
#define semihosting_get_argc semihosting_get_argc_x86_64
#define semihosting_get_cmdline semihosting_get_cmdline_x86_64
#define set_bit set_bit_x86_64
#define set_bits set_bits_x86_64
#define set_default_nan_mode set_default_nan_mode_x86_64