public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
From: Pierre Habraken <Pierre.Habraken@imag.fr>
To: Jonathan Larmour <jifl@eCosCentric.com>
Cc: Mark Salter <msalter@redhat.com>,
	eCos discussion <ecos-discuss@sources.redhat.com>
Subject: Re: [ECOS] Calling exit in a Redboot standalone Arm program
Date: Thu, 01 May 2003 15:05:00 -0000	[thread overview]
Message-ID: <3EB13580.9E282799@imag.fr> (raw)
In-Reply-To: <3EA74B92.1050107@eCosCentric.com>

Jonathan Larmour wrote:
> 
> Just to avoid any doubt, Pierre, are you going to look at this?
> You're the one with the incentive to do it :-).
> Look at the various places that go_saved_context is used in
> redboot's src/main.c.
> 
> I think the attached patch might do it, but it's purely off the
> top of my head. If it does then all you need to do to finish it
> off is just rename go_saved_context to redboot_return_context or
> something like that, and something similar for go_trampoline;
> and then most importantly test it with the below exit status change
> as well to verify it all builds and works. Oh, and add ChangeLog
> entries :).

I'm back after I have been busy for some time with some other matters.
So, I just applied your patch to main.c (together with the change in
syscall.c): it produces the expected behavior.
However, I have not understood why you said I had to rename
'go_saved_context' and 'go_trampoline': I just added some early
declaration for both features at the beginning of the file and then
everything built and ran fine. But I probably missed something. Could
you please clarify that point ?

In accordance with Mark's previous warning I checked that this time
quitting gdb makes RedBoot return to its main prompt.
BTW, Mark, you expressed in an other message some doubts about the use
of HAL_THREAD_* macros. What about the patch as it was proposed by
Jonathan ?

Besides that I also created a cdl option named
CYGOPT_REDBOOT_BSP_SYSCALLS_EXIT_WITHOUT_TRAP so that this new feature
be enabled in syscall.c when it is desirable only.

I am waiting for confirmation from both of you, Jonathan and Mark, and
then I'll send a full patch with ChangeLog entry.

Pierre


> Mark Salter wrote:
> >>>>>>Jonathan Larmour writes:
> >
> >
> >>Pierre Habraken wrote:
> >>
> >>>Mark Salter wrote:
> >>>
> >>>
> >>>>[...]
> >>>>Something to watch out for is that any patch not break the ability to
> >>>>quit GDB and return to the RedBoot prompt.
> >
> >
> >>Haven't tried it so I'm probably way off base, but could this maybe simply
> >>be done by making the code in question just be:
> >
> >
> >>        __send_exit_status((int)arg1);
> >>        CYGACC_CALL_IF_MONITOR_RETURN(arg1);
> >
> >
> > This isn't way off base, but it won't work right now. The context used by
> > CYGACC_CALL_IF_MONITOR_RETURN is only setup through the 'go' command right
> > now. The return back to stub is handled by saving a context on the first
> > entry to the stub and then restoring that context when a 'k' packet is
> > received from GDB. We could get rid of that mechanism (good riddance) and
> > setup a context for CYGACC_CALL_IF_MONITOR_RETURN before entering the stub.
> >
> > --Mark
> >
> 
> --
> eCosCentric    http://www.eCosCentric.com/    The eCos and RedBoot experts
> --[ "You can complain because roses have thorns, or you ]--
> --[  can rejoice because thorns have roses." -Lincoln   ]-- Opinions==mine
> 
>   ------------------------------------------------------------------------
> ? src/flash.c.at91flash.dead
> Index: src/main.c
> ===================================================================
> RCS file: /cvs/ecos/ecos/packages/redboot/current/src/main.c,v
> retrieving revision 1.44
> diff -u -5 -p -r1.44 main.c
> --- src/main.c  8 Apr 2003 05:09:06 -0000       1.44
> +++ src/main.c  24 Apr 2003 02:24:53 -0000
> @@ -314,14 +314,20 @@ cyg_start(void)
>                      __chan = CYGACC_CALL_IF_CONSOLE_PROCS();
>                      CYGACC_COMM_IF_CONTROL( *__chan, __COMMCTL_IRQ_DISABLE );
>                  }
> 
>                  CYGACC_CALL_IF_SET_CONSOLE_COMM(cur);
> +                // set up a temporary context that will take us to the trampoline
> +                HAL_THREAD_INIT_CONTEXT((CYG_ADDRESS)workspace_end, &breakpoint, go_trampoline, 0);
> +
> +                // switch context to trampoline
> +                HAL_THREAD_SWITCH_CONTEXT(&go_saved_context, &workspace_end);
> +
>  #ifdef HAL_ARCH_PROGRAM_NEW_STACK
> -                HAL_ARCH_PROGRAM_NEW_STACK(breakpoint);
> +                //                HAL_ARCH_PROGRAM_NEW_STACK(breakpoint);
>  #else
> -                breakpoint();  // Get GDB stubs started, with a proper environment, etc.
> +                //                breakpoint();  // Get GDB stubs started, with a proper environment, etc.
>  #endif
>                 dbgchan = CYGACC_CALL_IF_SET_DEBUG_COMM(CYGNUM_CALL_IF_SET_COMM_ID_QUERY_CURRENT);
>                 CYGACC_CALL_IF_SET_CONSOLE_COMM(dbgchan);
>              } else
>  #endif // CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS

-- 
________________________________________________________________________
Pierre HABRAKEN - mailto:Pierre.Habraken@imag.fr
Tél: 04 76 82 72 83 - Fax: 04 76 82 72 87
IMAG-LSR BP72 38402 SAINT MARTIN D'HERES Cedex
________________________________________________________________________


-- 
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss

  parent reply	other threads:[~2003-05-01 15:05 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-04-22 13:27 Pierre Habraken
2003-04-22 15:27 ` Mark Salter
2003-04-22 15:45   ` Pierre Habraken
2003-04-22 21:27     ` Jonathan Larmour
2003-04-23  7:55       ` Mark Salter
2003-04-24  2:30         ` Jonathan Larmour
2003-04-24 10:28           ` Pierre Habraken
2003-05-01 15:05           ` Pierre Habraken [this message]
2003-05-01 15:32             ` Mark Salter
2003-05-02 12:45               ` Pierre Habraken
2003-05-02 13:46                 ` Mark Salter
2003-05-05 12:43                   ` Pierre Habraken
2003-05-01 20:40             ` Pierre Habraken
2003-04-23 17:12       ` Pierre Habraken
2003-04-24 13:53       ` Mark Salter

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=3EB13580.9E282799@imag.fr \
    --to=pierre.habraken@imag.fr \
    --cc=ecos-discuss@sources.redhat.com \
    --cc=jifl@eCosCentric.com \
    --cc=msalter@redhat.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).