* [U-Boot-Users] PPC: problem with syscalls
@ 2002-11-28 12:39 Pierre AUBERT
2002-11-29 12:04 ` Pierre AUBERT
2002-12-06 21:59 ` Wolfgang Denk
0 siblings, 2 replies; 4+ messages in thread
From: Pierre AUBERT @ 2002-11-28 12:39 UTC (permalink / raw)
To: u-boot
Hello everybody,
I've a problem with examples/timer.c. I've tried to launch it on my
mpc860t board, if I start the timer and if I
press a key after one or more interrupts occured, the u-boot crashes.
The problem is that an interrupt handler
uses a system call (mon_printf) while the main loop is inside a system
call (mon_getc). During a system call,
the LR and SRRx are saved at a fixed location (0xcf4, 0xcf8 and 0xcfc)
then the return address of the mon_printf
in the main loop is overridden by the return address of the mon_getc in
the interrupt handler. To avoid this problem,
I think that we need to use a stack to store the return addresses (and
the SRRx) of the system calls.
What's your opinion ?
Best regards
^ permalink raw reply [flat|nested] 4+ messages in thread
* [U-Boot-Users] PPC: problem with syscalls
2002-11-28 12:39 [U-Boot-Users] PPC: problem with syscalls Pierre AUBERT
@ 2002-11-29 12:04 ` Pierre AUBERT
2002-12-06 22:06 ` Wolfgang Denk
2002-12-06 21:59 ` Wolfgang Denk
1 sibling, 1 reply; 4+ messages in thread
From: Pierre AUBERT @ 2002-11-29 12:04 UTC (permalink / raw)
To: u-boot
Pierre AUBERT wrote:
> Hello everybody,
>
> I've a problem with examples/timer.c. I've tried to launch it on my
> mpc860t board, if I start the timer and if I
> press a key after one or more interrupts occured, the u-boot crashes.
> The problem is that an interrupt handler
> uses a system call (mon_printf) while the main loop is inside a system
> call (mon_getc). During a system call,
> the LR and SRRx are saved at a fixed location (0xcf4, 0xcf8 and 0xcfc)
> then the return address of the mon_printf
> in the main loop is overridden by the return address of the mon_getc in
> the interrupt handler. To avoid this problem,
> I think that we need to use a stack to store the return addresses (and
> the SRRx) of the system calls.
>
Dear Wolfgang,
Please find attached a patch fixing the problem described above. A little
stack (located between the end of the syscall exception handler and the
beginning of the following exception) is used to save the LR and SRRx.
With this patch, examples/timer is running fine.
Best regards.
CHANGELOG:
* Patch by Pierre Aubert , 28 Nov 2002
Fix nested syscalls bug in standalone applications.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: syscalls.patch
Type: application/octet-stream
Size: 7657 bytes
Desc: not available
Url : http://lists.denx.de/pipermail/u-boot/attachments/20021129/736d50b2/attachment.obj
^ permalink raw reply [flat|nested] 4+ messages in thread
* [U-Boot-Users] PPC: problem with syscalls
2002-11-29 12:04 ` Pierre AUBERT
@ 2002-12-06 22:06 ` Wolfgang Denk
0 siblings, 0 replies; 4+ messages in thread
From: Wolfgang Denk @ 2002-12-06 22:06 UTC (permalink / raw)
To: u-boot
In message <3DE757B3.F88ACDBA@staubli.com> you wrote:
>
> Please find attached a patch fixing the problem described above. A little
> stack (located between the end of the syscall exception handler and the
> beginning of the following exception) is used to save the LR and SRRx.
> With this patch, examples/timer is running fine.
Added (although I still/now think we should implement a portable
method instead).
Best regards,
Wolfgang Denk
--
Software Engineering: Embedded and Realtime Systems, Embedded Linux
Phone: (+49)-8142-4596-87 Fax: (+49)-8142-4596-88 Email: wd at denx.de
"If you own a machine, you are in turn owned by it, and spend your
time serving it..." - Marion Zimmer Bradley, _The Forbidden Tower_
^ permalink raw reply [flat|nested] 4+ messages in thread
* [U-Boot-Users] PPC: problem with syscalls
2002-11-28 12:39 [U-Boot-Users] PPC: problem with syscalls Pierre AUBERT
2002-11-29 12:04 ` Pierre AUBERT
@ 2002-12-06 21:59 ` Wolfgang Denk
1 sibling, 0 replies; 4+ messages in thread
From: Wolfgang Denk @ 2002-12-06 21:59 UTC (permalink / raw)
To: u-boot
In message <3DE60E99.1DB09169@staubli.com> you wrote:
>
> I've a problem with examples/timer.c. I've tried to launch it on my
> mpc860t board, if I start the timer and if I
> press a key after one or more interrupts occured, the u-boot crashes.
> The problem is that an interrupt handler
> uses a system call (mon_printf) while the main loop is inside a system
> call (mon_getc). During a system call,
> the LR and SRRx are saved at a fixed location (0xcf4, 0xcf8 and 0xcfc)
> then the return address of the mon_printf
> in the main loop is overridden by the return address of the mon_getc in
> the interrupt handler. To avoid this problem,
> I think that we need to use a stack to store the return addresses (and
> the SRRx) of the system calls.
>
> What's your opinion ?
We should probably follow Robert Kaiser's advise and use plainold
pointer tables as we did before. When I switched to use syscalls it
seemed like a good idea, but I was not thinking about other archi-
tectures then.
[Sorry it took me so long to repply.]
Best regards,
Wolfgang Denk
--
Software Engineering: Embedded and Realtime Systems, Embedded Linux
Phone: (+49)-8142-4596-87 Fax: (+49)-8142-4596-88 Email: wd at denx.de
In an infinite universe all things are possible, including the possi-
bility that the universe does not exist.
- Terry Pratchett, _The Dark Side of the Sun_
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2002-12-06 22:06 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-11-28 12:39 [U-Boot-Users] PPC: problem with syscalls Pierre AUBERT
2002-11-29 12:04 ` Pierre AUBERT
2002-12-06 22:06 ` Wolfgang Denk
2002-12-06 21:59 ` Wolfgang Denk
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox