/*
* m68k simulator syscall interface
- *
+ *
* Copyright (c) 2005 CodeSourcery, LLC. Written by Paul Brook.
*
* This program is free software; you can redistribute it and/or modify
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <time.h>
+#include "qemu/osdep.h"
#include "qemu.h"
#define SYS_ISATTY 29
#define SYS_LSEEK 199
-struct m86k_sim_stat {
+struct m68k_sim_stat {
uint16_t sim_st_dev;
uint16_t sim_st_ino;
uint32_t sim_st_mode;
#define ARG(x) tswap32(args[x])
void do_m68k_simcall(CPUM68KState *env, int nr)
{
+ M68kCPU *cpu = m68k_env_get_cpu(env);
uint32_t *args;
- args = (uint32_t *)(env->aregs[7] + 4);
+ args = (uint32_t *)(unsigned long)(env->aregs[7] + 4);
switch (nr) {
case SYS_EXIT:
exit(ARG(0));
case SYS_READ:
- check_err(env, read(ARG(0), (void *)ARG(1), ARG(2)));
+ check_err(env, read(ARG(0), (void *)(unsigned long)ARG(1), ARG(2)));
break;
case SYS_WRITE:
- check_err(env, write(ARG(0), (void *)ARG(1), ARG(2)));
+ check_err(env, write(ARG(0), (void *)(unsigned long)ARG(1), ARG(2)));
break;
case SYS_OPEN:
- check_err(env, open((char *)ARG(0), translate_openflags(ARG(1)),
- ARG(2)));
+ check_err(env, open((char *)(unsigned long)ARG(0),
+ translate_openflags(ARG(1)), ARG(2)));
break;
case SYS_CLOSE:
{
{
int32_t ret;
- ret = do_brk((void *)ARG(0));
+ ret = do_brk((abi_ulong)ARG(0));
if (ret == -ENOMEM)
ret = -1;
check_err(env, ret);
{
struct stat s;
int rc;
- struct m86k_sim_stat *p;
+ struct m68k_sim_stat *p;
rc = check_err(env, fstat(ARG(0), &s));
if (rc == 0) {
- p = (struct m86k_sim_stat *)ARG(1);
+ p = (struct m68k_sim_stat *)(unsigned long)ARG(1);
p->sim_st_dev = tswap16(s.st_dev);
p->sim_st_ino = tswap16(s.st_ino);
p->sim_st_mode = tswap32(s.st_mode);
check_err(env, lseek(ARG(0), (int32_t)ARG(1), ARG(2)));
break;
default:
- cpu_abort(env, "Unsupported m68k sim syscall %d\n", nr);
+ cpu_abort(CPU(cpu), "Unsupported m68k sim syscall %d\n", nr);
}
}