#include "sim-main.h"
#include "sim-base.h"
#include "sim-options.h"
+#include "sim-io.h"
typedef int word;
typedef unsigned int uword;
char fname[1024];
int mode = (int) convert_target_flags ((unsigned) cpu.asregs.regs[3]);
int perm = (int) cpu.asregs.regs[4];
- int fd = open (fname, mode, perm);
+ int fd;
sim_core_read_buffer (sd, scpu, read_map, fname,
cpu.asregs.regs[2], 1024);
+ fd = sim_io_open (sd, fname, mode);
/* FIXME - set errno */
cpu.asregs.regs[2] = fd;
break;
int fd = cpu.asregs.regs[2];
unsigned len = (unsigned) cpu.asregs.regs[4];
char *buf = malloc (len);
- cpu.asregs.regs[2] = read (fd, buf, len);
+ cpu.asregs.regs[2] = sim_io_read (sd, fd, buf, len);
sim_core_write_buffer (sd, scpu, write_map, buf,
cpu.asregs.regs[3], len);
free (buf);
str = malloc (len);
sim_core_read_buffer (sd, scpu, read_map, str,
cpu.asregs.regs[3], len);
- count = write (cpu.asregs.regs[2], str, len);
+ count = sim_io_write (sd, cpu.asregs.regs[2], str, len);
free (str);
cpu.asregs.regs[2] = count;
break;
}
+ case 0x7: /* SYS_unlink */
+ {
+ char fname[1024];
+ int fd;
+ sim_core_read_buffer (sd, scpu, read_map, fname,
+ cpu.asregs.regs[2], 1024);
+ fd = sim_io_unlink (sd, fname);
+ /* FIXME - set errno */
+ cpu.asregs.regs[2] = fd;
+ break;
+ }
case 0xffffffff: /* Linux System Call */
{
unsigned int handler = cpu.asregs.sregs[1];