aboutsummaryrefslogtreecommitdiff
path: root/sim
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2011-07-01 21:53:03 +0000
committerMike Frysinger <vapier@gentoo.org>2011-07-01 21:53:03 +0000
commita931db6a07ac9ae2fec6c31c6d037716050292c5 (patch)
tree4ae86b6bf7e92b30add57e9adac06ab20c6bd13c /sim
parent418c7cf76163513b4e26ff980214fc68bab5e0d5 (diff)
downloadgdb-a931db6a07ac9ae2fec6c31c6d037716050292c5.zip
gdb-a931db6a07ac9ae2fec6c31c6d037716050292c5.tar.gz
gdb-a931db6a07ac9ae2fec6c31c6d037716050292c5.tar.bz2
sim: bfin: implement stat_map for virtual environments (libgloss)
The stat syscalls cannot work without a stat map, so declare one that matches libgloss for virtual environments. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'sim')
-rw-r--r--sim/bfin/ChangeLog11
-rw-r--r--sim/bfin/interp.c23
2 files changed, 30 insertions, 4 deletions
diff --git a/sim/bfin/ChangeLog b/sim/bfin/ChangeLog
index a504f7a..bb79cde 100644
--- a/sim/bfin/ChangeLog
+++ b/sim/bfin/ChangeLog
@@ -1,3 +1,14 @@
+2011-07-01 Mike Frysinger <vapier@gentoo.org>
+
+ * interp.c (cb_linux_stat_map_32, cb_linux_stat_map_64): Rename from
+ stat_map_32 and stat_map_64.
+ (cb_libgloss_stat_map_32): New stat map.
+ (stat_map_32, stat_map_64): New stat map pointers.
+ (bfin_user_init): Assign stat_map_32 to cb_linux_stat_map_32 and
+ stat_map_64 to cb_linux_stat_map_64.
+ (bfin_virtual_init): New function.
+ (sim_create_inferior): Call bfin_virtual_init for all other envs.
+
2011-06-22 Mike Frysinger <vapier@gentoo.org>
* interp.c (bfin_syscall): Delete old comment. Set dreg 1 to
diff --git a/sim/bfin/interp.c b/sim/bfin/interp.c
index 583b82e..f22c378 100644
--- a/sim/bfin/interp.c
+++ b/sim/bfin/interp.c
@@ -89,7 +89,7 @@
# define setgid(gid) -1
#endif
-static const char stat_map_32[] =
+static const char cb_linux_stat_map_32[] =
/* Linux kernel 32bit layout: */
"st_dev,2:space,2:st_ino,4:st_mode,2:st_nlink,2:st_uid,2:st_gid,2:st_rdev,2:"
"space,2:st_size,4:st_blksize,4:st_blocks,4:st_atime,4:st_atimensec,4:"
@@ -99,10 +99,15 @@ static const char stat_map_32[] =
"st_rdev,8:space,2:space,2:st_size,4:st_blksiez,4:st_blocks,4:st_atime,4:"
"st_atimensec,4:st_mtime,4:st_mtimensec,4:st_ctime,4:st_ctimensec,4:space,4:"
"space,4"; */
-static const char stat_map_64[] =
+static const char cb_linux_stat_map_64[] =
"st_dev,8:space,4:space,4:st_mode,4:st_nlink,4:st_uid,4:st_gid,4:st_rdev,8:"
"space,4:st_size,8:st_blksize,4:st_blocks,8:st_atime,4:st_atimensec,4:"
"st_mtime,4:st_mtimensec,4:st_ctime,4:st_ctimensec,4:st_ino,8";
+static const char cb_libgloss_stat_map_32[] =
+"st_dev,2:st_ino,2:st_mode,4:st_nlink,2:st_uid,2:st_gid,2:st_rdev,2:"
+"st_size,4:st_atime,4:space,4:st_mtime,4:space,4:st_ctime,4:"
+"space,4:st_blksize,4:st_blocks,4:space,8";
+static const char *stat_map_32, *stat_map_64;
/* Count the number of arguments in an argv. */
static int
@@ -1173,7 +1178,8 @@ bfin_user_init (SIM_DESC sd, SIM_CPU *cpu, struct bfd *abfd,
cb->errno_map = cb_linux_errno_map;
cb->open_map = cb_linux_open_map;
cb->signal_map = cb_linux_signal_map;
- cb->stat_map = stat_map_32;
+ cb->stat_map = stat_map_32 = cb_linux_stat_map_32;
+ stat_map_64 = cb_linux_stat_map_64;
}
static void
@@ -1203,6 +1209,15 @@ bfin_os_init (SIM_DESC sd, SIM_CPU *cpu, const char * const *argv)
sim_write (sd, cmdline, &byte, 1);
}
+static void
+bfin_virtual_init (SIM_DESC sd, SIM_CPU *cpu)
+{
+ host_callback *cb = STATE_CALLBACK (sd);
+
+ cb->stat_map = stat_map_32 = cb_libgloss_stat_map_32;
+ stat_map_64 = NULL;
+}
+
SIM_RC
sim_create_inferior (SIM_DESC sd, struct bfd *abfd,
char **argv, char **env)
@@ -1235,7 +1250,7 @@ sim_create_inferior (SIM_DESC sd, struct bfd *abfd,
bfin_os_init (sd, cpu, (void *)argv);
break;
default:
- /* Nothing to do for virtual/all envs. */
+ bfin_virtual_init (sd, cpu);
break;
}