From: Kaushik Phatak <Kaushik.Phatak@kpitcummins.com>
To: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Cc: Yao Qi <yao@codesourcery.com>, Mike Frysinger <vapier@gentoo.org>
Subject: RE: [RFC] New GDB Port CR16
Date: Tue, 28 Aug 2012 14:47:00 -0000 [thread overview]
Message-ID: <C6CA53A2A46BA7469348BDBD663AB65845B28084@KCHJEXMB03.kpit.com> (raw)
In-Reply-To: <503B9E59.6050502@codesourcery.com>
[-- Attachment #1: Type: text/plain, Size: 1633 bytes --]
Hi Mike,Yao,
Thanks for all your comments.
> might be nice if you were to split them up and commit them separately
I have attached an updated patch with purely sim port related changes.
The patch changes the following files in gdb-sim
/sim/common/gennltvals.sh
/sim/common/nltvals.def
/sim/cr16/cr16_sim.h
/sim/cr16/interp.c
/sim/cr16/simops.c
I have tried to address the other points as follows,
> but that should be "(void)". i imagine this sim port probably has
> a bunch of those bugs lurking though.
Yes, but I have not tinkered with this as yet.
> pretty sure the indentation here is incorrect.
My mistake. This was a switch inside a switch and my case statements were
aligned with the first level case statements. This is now fixed.
> please do not use C++ style comments
This is now fixed.
> this new local prototype makes no sense. just delete it.
OK. I will create separate binutils patch with these changes and submit it
to binutils at sourceware dot org as per Yao Qi's suggestion.
> The changes for top-level configure stuff should be submitted to
> gcc-patches with changelog entry.
Thanks Yao for these patch submission tips.
2012-08-28 Kaushik Phatak <kaushik.phatak@kpitcummins.com>
sim/common/
* gennltvals.sh: Use libgloss/syscall.h for cr16.
* nltvals.def: Regenerate.
sim/cr16/ChangeLog:
* interp.c (sim_complete_command): New stub function.
* cr16_sim.h : Add defines for TRAP handling.
* simops.c: Breakpoint handling code.
Thanks & Best Regards,
Kaushik
kaushik.phatak@kpitcummins.com
KPIT Cummins Infosystems Ltd
www.kpitcummins.com
[-- Attachment #2: cr16_sim.diff --]
[-- Type: application/octet-stream, Size: 4001 bytes --]
--- gdb_src.orig/sim/common/gennltvals.sh 2012-03-19 10:24:48.000000000 +0530
+++ ./gdb_src/sim/common/gennltvals.sh 2012-08-17 15:35:15.000000000 +0530
@@ -41,7 +41,7 @@ $shell ${srccom}/gentvals.sh $target sys
# OBSOLETE $shell ${srccom}/gentvals.sh $target sys ${srcroot}/$dir \
# OBSOLETE "syscall.h" 'SYS_[_[:alnum:]]*' "${cpp}"
-dir=libgloss target=cr16
+dir=libgloss/cr16/sys target=cr16
$shell ${srccom}/gentvals.sh $target sys ${srcroot}/$dir \
"syscall.h" 'SYS_[_[:alnum:]]*' "${cpp}"
--- gdb_src.orig/sim/common/nltvals.def 2011-05-26 23:50:13.000000000 +0530
+++ ./gdb_src/sim/common/nltvals.def 2012-08-17 15:36:39.000000000 +0530
@@ -218,30 +218,34 @@
#ifdef sys_defs
/* from syscall.h */
/* begin cr16 sys target macros */
- { "SYS_argc", 22 },
- { "SYS_argn", 24 },
- { "SYS_argnlen", 23 },
- { "SYS_argv", 13 },
- { "SYS_argvlen", 12 },
- { "SYS_chdir", 14 },
- { "SYS_chmod", 16 },
- { "SYS_close", 3 },
- { "SYS_exit", 1 },
- { "SYS_fstat", 10 },
- { "SYS_getpid", 8 },
- { "SYS_gettimeofday", 19 },
- { "SYS_kill", 9 },
- { "SYS_link", 21 },
- { "SYS_lseek", 6 },
- { "SYS_open", 2 },
- { "SYS_read", 4 },
- { "SYS_reconfig", 25 },
- { "SYS_stat", 15 },
- { "SYS_time", 18 },
- { "SYS_times", 20 },
- { "SYS_unlink", 7 },
- { "SYS_utime", 17 },
- { "SYS_write", 5 },
+ { "SYS_ARG", 24 },
+ { "SYS_chdir", 12 },
+ { "SYS_chmod", 15 },
+ { "SYS_chown", 16 },
+ { "SYS_close", 0x402 },
+ { "SYS_create", 8 },
+ { "SYS_execv", 11 },
+ { "SYS_execve", 59 },
+ { "SYS_exit", 0x410 },
+ { "SYS_fork", 2 },
+ { "SYS_fstat", 22 },
+ { "SYS_getpid", 20 },
+ { "SYS_isatty", 21 },
+ { "SYS_kill", 60 },
+ { "SYS_link", 9 },
+ { "SYS_lseek", 0x405 },
+ { "SYS_mknod", 14 },
+ { "SYS_open", 0x401 },
+ { "SYS_pipe", 42 },
+ { "SYS_read", 0x403 },
+ { "SYS_rename", 0x406 },
+ { "SYS_stat", 38 },
+ { "SYS_time", 0x300 },
+ { "SYS_unlink", 0x407 },
+ { "SYS_utime", 201 },
+ { "SYS_wait", 202 },
+ { "SYS_wait4", 7 },
+ { "SYS_write", 0x404 },
/* end cr16 sys target macros */
#endif
#endif
--- gdb_src.orig/sim/cr16/cr16_sim.h 2012-01-04 13:58:07.000000000 +0530
+++ ./gdb_src/sim/cr16/cr16_sim.h 2012-08-24 17:22:24.000000000 +0530
@@ -472,3 +472,9 @@ extern void write_longlong PARAMS ((uint
PSR is masked for zero bits. */
extern creg_t move_to_cr (int cr, creg_t mask, creg_t val, int psw_hw_p);
+
+#ifndef SIGTRAP
+#define SIGTRAP 5
+#endif
+/* Special purpose trap */
+#define TRAP_BREAKPOINT 8
--- gdb_src.orig/sim/cr16/interp.c 2012-06-18 05:04:17.000000000 +0530
+++ ./gdb_src/sim/cr16/interp.c 2012-08-17 15:41:35.000000000 +0530
@@ -1192,7 +1192,11 @@ sim_resume (SIM_DESC sd, int step, int s
iaddr = imem_addr ((uint32)PC);
if (iaddr == State.mem.fault)
{
+#ifdef SIGBUS
State.exception = SIGBUS;
+#else
+ State.exception = SIGSEGV;
+#endif
break;
}
@@ -1548,6 +1552,11 @@ sim_store_register (sd, rn, memory, leng
return size;
}
+char **
+sim_complete_command (SIM_DESC sd, char *text, char *word)
+{
+ return NULL;
+}
void
sim_do_command (sd, cmd)
--- gdb_src.orig/sim/cr16/simops.c 2012-01-04 13:58:07.000000000 +0530
+++ ./gdb_src/sim/cr16/simops.c 2012-08-28 17:57:49.000000000 +0530
@@ -5059,6 +5059,8 @@ OP_14C_14 ()
void
OP_C_C ()
{
+ uint32 tmp;
+ uint16 a;
trace_input ("excp", OP_CONSTANT4, OP_VOID, OP_VOID);
switch (OP[0])
{
@@ -5465,9 +5467,24 @@ OP_C_C ()
#endif
default:
- cr16_callback->error (cr16_callback, "Unknown syscall %d", FUNC);
+ a = OP[0];
+ switch(a)
+ {
+ case TRAP_BREAKPOINT:
+ State.exception = SIGTRAP;
+ tmp = (PC);
+ JMP(tmp);
+ trace_output_void ();
+ break;
+ case SIGTRAP: /* supervisor call ? */
+ State.exception = SIG_CR16_EXIT;
+ trace_output_void ();
+ break;
+ default:
+ cr16_callback->error (cr16_callback, "Unknown syscall %d", FUNC);
+ break;
+ }
}
-
if ((uint16) result == (uint16) -1)
RETERR (cr16_callback->get_errno(cr16_callback));
else
next prev parent reply other threads:[~2012-08-28 14:47 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-27 6:37 Kaushik Phatak
2012-08-27 16:21 ` Yao Qi
2012-08-28 14:47 ` Kaushik Phatak [this message]
2012-08-29 22:14 ` Mike Frysinger
2012-08-30 5:23 ` Kaushik Phatak
2012-08-30 6:10 ` Mike Frysinger
2012-09-03 9:31 ` Pedro Alves
2012-09-04 3:52 ` Mike Frysinger
2012-09-04 6:50 ` Kaushik Phatak
2012-09-07 17:47 ` Pedro Alves
2012-09-11 13:16 ` Kaushik Phatak
2012-09-11 19:02 ` Mike Frysinger
2012-09-24 12:55 ` Kaushik Phatak
2012-09-11 19:00 ` Mike Frysinger
2012-08-27 21:10 ` Mike Frysinger
2012-08-28 16:24 ` Pedro Alves
2012-08-30 4:49 ` Kaushik Phatak
2012-08-30 5:14 ` Yao Qi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=C6CA53A2A46BA7469348BDBD663AB65845B28084@KCHJEXMB03.kpit.com \
--to=kaushik.phatak@kpitcummins.com \
--cc=gdb-patches@sourceware.org \
--cc=vapier@gentoo.org \
--cc=yao@codesourcery.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox