Skip to content

Commit

Permalink
sparc64: Clean up 64-bit mmap exclusion defines.
Browse files Browse the repository at this point in the history
Older UltraSPARC chips had an address space hole due to the MMU only
supporting 44-bit virtual addresses.

The top end of this hole also has the same value as the current
definition of PAGE_OFFSET, so this can be confusing.

Consolidate the defines for the userspace mmap exclusion range into
page_64.h and use them in sys_sparc_64.c and hugetlbpage.c

Signed-off-by: David S. Miller <davem@davemloft.net>
Acked-by: Bob Picco <bob.picco@oracle.com>
  • Loading branch information
David S. Miller committed Nov 12, 2013
1 parent 10d0c97 commit c920745
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
17 changes: 15 additions & 2 deletions arch/sparc/include/asm/page_64.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,22 @@ typedef unsigned long pgprot_t;

typedef pte_t *pgtable_t;

/* These two values define the virtual address space range in which we
* must forbid 64-bit user processes from making mappings. It
* represents the virtual address space hole present in most early
* sparc64 chips including UltraSPARC-I. The next two defines specify
* the actual exclusion region we enforce, wherein we use a 4GB red
* zone on each side of the VA hole.
*/
#define SPARC64_VA_HOLE_TOP _AC(0xfffff80000000000,UL)
#define SPARC64_VA_HOLE_BOTTOM _AC(0x0000080000000000,UL)

#define VA_EXCLUDE_START (SPARC64_VA_HOLE_BOTTOM - (1UL << 32UL))
#define VA_EXCLUDE_END (SPARC64_VA_HOLE_TOP + (1UL << 32UL))

#define TASK_UNMAPPED_BASE (test_thread_flag(TIF_32BIT) ? \
(_AC(0x0000000070000000,UL)) : \
(_AC(0xfffff80000000000,UL) + (1UL << 32UL)))
_AC(0x0000000070000000,UL) : \
VA_EXCLUDE_END)

#include <asm-generic/memory_model.h>

Expand Down
3 changes: 0 additions & 3 deletions arch/sparc/kernel/sys_sparc_64.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,6 @@ asmlinkage unsigned long sys_getpagesize(void)
return PAGE_SIZE;
}

#define VA_EXCLUDE_START (0x0000080000000000UL - (1UL << 32UL))
#define VA_EXCLUDE_END (0xfffff80000000000UL + (1UL << 32UL))

/* Does addr --> addr+len fall within 4GB of the VA-space hole or
* overflow past the end of the 64-bit address space?
*/
Expand Down
2 changes: 0 additions & 2 deletions arch/sparc/mm/hugetlbpage.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@
/* Slightly simplified from the non-hugepage variant because by
* definition we don't have to worry about any page coloring stuff
*/
#define VA_EXCLUDE_START (0x0000080000000000UL - (1UL << 32UL))
#define VA_EXCLUDE_END (0xfffff80000000000UL + (1UL << 32UL))

static unsigned long hugetlb_get_unmapped_area_bottomup(struct file *filp,
unsigned long addr,
Expand Down

0 comments on commit c920745

Please sign in to comment.