|
@@ -1,10 +1,14 @@
|
|
|
/*
|
|
|
- * Arm "Angel" semihosting syscalls
|
|
|
+ * Semihosting support for systems modeled on the Arm "Angel"
|
|
|
+ * semihosting syscalls design.
|
|
|
*
|
|
|
* Copyright (c) 2005, 2007 CodeSourcery.
|
|
|
* Copyright (c) 2019 Linaro
|
|
|
* Written by Paul Brook.
|
|
|
*
|
|
|
+ * Copyright © 2020 by Keith Packard <keithp@keithp.com>
|
|
|
+ * Adapted for systems other than ARM, including RISC-V, by Keith Packard
|
|
|
+ *
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
@@ -373,12 +377,12 @@ static target_ulong arm_gdb_syscall(ARMCPU *cpu, gdb_syscall_complete_cb cb,
|
|
|
* do anything with its return value, because it is not necessarily
|
|
|
* the result of the syscall, but could just be the old value of X0.
|
|
|
* The only thing safe to do with this is that the callers of
|
|
|
- * do_arm_semihosting() will write it straight back into X0.
|
|
|
+ * do_common_semihosting() will write it straight back into X0.
|
|
|
* (In linux-user mode, the callback will have happened before
|
|
|
* gdb_do_syscallv() returns.)
|
|
|
*
|
|
|
* We should tidy this up so neither this function nor
|
|
|
- * do_arm_semihosting() return a value, so the mistake of
|
|
|
+ * do_common_semihosting() return a value, so the mistake of
|
|
|
* doing something with the return value is not possible to make.
|
|
|
*/
|
|
|
|
|
@@ -675,10 +679,10 @@ static const GuestFDFunctions guestfd_fns[] = {
|
|
|
* leave the register unchanged. We use 0xdeadbeef as the return value
|
|
|
* when there isn't a defined return value for the call.
|
|
|
*/
|
|
|
-target_ulong do_arm_semihosting(CPUARMState *env)
|
|
|
+target_ulong do_common_semihosting(CPUState *cs)
|
|
|
{
|
|
|
- ARMCPU *cpu = env_archcpu(env);
|
|
|
- CPUState *cs = env_cpu(env);
|
|
|
+ ARMCPU *cpu = ARM_CPU(cs);
|
|
|
+ CPUARMState *env = &cpu->env;
|
|
|
target_ulong args;
|
|
|
target_ulong arg0, arg1, arg2, arg3;
|
|
|
char * s;
|