404

[ Avaa Bypassed ]




Upload:

Command:

botdev@18.189.141.141: ~ $
/*
 * Page management definitions for the Hexagon architecture
 *
 * Copyright (c) 2010-2013, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
 * only version 2 as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 * 02110-1301, USA.
 */

#ifndef _ASM_PAGE_H
#define _ASM_PAGE_H

#include <linux/const.h>

/*  This is probably not the most graceful way to handle this.  */

#ifdef CONFIG_PAGE_SIZE_4KB
#define PAGE_SHIFT 12
#define HEXAGON_L1_PTE_SIZE __HVM_PDE_S_4KB
#endif

#ifdef CONFIG_PAGE_SIZE_16KB
#define PAGE_SHIFT 14
#define HEXAGON_L1_PTE_SIZE __HVM_PDE_S_16KB
#endif

#ifdef CONFIG_PAGE_SIZE_64KB
#define PAGE_SHIFT 16
#define HEXAGON_L1_PTE_SIZE __HVM_PDE_S_64KB
#endif

#ifdef CONFIG_PAGE_SIZE_256KB
#define PAGE_SHIFT 18
#define HEXAGON_L1_PTE_SIZE __HVM_PDE_S_256KB
#endif

#ifdef CONFIG_PAGE_SIZE_1MB
#define PAGE_SHIFT 20
#define HEXAGON_L1_PTE_SIZE __HVM_PDE_S_1MB
#endif

/*
 *  These should be defined in hugetlb.h, but apparently not.
 *  "Huge" for us should be 4MB or 16MB, which are both represented
 *  in L1 PTE's.  Right now, it's set up for 4MB.
 */
#ifdef CONFIG_HUGETLB_PAGE
#define HPAGE_SHIFT 22
#define HPAGE_SIZE (1UL << HPAGE_SHIFT)
#define HPAGE_MASK (~(HPAGE_SIZE-1))
#define HUGETLB_PAGE_ORDER (HPAGE_SHIFT-PAGE_SHIFT)
#define HVM_HUGEPAGE_SIZE 0x5
#endif

#define PAGE_SIZE  (1UL << PAGE_SHIFT)
#define PAGE_MASK  (~((1 << PAGE_SHIFT) - 1))

#ifdef __KERNEL__
#ifndef __ASSEMBLY__

/*
 * This is for PFN_DOWN, which mm.h needs.  Seems the right place to pull it in.
 */
#include <linux/pfn.h>

/*
 * We implement a two-level architecture-specific page table structure.
 * Null intermediate page table level (pmd, pud) definitions will come from
 * asm-generic/pagetable-nopmd.h and asm-generic/pagetable-nopud.h
 */
typedef struct { unsigned long pte; } pte_t;
typedef struct { unsigned long pgd; } pgd_t;
typedef struct { unsigned long pgprot; } pgprot_t;
typedef struct page *pgtable_t;

#define pte_val(x)     ((x).pte)
#define pgd_val(x)     ((x).pgd)
#define pgprot_val(x)  ((x).pgprot)
#define __pte(x)       ((pte_t) { (x) })
#define __pgd(x)       ((pgd_t) { (x) })
#define __pgprot(x)    ((pgprot_t) { (x) })

/*
 * We need a __pa and a __va routine for kernel space.
 * MIPS says they're only used during mem_init.
 * also, check if we need a PHYS_OFFSET.
 */
#define __pa(x) ((unsigned long)(x) - PAGE_OFFSET + PHYS_OFFSET)
#define __va(x) ((void *)((unsigned long)(x) - PHYS_OFFSET + PAGE_OFFSET))

/* The "page frame" descriptor is defined in linux/mm.h */
struct page;

/* Returns page frame descriptor for virtual address. */
#define virt_to_page(kaddr) pfn_to_page(PFN_DOWN(__pa(kaddr)))

/* Default vm area behavior is non-executable.  */
#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | \
				VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)

#define pfn_valid(pfn) ((pfn) < max_mapnr)
#define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT)

/*  Need to not use a define for linesize; may move this to another file.  */
static inline void clear_page(void *page)
{
	/*  This can only be done on pages with L1 WB cache */
	asm volatile(
		"	loop0(1f,%1);\n"
		"1:	{ dczeroa(%0);\n"
		"	  %0 = add(%0,#32); }:endloop0\n"
		: "+r" (page)
		: "r" (PAGE_SIZE/32)
		: "lc0", "sa0", "memory"
	);
}

#define copy_page(to, from)	memcpy((to), (from), PAGE_SIZE)

/*
 * Under assumption that kernel always "sees" user map...
 */
#define clear_user_page(page, vaddr, pg)	clear_page(page)
#define copy_user_page(to, from, vaddr, pg)	copy_page(to, from)

/*
 * page_to_phys - convert page to physical address
 * @page - pointer to page entry in mem_map
 */
#define page_to_phys(page)      (page_to_pfn(page) << PAGE_SHIFT)

#define virt_to_pfn(kaddr)      (__pa(kaddr) >> PAGE_SHIFT)
#define pfn_to_virt(pfn)        __va((pfn) << PAGE_SHIFT)

#define page_to_virt(page)	__va(page_to_phys(page))

/*
 * For port to Hexagon Virtual Machine, MAYBE we check for attempts
 * to reference reserved HVM space, but in any case, the VM will be
 * protected.
 */
#define kern_addr_valid(addr)   (1)

#include <asm/mem-layout.h>
#include <asm-generic/memory_model.h>
/* XXX Todo: implement assembly-optimized version of getorder. */
#include <asm-generic/getorder.h>

#endif /* ifdef __ASSEMBLY__ */
#endif /* ifdef __KERNEL__ */

#endif

Filemanager

Name Type Size Permission Actions
Kbuild File 886 B 0644
asm-offsets.h File 35 B 0644
atomic.h File 5.27 KB 0644
bitops.h File 6.62 KB 0644
cache.h File 1.16 KB 0644
cacheflush.h File 3.8 KB 0644
checksum.h File 1.61 KB 0644
cmpxchg.h File 2.55 KB 0644
delay.h File 978 B 0644
dma-mapping.h File 1.31 KB 0644
dma.h File 934 B 0644
elf.h File 6.34 KB 0644
exec.h File 1.01 KB 0644
fixmap.h File 1.11 KB 0644
fpu.h File 90 B 0644
futex.h File 2.25 KB 0644
hexagon_vm.h File 6.39 KB 0644
intrinsics.h File 1003 B 0644
io.h File 6.95 KB 0644
irq.h File 1.13 KB 0644
irqflags.h File 1.46 KB 0644
kgdb.h File 1.36 KB 0644
linkage.h File 871 B 0644
mem-layout.h File 3.42 KB 0644
mmu.h File 1.1 KB 0644
mmu_context.h File 2.59 KB 0644
module.h File 910 B 0644
page.h File 4.74 KB 0644
perf_event.h File 841 B 0644
pgalloc.h File 4.08 KB 0644
pgtable.h File 14.15 KB 0644
processor.h File 3.8 KB 0644
smp.h File 1.31 KB 0644
spinlock.h File 3.84 KB 0644
spinlock_types.h File 1.15 KB 0644
string.h File 1.08 KB 0644
suspend.h File 872 B 0644
switch_to.h File 1.09 KB 0644
syscall.h File 1.38 KB 0644
thread_info.h File 4.05 KB 0644
time.h File 980 B 0644
timer-regs.h File 1.23 KB 0644
timex.h File 1.13 KB 0644
tlb.h File 1.21 KB 0644
tlbflush.h File 2.08 KB 0644
traps.h File 1.02 KB 0644
uaccess.h File 3.67 KB 0644
vdso.h File 941 B 0644
vm_fault.h File 993 B 0644
vm_mmu.h File 3.37 KB 0644