* [9fans] P9P libthread on Debian ARM vs. makecontext et al.
@ 2008-07-08 13:01 Robert Raschke
2008-07-08 14:05 ` Michael Teichgräber
0 siblings, 1 reply; 3+ messages in thread
From: Robert Raschke @ 2008-07-08 13:01 UTC (permalink / raw)
To: Fans of the OS Plan 9 from Bell Labs
Hi,
I recently got myself a lovely Nokia N810 internet tablet. That runs
Debian ARM and I thought I'd have a stab at compiling P9P for it.
Unfortunately, the makecontext/swapcontext calls are not supported on
that platform by Debian.
I noticed that libthread/Linux.c has implementations of those two
functions for ARM. So I thought I try compiling libthread without
pthread support. This time, it's the mcontext_t (aka sigcontext)
struct that is causing an issue. The Debian ARM sigcontext struct
looks like this:
struct sigcontext {
unsigned long trap_no;
unsigned long error_code;
unsigned long oldmask;
unsigned long arm_r0;
...
unsigned long arm_r10;
unsigned long arm_fp;
unsigned long arm_ip;
unsigned long arm_sp;
unsigned long arm_lr;
unsigned long arm_pc;
unsigned long arm_cpsr;
unsigned long fault_address;
};
The code in Linux.c that implements makecontext() for ARM expects this
struct to contain a gregs array. I'm guessing that gregs is the same
as the enumerated arm_* ones above. So, would I be correct in assuming
that gregs[13] is arm_sp and gregs[14] is arm_lr?
Thanks,
Robby
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [9fans] P9P libthread on Debian ARM vs. makecontext et al.
2008-07-08 13:01 [9fans] P9P libthread on Debian ARM vs. makecontext et al Robert Raschke
@ 2008-07-08 14:05 ` Michael Teichgräber
2008-07-08 15:59 ` Robert Raschke
0 siblings, 1 reply; 3+ messages in thread
From: Michael Teichgräber @ 2008-07-08 14:05 UTC (permalink / raw)
To: Fans of the OS Plan 9 from Bell Labs
> The code in Linux.c that implements makecontext() for ARM expects this
> struct to contain a gregs array. I'm guessing that gregs is the same
> as the enumerated arm_* ones above. So, would I be correct in assuming
> that gregs[13] is arm_sp and gregs[14] is arm_lr?
Hi, I would say yes, as SP is r13 and LR is r14 on arm.
To run Russ' libtask on arm7 I used the Linux-arm-asm.s and
the arm-specific makecontext implementation from Linux.c,
as well as the following structures.
M.
--
enum {
NREG = 16,
};
typedef
struct Mcontext
{
u32int gregs[NREG]; /* general registers */
} Mcontext;
typedef
struct ucontext
{
Mcontext uc_mcontext;
sigset_t uc_sigmask;
struct {
void *ss_sp;
u16int ss_size;
} uc_stack;
} ucontext_t;
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [9fans] P9P libthread on Debian ARM vs. makecontext et al.
2008-07-08 14:05 ` Michael Teichgräber
@ 2008-07-08 15:59 ` Robert Raschke
0 siblings, 0 replies; 3+ messages in thread
From: Robert Raschke @ 2008-07-08 15:59 UTC (permalink / raw)
To: Fans of the OS Plan 9 from Bell Labs
On 7/8/08, Michael Teichgräber <mt@wmipf.in-berlin.de> wrote:
> > The code in Linux.c that implements makecontext() for ARM expects this
> > struct to contain a gregs array. I'm guessing that gregs is the same
> > as the enumerated arm_* ones above. So, would I be correct in assuming
> > that gregs[13] is arm_sp and gregs[14] is arm_lr?
>
> Hi, I would say yes, as SP is r13 and LR is r14 on arm.
> To run Russ' libtask on arm7 I used the Linux-arm-asm.s and
> the arm-specific makecontext implementation from Linux.c,
> as well as the following structures.
>
> M.
> --
>
> enum {
> NREG = 16,
> };
>
> typedef
> struct Mcontext
> {
> u32int gregs[NREG]; /* general registers */
> } Mcontext;
>
> typedef
> struct ucontext
> {
> Mcontext uc_mcontext;
> sigset_t uc_sigmask;
> struct {
> void *ss_sp;
> u16int ss_size;
> } uc_stack;
>
> } ucontext_t;
>
Thanks, that's gotten me quite a bit further. I can compile the whole
lot now and run quite a few of the commands, including rc, under the
ARM qemulation. Hurrah.
Next I need to figure out why I get segfaults for some. And then try
it on real HW.
Robby
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-07-08 15:59 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-07-08 13:01 [9fans] P9P libthread on Debian ARM vs. makecontext et al Robert Raschke
2008-07-08 14:05 ` Michael Teichgräber
2008-07-08 15:59 ` Robert Raschke
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 NNTP newsgroup(s).