All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* Help from Kernel Gurus needed!!!
  1999-01-24 10:15 Help - Kernel Panic - 2.2.0-final Bryan Christianson
@ 1999-01-25  3:31 ` Kevin B. Hendricks
  0 siblings, 0 replies; 6+ messages in thread
From: Kevin B. Hendricks @ 1999-01-25  3:31 UTC (permalink / raw
  To: linuxppc-dev


Hi,

I could really use some help from you kernel gurus out there.  In Sun's JDK
1.2 green_threads implementation, their signal handlers are passed a
pointer to a  context structure that allows them to see what the signal
mask was immediately before the signal was delivered.

We need to do the same thing in the ppc port.  So in a signal handler I
would like some way of knowing the address of the sigcontext structure
where the old mask is stored.

I have looked in arch/ppc/kernel/signal.c and I can find the place where
the structure is built, I just can't figure out a way to find it easily on
the stack.

This same info is easy to find on x86 since it is on the stack right before
the value of sig (the signal number) which is passed on the stack.

Any ideas here?  I could do a sigsetjmp to easily get the values of r1 and
lr if either of those can be used to find the location of the sigcontext
structure on the stack by working backwards.

Any help of ideas here would be greatly appreciated.

Thanks,

Kevin

----------------------------------------------------------
Kevin B. Hendricks
Associate Professor, Operations & Information Technology
School of Business, College of William & Mary
Williamsburg, VA 23187, kbhend@dogwood.tyler.wm.edu
http://business.tyler.wm.edu


[[ This message was sent via the linuxppc-dev mailing list. Replies are ]]
[[ not forced back to the list, so be sure to  Cc linuxppc-dev  if your ]]
[[ reply is of general interest. To unsubscribe from linuxppc-dev, send ]]
[[ the message 'unsubscribe' to linuxppc-dev-request@lists.linuxppc.org ]]

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

* Re: Help from Kernel Gurus needed!!!
@ 1999-01-25 15:32 Kevin B. Hendricks
  1999-01-25 17:46 ` David Edelsohn
  0 siblings, 1 reply; 6+ messages in thread
From: Kevin B. Hendricks @ 1999-01-25 15:32 UTC (permalink / raw
  To: linuxppc-dev


Hi,

Nothing like answering your own question.  I never saw my post make it back
to me, but if anyone runs into the same problem here is my solution.  I
figured this out from looking at the stack inside a signal handler with gdb
so I may be wrong but this seems to work:

>From inside a signal handler, to check on old signal masks or register
contents right before the signal was delivered:


#include <asm/sigcontext.h>

    /* get the value of r1 (the stack pointer) */
    long * p;
    struct sigcontext_struct * scp;
    __asm__ ( "addi %0,1,0" : "=r" (p) : /* no inputs */ );
    /* follow it back up the chain */
    p = *p;
    /* from here the sigcontext struct is 64 bytes away */
    p = p + 16;
    scp = (struct sigcontext_struct *)p;

I hope this helps.  If it looks wrong to anyone out there please let me
know ASAP.

Thanks,

Kevin


----------------------------------------------------------
Kevin B. Hendricks
Associate Professor, Operations & Information Technology
School of Business, College of William & Mary
Williamsburg, VA 23187, kbhend@dogwood.tyler.wm.edu
http://business.tyler.wm.edu



[[ This message was sent via the linuxppc-dev mailing list. Replies are ]]
[[ not forced back to the list, so be sure to  Cc linuxppc-dev  if your ]]
[[ reply is of general interest. To unsubscribe from linuxppc-dev, send ]]
[[ the message 'unsubscribe' to linuxppc-dev-request@lists.linuxppc.org ]]

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

* Re: Help from Kernel Gurus needed!!!
  1999-01-25 15:32 Help from Kernel Gurus needed!!! Kevin B. Hendricks
@ 1999-01-25 17:46 ` David Edelsohn
  1999-01-25 21:27   ` Geert Uytterhoeven
  0 siblings, 1 reply; 6+ messages in thread
From: David Edelsohn @ 1999-01-25 17:46 UTC (permalink / raw
  To: Kevin B. Hendricks; +Cc: linuxppc-dev


	If you are just trying to copy r1 into r0, why not use move
regsiter instead of add immediate as the following:

	__asm__ ("mr %0,1" : "=r" (p) : );

David

[[ This message was sent via the linuxppc-dev mailing list. Replies are ]]
[[ not forced back to the list, so be sure to  Cc linuxppc-dev  if your ]]
[[ reply is of general interest. To unsubscribe from linuxppc-dev, send ]]
[[ the message 'unsubscribe' to linuxppc-dev-request@lists.linuxppc.org ]]

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

* Re: Help from Kernel Gurus needed!!!
  1999-01-25 17:46 ` David Edelsohn
@ 1999-01-25 21:27   ` Geert Uytterhoeven
  1999-01-25 23:33     ` David Edelsohn
  1999-01-26 15:35     ` Gabriel Paubert
  0 siblings, 2 replies; 6+ messages in thread
From: Geert Uytterhoeven @ 1999-01-25 21:27 UTC (permalink / raw
  To: David Edelsohn; +Cc: Kevin B. Hendricks, linuxppc-dev


On Mon, 25 Jan 1999, David Edelsohn wrote:
> 	If you are just trying to copy r1 into r0, why not use move
> regsiter instead of add immediate as the following:
> 
> 	__asm__ ("mr %0,1" : "=r" (p) : );

Hehe, the clue is that IBM/Motorola didn't implement instructions that perform
operations that can be done in a different manner, too.

`mr' is just an alias for add with zero.

Greetings,

						Geert

--
Geert Uytterhoeven                     Geert.Uytterhoeven@cs.kuleuven.ac.be
Wavelets, Linux/{m68k~Amiga,PPC~CHRP}  http://www.cs.kuleuven.ac.be/~geert/
Department of Computer Science -- Katholieke Universiteit Leuven -- Belgium


[[ This message was sent via the linuxppc-dev mailing list. Replies are ]]
[[ not forced back to the list, so be sure to  Cc linuxppc-dev  if your ]]
[[ reply is of general interest. To unsubscribe from linuxppc-dev, send ]]
[[ the message 'unsubscribe' to linuxppc-dev-request@lists.linuxppc.org ]]

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

* Re: Help from Kernel Gurus needed!!!
  1999-01-25 21:27   ` Geert Uytterhoeven
@ 1999-01-25 23:33     ` David Edelsohn
  1999-01-26 15:35     ` Gabriel Paubert
  1 sibling, 0 replies; 6+ messages in thread
From: David Edelsohn @ 1999-01-25 23:33 UTC (permalink / raw
  To: Geert Uytterhoeven; +Cc: Kevin B. Hendricks, linuxppc-dev


>>>>> Geert Uytterhoeven writes:

Geert> Hehe, the clue is that IBM/Motorola didn't implement instructions that perform
Geert> operations that can be done in a different manner, too.

Geert> `mr' is just an alias for add with zero.

	The point is that the extended mnemonic document the intent and
purpose of the operation.  This is for documentation, not correctness or
efficiency. 

David

[[ This message was sent via the linuxppc-dev mailing list. Replies are ]]
[[ not forced back to the list, so be sure to  Cc linuxppc-dev  if your ]]
[[ reply is of general interest. To unsubscribe from linuxppc-dev, send ]]
[[ the message 'unsubscribe' to linuxppc-dev-request@lists.linuxppc.org ]]

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

* Re: Help from Kernel Gurus needed!!!
  1999-01-25 21:27   ` Geert Uytterhoeven
  1999-01-25 23:33     ` David Edelsohn
@ 1999-01-26 15:35     ` Gabriel Paubert
  1 sibling, 0 replies; 6+ messages in thread
From: Gabriel Paubert @ 1999-01-26 15:35 UTC (permalink / raw
  To: Geert Uytterhoeven; +Cc: David Edelsohn, Kevin B. Hendricks, linuxppc-dev




On Mon, 25 Jan 1999, Geert Uytterhoeven wrote:

> 
> On Mon, 25 Jan 1999, David Edelsohn wrote:
> > 	If you are just trying to copy r1 into r0, why not use move
> > regsiter instead of add immediate as the following:
> > 
> > 	__asm__ ("mr %0,1" : "=r" (p) : );
> 
> Hehe, the clue is that IBM/Motorola didn't implement instructions that perform
> operations that can be done in a different manner, too.
> 
> `mr' is just an alias for add with zero.

No, mr %0,%1 is an alias for ori %0,%1,0 because addi does not work when
the source register is r0. OTOH, li and lis are aliases for addi and addis
with r0 as second operand, it is clearer in the POWER mnemonics where they
are called cal and cau for compute address {lower,upper} which directly 
shows that they use the same convention as the addressing mode noted 
as (rA|0) in the documentation.

	Greetings,
	Gabriel.


[[ This message was sent via the linuxppc-dev mailing list. Replies are ]]
[[ not forced back to the list, so be sure to  Cc linuxppc-dev  if your ]]
[[ reply is of general interest. To unsubscribe from linuxppc-dev, send ]]
[[ the message 'unsubscribe' to linuxppc-dev-request@lists.linuxppc.org ]]

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

end of thread, other threads:[~1999-01-26 15:35 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1999-01-25 15:32 Help from Kernel Gurus needed!!! Kevin B. Hendricks
1999-01-25 17:46 ` David Edelsohn
1999-01-25 21:27   ` Geert Uytterhoeven
1999-01-25 23:33     ` David Edelsohn
1999-01-26 15:35     ` Gabriel Paubert
  -- strict thread matches above, loose matches on Subject: below --
1999-01-24 10:15 Help - Kernel Panic - 2.2.0-final Bryan Christianson
1999-01-25  3:31 ` Help from Kernel Gurus needed!!! Kevin B. Hendricks

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.