* [PATCH 1/3 committed] sim: m32r: add more cgen prototypes for traps
@ 2023-12-08 4:42 Mike Frysinger
2023-12-08 4:42 ` [PATCH 2/3 committed] sim: m32r: include more glibc headers for the funcs we use [PR sim/29752] Mike Frysinger
2023-12-08 4:42 ` [PATCH 3/3 committed] sim: m32r: fix syslog call Mike Frysinger
0 siblings, 2 replies; 3+ messages in thread
From: Mike Frysinger @ 2023-12-08 4:42 UTC (permalink / raw)
To: gdb-patches
The traps file uses a bunch of functions directly without prototypes,
and we can't safely include the relevant cpu*.h files for them.
---
sim/m32r/m32r-sim.h | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/sim/m32r/m32r-sim.h b/sim/m32r/m32r-sim.h
index c72be52e18ae..875fc23bf3ef 100644
--- a/sim/m32r/m32r-sim.h
+++ b/sim/m32r/m32r-sim.h
@@ -47,6 +47,18 @@ extern void m32rbf_model_insn_before (SIM_CPU *, int);
extern void m32rbf_model_insn_after (SIM_CPU *, int, int);
extern CPUREG_FETCH_FN m32rbf_fetch_register;
extern CPUREG_STORE_FN m32rbf_store_register;
+extern UQI m32rbf_h_psw_get (SIM_CPU *);
+extern void m32rbf_h_psw_set (SIM_CPU *, UQI);
+extern UQI m32r2f_h_psw_get (SIM_CPU *);
+extern void m32r2f_h_psw_set (SIM_CPU *, UQI);
+extern UQI m32rxf_h_psw_get (SIM_CPU *);
+extern void m32rxf_h_psw_set (SIM_CPU *, UQI);
+extern void m32rbf_h_bpsw_set (SIM_CPU *, UQI);
+extern void m32r2f_h_bpsw_set (SIM_CPU *, UQI);
+extern void m32rxf_h_bpsw_set (SIM_CPU *, UQI);
+extern SI m32rbf_h_gr_get (SIM_CPU *, UINT);
+extern void m32rbf_h_gr_set (SIM_CPU *, UINT, SI);
+extern USI m32rbf_h_cr_get (SIM_CPU *, UINT);
extern void m32rbf_h_cr_set (SIM_CPU *, UINT, USI);
/* Cover macros for hardware accesses.
--
2.43.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 2/3 committed] sim: m32r: include more glibc headers for the funcs we use [PR sim/29752]
2023-12-08 4:42 [PATCH 1/3 committed] sim: m32r: add more cgen prototypes for traps Mike Frysinger
@ 2023-12-08 4:42 ` Mike Frysinger
2023-12-08 4:42 ` [PATCH 3/3 committed] sim: m32r: fix syslog call Mike Frysinger
1 sibling, 0 replies; 3+ messages in thread
From: Mike Frysinger @ 2023-12-08 4:42 UTC (permalink / raw)
To: gdb-patches
Not exactly portable, but doesn't make the situation worse here, and
fixes a lot of implicit function warnings.
Bug: https://sourceware.org/PR29752
---
sim/m32r/traps.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/sim/m32r/traps.c b/sim/m32r/traps.c
index 060b331c28f1..80c4360235b6 100644
--- a/sim/m32r/traps.c
+++ b/sim/m32r/traps.c
@@ -38,9 +38,14 @@
NB: The emulation is also missing argument conversion (endian & bitsize)
even on Linux hosts. */
#ifdef __linux__
+#include <syslog.h>
+#include <sys/file.h>
+#include <sys/fsuid.h>
+#include <sys/ioctl.h>
#include <sys/mman.h>
#include <sys/poll.h>
#include <sys/resource.h>
+#include <sys/sendfile.h>
#include <sys/sysinfo.h>
#include <sys/stat.h>
#include <sys/time.h>
--
2.43.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 3/3 committed] sim: m32r: fix syslog call
2023-12-08 4:42 [PATCH 1/3 committed] sim: m32r: add more cgen prototypes for traps Mike Frysinger
2023-12-08 4:42 ` [PATCH 2/3 committed] sim: m32r: include more glibc headers for the funcs we use [PR sim/29752] Mike Frysinger
@ 2023-12-08 4:42 ` Mike Frysinger
1 sibling, 0 replies; 3+ messages in thread
From: Mike Frysinger @ 2023-12-08 4:42 UTC (permalink / raw)
To: gdb-patches
The function returns void, not int. We only pass one argument to
syslog (the format), so use %s as the static format instead since
the emulation layer doesn't handle passing additional arguments.
---
sim/m32r/traps.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/sim/m32r/traps.c b/sim/m32r/traps.c
index 80c4360235b6..51fe0d484a5e 100644
--- a/sim/m32r/traps.c
+++ b/sim/m32r/traps.c
@@ -843,7 +843,8 @@ m32r_trap (SIM_CPU *current_cpu, PCADDR pc, int num)
break;
case TARGET_LINUX_SYS_syslog:
- result = syslog (arg1, (char *) t2h_addr (cb, &s, arg2));
+ syslog (arg1, "%s", (char *) t2h_addr (cb, &s, arg2));
+ result = 0;
errcode = errno;
break;
--
2.43.0
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-12-08 4:42 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-08 4:42 [PATCH 1/3 committed] sim: m32r: add more cgen prototypes for traps Mike Frysinger
2023-12-08 4:42 ` [PATCH 2/3 committed] sim: m32r: include more glibc headers for the funcs we use [PR sim/29752] Mike Frysinger
2023-12-08 4:42 ` [PATCH 3/3 committed] sim: m32r: fix syslog call Mike Frysinger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).