Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* Add support for RedBoot SWIs to ARM Simulator
@ 2002-05-09  3:09 Nick Clifton
  2002-05-09  3:22 ` Richard Earnshaw
  0 siblings, 1 reply; 21+ messages in thread
From: Nick Clifton @ 2002-05-09  3:09 UTC (permalink / raw)
  To: gdb-patches

Hi Guys,

  I am applying the patch below to add support for the SWI used by
  RedBoot to implement some of its system calls.  The patch only
  supports those system calls already supported by the simulator's
  Angel and Demon SWI protocol support.

  Note - it is not possible to support the RedBoot SWI in Thumb mode,
  since this SWI value - 0x18 - is also the thumb breakpoint value
  used by GDB.

Cheers
        Nick

2002-05-09  Nick Clifton  <nickc@cambridge.redhat.com>

	* armos.c (ARMul_OSHandleSWI): Support the RedBoot SWI in ARM
	mode and some of its system calls.

Index: sim/arm/armos.c
===================================================================
RCS file: /cvs/src/src/sim/arm/armos.c,v
retrieving revision 1.11
diff -c -3 -p -w -r1.11 armos.c
*** sim/arm/armos.c	21 Feb 2002 20:22:49 -0000	1.11
--- sim/arm/armos.c	9 May 2002 10:01:16 -0000
*************** ARMul_OSHandleSWI (ARMul_State * state, 
*** 635,640 ****
--- 635,703 ----
        /* These are used by the FPE code.  */
        break;
        
+     case 0x180001: /* RedBoot's Syscall SWI in ARM mode.  */
+       switch (state->Reg[0])
+ 	{
+ 	  /* These numbers are defined in libgloss/syscall.h
+ 	     but the simulator should not be dependend upon
+ 	     libgloss being installed.  */
+ 	case 1:  /* Exit.  */
+ 	  state->Emulate = FALSE;
+ 	  return TRUE;
+ 
+ 	case 2:  /* Open.  */
+ 	  SWIopen (state, state->Reg[1], state->Reg[2]);
+ 	  return TRUE;
+ 
+ 	case 3:  /* Close.  */
+ 	  state->Reg[0] = close (state->Reg[1]);
+ 	  OSptr->ErrorNo = errno;
+ 	  return TRUE;
+ 
+ 	case 4:  /* Read.  */
+ 	  SWIread (state, state->Reg[1], state->Reg[2], state->Reg[3]);
+ 	  return TRUE;
+ 
+ 	case 5:  /* Write.  */
+ 	  SWIwrite (state, state->Reg[1], state->Reg[2], state->Reg[3]);
+ 	  return TRUE;
+ 
+ 	case 6:  /* Lseek.  */
+ 	  state->Reg[0] = lseek (state->Reg[1], state->Reg[2], state->Reg[3]);
+ 	  OSptr->ErrorNo = errno;
+ 	  return TRUE;
+ 
+ 	case 17: /* Utime.  */
+ 	  state->Reg[0] = (ARMword) time (state->Reg[1]);
+ 	  OSptr->ErrorNo = errno;
+ 	  return (TRUE);
+ 
+ 	case 7:  /* Unlink.  */
+ 	case 8:  /* Getpid.  */
+ 	case 9:  /* Kill.  */
+ 	case 10: /* Fstat.  */
+ 	case 11: /* Sbrk.  */
+ 	case 12: /* Argvlen.  */
+ 	case 13: /* Argv.  */
+ 	case 14: /* ChDir.  */
+ 	case 15: /* Stat.  */
+ 	case 16: /* Chmod.  */
+ 	case 18: /* Time.  */
+ 	  sim_callback->printf_filtered
+ 	    (sim_callback,
+ 	     "sim: unhandled RedBoot syscall '%d' encountered - ignoring\n",
+ 	     state->Reg[0]);
+ 	  return FALSE;
+ 
+ 	default:
+ 	  sim_callback->printf_filtered
+ 	    (sim_callback,
+ 	     "sim: unknown RedBoot syscall '%d' encountered - ignoring\n",
+ 	     state->Reg[0]);
+ 	  return FALSE;
+ 	}
+       return TRUE;
+       
      default:
        /* If there is a SWI vector installed use it.  */
        if (state->is_XScale && saved_number != -1)


^ permalink raw reply	[flat|nested] 21+ messages in thread
* Re: Add support for target switches in simulator
@ 2002-05-20  7:49 Nick Clifton
  0 siblings, 0 replies; 21+ messages in thread
From: Nick Clifton @ 2002-05-20  7:49 UTC (permalink / raw)
  To: gdb-patches

Hi Guys,

  I have checked the patch in.  It occurs to me however, that I failed
  to document the new feature.  So how about the following patch ?

  (I am not sure about the exact formatting for GDB texinfo additions,
  but I gave it my best shot).

  May I apply this patch too ?

Cheers
        Nick

gdb/ChangeLog
2002-05-20  Nick Clifton  <nickc@cambridge.redhat.com>

	* NEWS: Mention new command line switch supported by arm
	simulator.
        * doc/gdb.texinfo: Document new command line switch supported
	by arm simulator.


Index: gdb/NEWS
===================================================================
RCS file: /cvs/src/src/gdb/NEWS,v
retrieving revision 1.70
diff -c -3 -p -w -r1.70 NEWS
*** gdb/NEWS	17 May 2002 18:02:20 -0000	1.70
--- gdb/NEWS	20 May 2002 14:46:12 -0000
***************
*** 3,8 ****
--- 3,11 ----
  
  *** Changes since GDB 5.2:
  
+ * ARM simulator now supports a command line switch to select which SWI
+   protocols to emulate.  Use --swi-support={none|demon|angel|redboot}.
+ 
  * GDB now supports C/C++ preprocessor macros.
  
  GDB now expands preprocessor macro invocations in C/C++ expressions,

Index: gdb/doc/gdb.texinfo
===================================================================
RCS file: /cvs/src/src/gdb/doc/gdb.texinfo,v
retrieving revision 1.100
diff -c -3 -p -w -r1.100 gdb.texinfo
*** gdb/doc/gdb.texinfo	17 May 2002 18:00:03 -0000	1.100
--- gdb/doc/gdb.texinfo	20 May 2002 14:46:18 -0000
*************** monitor, or with the EmbeddedICE JTAG de
*** 11315,11320 ****
--- 11315,11327 ----
  @item target rdp @var{dev}
  ARM Demon monitor.
  
+ @kindex target sim
+ @kindex --swi-support
+ @item target sim @r{[}@samp{--swi-support=@var{none|demon|angel|redboot|all}}@r{]}
+ Use this switch to run on the builtin ARM simulator·  The optional
+ @samp{--swi-support} switch can be used to select which SWI
+ protocol(s) to support.  By default all three are supported.
+ 
  @end table
  
  @node H8/300




^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2002-05-20 14:49 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-05-09  3:09 Add support for RedBoot SWIs to ARM Simulator Nick Clifton
2002-05-09  3:22 ` Richard Earnshaw
2002-05-09  4:00   ` Nick Clifton
2002-05-09  4:11     ` Richard Earnshaw
2002-05-16  9:16       ` Add support for target switches in simulator Nick Clifton
2002-05-16  9:25         ` Richard Earnshaw
2002-05-17  1:58           ` Nick Clifton
2002-05-17  5:37             ` Richard Earnshaw
2002-05-17  6:46               ` Nick Clifton
2002-05-17 10:17                 ` Andrew Cagney
2002-05-17  7:33             ` Frank Ch. Eigler
2002-05-17 10:29             ` Andrew Cagney
2002-05-16  9:36         ` Frank Ch. Eigler
2002-05-16 11:08         ` Michael Snyder
2002-05-17 11:32         ` Andrew Cagney
2002-05-20  6:11           ` Nick Clifton
2002-05-20  7:12             ` Andrew Cagney
2002-05-20  7:19             ` Richard Earnshaw
2002-05-20  7:26               ` Nick Clifton
2002-05-09  7:35     ` Add support for RedBoot SWIs to ARM Simulator Frank Ch. Eigler
2002-05-20  7:49 Add support for target switches in simulator Nick Clifton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox