public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
From: Bart Veer <bartv@ecoscentric.com>
To: trollepi jj <jackoaway@hotmail.com>
Cc: ecos-discuss@ecos.sourceware.org
Subject: Re: [ECOS] how work synthetic for exceptions
Date: Thu, 03 Apr 2008 14:08:00 -0000	[thread overview]
Message-ID: <pnsky31386.fsf@delenn.bartv.net> (raw)
In-Reply-To: <BAY121-W10A5E191083B99BE94FEFBADF70@phx.gbl> (message from 	trollepi jj on Thu, 3 Apr 2008 13:00:03 +0100)

>>>>> "jjp" == trollepi jj <jackoaway@hotmail.com> writes:

    jjp> Hi,
    jjp> I try do modify the execution of a thread for the synthetic
    jjp> target. I've done that for an at91 board (using SWI,exception
    jjp> hanler and HAL_SavedRegisters to store the context info). I
    jjp> put an exception handler for the CYG_HAL_SYS_SIGILL to see if
    jjp> i get the info pointers of the handler (3rd parameter of the
    jjp> function). I reach the exception handler and have this
    jjp> backtrace call from gdb

    jjp> #0  simple_syscall_handler (data=2, number=0, info=0) at main.c:56
    jjp> #1  0x01004c7c in Cyg_Exception_Control::deliver_exception (this=0x2004560, exception_number=0, 
    jjp>     exception_info=0) at /home/pitrolle/ecos/ecos/packages/kernel/current/src/common/except.cxx:235
    jjp> #2  0x010042bf in Cyg_Thread::deliver_exception (this=0x20004c0, exception_number=0, exception_info=0)
    jjp>     at /home/pitrolle/ecos/ecos/packages/kernel/current/src/common/thread.cxx:1013
    jjp> #3  0x01004ce0 in cyg_hal_deliver_exception (code=0, data=0)
    jjp>     at /home/pitrolle/ecos/ecos/packages/kernel/current/src/common/except.cxx:248
    jjp> #4  0x0100160d in synth_exception_sighandler (sig=4)
    jjp>     at /home/pitrolle/ecos/ecos/packages/hal/synth/arch/current/src/synth_intr.c:460
    jjp> #5  0x01002e18 in cyg_hal_sys_restore_rt ()
    jjp>     at /home/pitrolle/ecos/ecos/packages/hal/synth/i386linux/current/src/syscall-i386-linux-1.0.S:446
    jjp> #6  0x00000004 in ?? ()
    jjp> #7  0x0100418c in idle_thread_main (data=0)
    jjp>     at /home/pitrolle/ecos/ecos/packages/kernel/current/src/common/thread.cxx:1231
    jjp> #8  0x01004be0 in Cyg_HardwareThread::thread_entry (thread=0x20004c0)
    jjp>     at /home/pitrolle/ecos/ecos/packages/kernel/current/src/common/thread.cxx:95
    jjp> #9  0x00000000 in ?? ()

    jjp> I have severals questions :
    jjp>  - What is the real aim of cyg_hal_sys_restore_rt?

From the source code (syscall-i386-linux-1.0.S):

// ----------------------------------------------------------------------------
// Special support for returning from a signal handler. In theory no special
// action is needed, but with some versions of the kernel on some
// architectures that is not good enough. Instead returning has to happen
// via another system call.         

        .align 16
        .global cyg_hal_sys_restore_rt
        ...

The exact details of low-level signal handling on x86 get very messy.
Generally it is best not to worry too much about the details.
	
    jjp>  - If I want to get the context of the thread on the
    jjp>  exception handler (info about saved registers like previous
    jjp>  pc,sp,...) , what can i process?

Currently the synthetic target HAL does not collect this information -
it is not required for a basic implementation of the HAL
specification. What you would probably need to do is modify the
architectural HAL's synth_intr.c so that when it installs
synth_exception_sighandler() with sigaction() it uses the
CYG_HAL_SYS_SA_SIGINFO flag (man sigaction for details). Then change
the exception handler to accept two additional arguments, a
cyg_hal_sys_siginfo_t and a cyg_hal_sys_ucontext_t. Both of these
structures will need to be defined somewhere, with ucontext_t
probably going into the i386linux HAL. Then you still have to figure
out what to do with the extra information.

Note that you can probably do most/all of this in your application if
desired, if you wish to avoid modifying the eCos HAL packages. During
startup your application can use cyg_hal_sys_sigaction() to install
replacement exception handlers.

Bart

-- 
Bart Veer                                   eCos Configuration Architect
eCosCentric Limited    The eCos experts      http://www.ecoscentric.com/
Barnwell House, Barnwell Drive, Cambridge, UK.      Tel: +44 1223 245571
Registered in England and Wales: Reg No 4422071.
  **  Visit us at ESC Silicon Valley <http://www.embedded.com/esc/sv>  **
  **  April 15-17 2008, Booth 3012, San Jose McEnery Convention Center **

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

  reply	other threads:[~2008-04-03 13:24 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-03 12:01 trollepi jj
2008-04-03 14:08 ` Bart Veer [this message]
2008-04-09  9:10   ` trollepi jj
2008-04-09  9:46     ` Andrew Lunn
2008-04-03 12:26 trollepi jj
2008-04-03 12:38 ` Gary Thomas
2008-04-03 12:48   ` trollepi jj
2008-04-03 12:56 ` Andrew Lunn
2008-04-03 13:24   ` trollepi jj

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=pnsky31386.fsf@delenn.bartv.net \
    --to=bartv@ecoscentric.com \
    --cc=ecos-discuss@ecos.sourceware.org \
    --cc=jackoaway@hotmail.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).