aboutsummaryrefslogtreecommitdiff
path: root/semihosting
diff options
context:
space:
mode:
authorRichard Henderson <richard.henderson@linaro.org>2023-09-13 17:22:49 -0700
committerRichard Henderson <richard.henderson@linaro.org>2023-10-04 11:03:54 -0700
commitb77af26e973705e8fd96cff102fc978ee44043da (patch)
tree5da84b6520fbcf44ef8d9af06307785744eef835 /semihosting
parentad75a51e84af9638e4ec51aa1e6ec5f3ff642558 (diff)
accel/tcg: Replace CPUState.env_ptr with cpu_env()
Reviewed-by: Anton Johansson <anjo@rev.ng> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'semihosting')
-rw-r--r--semihosting/arm-compat-semi.c6
-rw-r--r--semihosting/syscalls.c28
2 files changed, 17 insertions, 17 deletions
diff --git a/semihosting/arm-compat-semi.c b/semihosting/arm-compat-semi.c
index 564fe17f75..29c5670fdf 100644
--- a/semihosting/arm-compat-semi.c
+++ b/semihosting/arm-compat-semi.c
@@ -251,7 +251,7 @@ static void common_semi_dead_cb(CPUState *cs, uint64_t ret, int err)
static void common_semi_rw_cb(CPUState *cs, uint64_t ret, int err)
{
/* Recover the original length from the third argument. */
- CPUArchState *env G_GNUC_UNUSED = cs->env_ptr;
+ CPUArchState *env G_GNUC_UNUSED = cpu_env(cs);
target_ulong args = common_semi_arg(cs, 1);
target_ulong arg2;
GET_ARG(2);
@@ -322,7 +322,7 @@ static void
common_semi_readc_cb(CPUState *cs, uint64_t ret, int err)
{
if (!err) {
- CPUArchState *env G_GNUC_UNUSED = cs->env_ptr;
+ CPUArchState *env G_GNUC_UNUSED = cpu_env(cs);
uint8_t ch;
if (get_user_u8(ch, common_semi_stack_bottom(cs) - 1)) {
@@ -361,7 +361,7 @@ static const uint8_t featurefile_data[] = {
*/
void do_common_semihosting(CPUState *cs)
{
- CPUArchState *env = cs->env_ptr;
+ CPUArchState *env = cpu_env(cs);
target_ulong args;
target_ulong arg0, arg1, arg2, arg3;
target_ulong ul_ret;
diff --git a/semihosting/syscalls.c b/semihosting/syscalls.c
index d27574a1e2..1ab4809567 100644
--- a/semihosting/syscalls.c
+++ b/semihosting/syscalls.c
@@ -24,7 +24,7 @@
*/
static int validate_strlen(CPUState *cs, target_ulong str, target_ulong tlen)
{
- CPUArchState *env G_GNUC_UNUSED = cs->env_ptr;
+ CPUArchState *env G_GNUC_UNUSED = cpu_env(cs);
char c;
if (tlen == 0) {
@@ -54,7 +54,7 @@ static int validate_lock_user_string(char **pstr, CPUState *cs,
target_ulong tstr, target_ulong tlen)
{
int ret = validate_strlen(cs, tstr, tlen);
- CPUArchState *env G_GNUC_UNUSED = cs->env_ptr;
+ CPUArchState *env G_GNUC_UNUSED = cpu_env(cs);
char *str = NULL;
if (ret > 0) {
@@ -74,7 +74,7 @@ static int validate_lock_user_string(char **pstr, CPUState *cs,
static int copy_stat_to_user(CPUState *cs, target_ulong addr,
const struct stat *s)
{
- CPUArchState *env G_GNUC_UNUSED = cs->env_ptr;
+ CPUArchState *env G_GNUC_UNUSED = cpu_env(cs);
struct gdb_stat *p;
if (s->st_dev != (uint32_t)s->st_dev ||
@@ -258,7 +258,7 @@ static void host_open(CPUState *cs, gdb_syscall_complete_cb complete,
target_ulong fname, target_ulong fname_len,
int gdb_flags, int mode)
{
- CPUArchState *env G_GNUC_UNUSED = cs->env_ptr;
+ CPUArchState *env G_GNUC_UNUSED = cpu_env(cs);
char *p;
int ret, host_flags = O_BINARY;
@@ -316,7 +316,7 @@ static void host_close(CPUState *cs, gdb_syscall_complete_cb complete,
static void host_read(CPUState *cs, gdb_syscall_complete_cb complete,
GuestFD *gf, target_ulong buf, target_ulong len)
{
- CPUArchState *env G_GNUC_UNUSED = cs->env_ptr;
+ CPUArchState *env G_GNUC_UNUSED = cpu_env(cs);
void *ptr = lock_user(VERIFY_WRITE, buf, len, 0);
ssize_t ret;
@@ -337,7 +337,7 @@ static void host_read(CPUState *cs, gdb_syscall_complete_cb complete,
static void host_write(CPUState *cs, gdb_syscall_complete_cb complete,
GuestFD *gf, target_ulong buf, target_ulong len)
{
- CPUArchState *env G_GNUC_UNUSED = cs->env_ptr;
+ CPUArchState *env G_GNUC_UNUSED = cpu_env(cs);
void *ptr = lock_user(VERIFY_READ, buf, len, 1);
ssize_t ret;
@@ -411,7 +411,7 @@ static void host_stat(CPUState *cs, gdb_syscall_complete_cb complete,
target_ulong fname, target_ulong fname_len,
target_ulong addr)
{
- CPUArchState *env G_GNUC_UNUSED = cs->env_ptr;
+ CPUArchState *env G_GNUC_UNUSED = cpu_env(cs);
struct stat buf;
char *name;
int ret, err;
@@ -440,7 +440,7 @@ static void host_stat(CPUState *cs, gdb_syscall_complete_cb complete,
static void host_remove(CPUState *cs, gdb_syscall_complete_cb complete,
target_ulong fname, target_ulong fname_len)
{
- CPUArchState *env G_GNUC_UNUSED = cs->env_ptr;
+ CPUArchState *env G_GNUC_UNUSED = cpu_env(cs);
char *p;
int ret;
@@ -459,7 +459,7 @@ static void host_rename(CPUState *cs, gdb_syscall_complete_cb complete,
target_ulong oname, target_ulong oname_len,
target_ulong nname, target_ulong nname_len)
{
- CPUArchState *env G_GNUC_UNUSED = cs->env_ptr;
+ CPUArchState *env G_GNUC_UNUSED = cpu_env(cs);
char *ostr, *nstr;
int ret;
@@ -484,7 +484,7 @@ static void host_rename(CPUState *cs, gdb_syscall_complete_cb complete,
static void host_system(CPUState *cs, gdb_syscall_complete_cb complete,
target_ulong cmd, target_ulong cmd_len)
{
- CPUArchState *env G_GNUC_UNUSED = cs->env_ptr;
+ CPUArchState *env G_GNUC_UNUSED = cpu_env(cs);
char *p;
int ret;
@@ -502,7 +502,7 @@ static void host_system(CPUState *cs, gdb_syscall_complete_cb complete,
static void host_gettimeofday(CPUState *cs, gdb_syscall_complete_cb complete,
target_ulong tv_addr, target_ulong tz_addr)
{
- CPUArchState *env G_GNUC_UNUSED = cs->env_ptr;
+ CPUArchState *env G_GNUC_UNUSED = cpu_env(cs);
struct gdb_timeval *p;
int64_t rt;
@@ -547,7 +547,7 @@ static void host_poll_one(CPUState *cs, gdb_syscall_complete_cb complete,
static void staticfile_read(CPUState *cs, gdb_syscall_complete_cb complete,
GuestFD *gf, target_ulong buf, target_ulong len)
{
- CPUArchState *env G_GNUC_UNUSED = cs->env_ptr;
+ CPUArchState *env G_GNUC_UNUSED = cpu_env(cs);
target_ulong rest = gf->staticfile.len - gf->staticfile.off;
void *ptr;
@@ -605,7 +605,7 @@ static void staticfile_flen(CPUState *cs, gdb_syscall_complete_cb complete,
static void console_read(CPUState *cs, gdb_syscall_complete_cb complete,
GuestFD *gf, target_ulong buf, target_ulong len)
{
- CPUArchState *env G_GNUC_UNUSED = cs->env_ptr;
+ CPUArchState *env G_GNUC_UNUSED = cpu_env(cs);
char *ptr;
int ret;
@@ -622,7 +622,7 @@ static void console_read(CPUState *cs, gdb_syscall_complete_cb complete,
static void console_write(CPUState *cs, gdb_syscall_complete_cb complete,
GuestFD *gf, target_ulong buf, target_ulong len)
{
- CPUArchState *env G_GNUC_UNUSED = cs->env_ptr;
+ CPUArchState *env G_GNUC_UNUSED = cpu_env(cs);
char *ptr = lock_user(VERIFY_READ, buf, len, 1);
int ret;