Re: Stack at high memory locations

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, May 4, 2008 at 7:48 PM, Rene Herman <rene.herman@xxxxxxxxxxxx> wrote:
> On 04-05-08 12:35, Anant Narayanan wrote:
>
>
> > While implementing a binary format loader for a foreign executable format,
> we have found the need to setup the user stack starting at (virtual) address
> 0xE0000000 instead of the usual 0xC0000000. However a call to
> setup_arg_pages() with that value returns -EINVAL.
> >
> > Is there any way to setup the stack such that it starts at 0xE0000000 and
> > grows downwards?
> >
>
>  It depends. There's obviously no way that the user stack can reside in
> kernelspace (well, sanely) so the question is, "is there any way to have
> kernelspace limited to the last 512M instead of the last 1G as usual".
>
>  I suppose this is on x86-32. If you're on machines with less than 384M of
> memory the answer is, "sure, just increase PAGE_OFFSET" (look at the Kconfig
> split selection to see how) while with more you'd need to suffer highmem.
>

Just FYI.   A good writeup I found here:   (include/asm-powerpc/page.h
- formula may not be applicable to x86, but terminology should be
identical):

/*
 * KERNELBASE is the virtual address of the start of the kernel, it's often
 * the same as PAGE_OFFSET, but _might not be_.
 *
 * The kdump dump kernel is one example where KERNELBASE != PAGE_OFFSET.
 *
 * PAGE_OFFSET is the virtual address of the start of lowmem.
 *
 * PHYSICAL_START is the physical address of the start of the kernel.
 *
 * MEMORY_START is the physical address of the start of lowmem.
 *
 * KERNELBASE, PAGE_OFFSET, and PHYSICAL_START are all configurable on
 * ppc32 and based on how they are set we determine MEMORY_START.
 *
 * For the linear mapping the following equation should be true:
 * KERNELBASE - PAGE_OFFSET = PHYSICAL_START - MEMORY_START
 *
 * Also, KERNELBASE >= PAGE_OFFSET and PHYSICAL_START >= MEMORY_START
 *
 * There are two was to determine a physical address from a virtual one:
 * va = pa + PAGE_OFFSET - MEMORY_START
 * va = pa + KERNELBASE - PHYSICAL_START
 *
 * If you want to know something's offset from the start of the kernel you
 * should subtract KERNELBASE.
 *
 * If you want to test if something's a kernel address, use is_kernel_addr().
 */

>  If you're on general out-in-the-wild x86 the answer is "ofcourse not". See
> first paragraph.
>
>  Rene.
>
>
>
>  --
>  To unsubscribe from this list: send an email with
>  "unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
>  Please read the FAQ at http://kernelnewbies.org/FAQ
>
>



-- 
Regards,
Peter Teoh

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux