page size change on MIPS with code sourcery toolchain

naveen yadav yad.naveen at gmail.com
Fri Jan 28 04:10:17 UTC 2011


Hi all,

I am using codesourcery mips toolchain (4.3.3). How can I verify its
PHDRs  are compatible with 64KB page size.

Since same kernel works well with 16KB page size.
 Please give your opinion.


kind regards







---------- Forwarded message ----------
From: David Daney <ddaney at caviumnetworks.com>
Date: Thu, Jan 27, 2011 at 11:14 PM
Subject: Re: page size change on MIPS
To: adnan iqbal <adnan.iqbal at seecs.edu.pk>
Cc: naveen yadav <yad.naveen at gmail.com>, linux-mips at linux-mips.org,
kernelnewbies at nl.linux.org


On 01/27/2011 07:18 AM, adnan iqbal wrote:
>
> Please try this. One line of code is added ( move    %1, $7).
>
>
> int kernel_execve(const char *filename, char *const argv[], char *const
> envp[])
> {
>        register unsigned long __a0 asm("$4") = (unsigned long) filename;
>        register unsigned long __a1 asm("$5") = (unsigned long) argv;
>        register unsigned long __a2 asm("$6") = (unsigned long) envp;
>        register unsigned long __a3 asm("$7");
>        unsigned long __v0;
>        __asm__ volatile ("                                     \n"
>        "       .set    noreorder                               \n"
>        "       li      $2, %5          # __NR_execve           \n"
>        "       syscall                                         \n"
>        "       move    %0, $2                                  \n"
>     "      move    %1, $7                    \n"
>        "       .set    reorder                                 \n"
>        : "=&r" (__v0), "=r" (__a3)
>        : "r" (__a0), "r" (__a1), "r" (__a2), "i" (__NR_execve)
>        : "$2", "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15", "$24",
>          "memory");
>
>
>        if (__a3 == 0)
>                return __v0;
>        return -__v0;
> }
>

I don't know where you got that code.  But really you should do what
glibc does.  glibc gets it correct.

At a minimum you are missing "hi" and "lo" clobbers.

If the code works with 16K pages, and not 64K pages, then this snippet
is not the problem.  Likely your problem is the layout of the PHDRs in
the executable is not compatible with the page size.

David Daney



More information about the mips-gnu-discuss mailing list