aboutsummaryrefslogtreecommitdiff
path: root/linux-core/drm_compat.c
diff options
context:
space:
mode:
authorThomas Hellstrom <thomas-at-tungstengraphics-dot-com>2006-10-03 12:08:07 +0200
committerThomas Hellstrom <thomas-at-tungstengraphics-dot-com>2006-10-03 12:08:07 +0200
commitcee659afb56e7ac443402ac791144f391721061e (patch)
tree45d68bf6a269f626f6a2178c8c0b5987af5c96e7 /linux-core/drm_compat.c
parent16be6ba63a41f03e98a741464d3b51eefb277373 (diff)
Get rid of all ugly PTE hacks.
Diffstat (limited to 'linux-core/drm_compat.c')
-rw-r--r--linux-core/drm_compat.c133
1 files changed, 0 insertions, 133 deletions
diff --git a/linux-core/drm_compat.c b/linux-core/drm_compat.c
index 8dbc636a..81a2bd84 100644
--- a/linux-core/drm_compat.c
+++ b/linux-core/drm_compat.c
@@ -26,139 +26,6 @@
*/
#include "drmP.h"
-#include <asm/pgtable.h>
-#include <asm/cacheflush.h>
-#include <asm/tlbflush.h>
-
-#ifdef MODULE
-void pgd_clear_bad(pgd_t * pgd)
-{
- pgd_ERROR(*pgd);
- pgd_clear(pgd);
-}
-
-void pud_clear_bad(pud_t * pud)
-{
- pud_ERROR(*pud);
- pud_clear(pud);
-}
-
-void pmd_clear_bad(pmd_t * pmd)
-{
- pmd_ERROR(*pmd);
- pmd_clear(pmd);
-}
-#endif
-
-static inline void change_pte_range(struct mm_struct *mm, pmd_t * pmd,
- unsigned long addr, unsigned long end)
-{
- pte_t *pte;
- struct page *page;
- unsigned long pfn;
-
- pte = pte_offset_map(pmd, addr);
- do {
- if (pte_present(*pte)) {
- pte_t ptent;
- pfn = pte_pfn(*pte);
- ptent = *pte;
- ptep_get_and_clear(mm, addr, pte);
- if (pfn_valid(pfn)) {
- page = pfn_to_page(pfn);
- if (atomic_add_negative(-1, &page->_mapcount)) {
- if (page_test_and_clear_dirty(page))
- set_page_dirty(page);
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,18)
- dec_zone_page_state(page, NR_FILE_MAPPED);
-#else
- dec_page_state(nr_mapped);
-#endif
- }
-
- put_page(page);
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,15)
- dec_mm_counter(mm, file_rss);
-#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,12)
- dec_mm_counter(mm, rss);
-#else
- --mm->rss;
-#endif
- }
- }
- } while (pte++, addr += PAGE_SIZE, addr != end);
- pte_unmap(pte - 1);
-}
-
-static inline void change_pmd_range(struct mm_struct *mm, pud_t * pud,
- unsigned long addr, unsigned long end)
-{
- pmd_t *pmd;
- unsigned long next;
-
- pmd = pmd_offset(pud, addr);
- do {
- next = pmd_addr_end(addr, end);
- if (pmd_none_or_clear_bad(pmd))
- continue;
- change_pte_range(mm, pmd, addr, next);
- } while (pmd++, addr = next, addr != end);
-}
-
-static inline void change_pud_range(struct mm_struct *mm, pgd_t * pgd,
- unsigned long addr, unsigned long end)
-{
- pud_t *pud;
- unsigned long next;
-
- pud = pud_offset(pgd, addr);
- do {
- next = pud_addr_end(addr, end);
- if (pud_none_or_clear_bad(pud))
- continue;
- change_pmd_range(mm, pud, addr, next);
- } while (pud++, addr = next, addr != end);
-}
-
-/*
- * This function should be called with all relevant spinlocks held.
- */
-
-#if 1
-void drm_clear_vma(struct vm_area_struct *vma,
- unsigned long addr, unsigned long end)
-{
- struct mm_struct *mm = vma->vm_mm;
- pgd_t *pgd;
- unsigned long next;
-#if defined(flush_tlb_mm) || !defined(MODULE)
- unsigned long start = addr;
-#endif
- BUG_ON(addr >= end);
- pgd = pgd_offset(mm, addr);
- flush_cache_range(vma, addr, end);
- do {
- next = pgd_addr_end(addr, end);
- if (pgd_none_or_clear_bad(pgd))
- continue;
- change_pud_range(mm, pgd, addr, next);
- } while (pgd++, addr = next, addr != end);
-#if defined(flush_tlb_mm) || !defined(MODULE)
- flush_tlb_range(vma, addr, end);
-#endif
-}
-#else
-
-void drm_clear_vma(struct vm_area_struct *vma,
- unsigned long addr, unsigned long end)
-{
- struct mm_struct *mm = vma->vm_mm;
-
- spin_unlock(&mm->page_table_lock);
- (void) zap_page_range(vma, addr, end - addr, NULL);
- spin_lock(&mm->page_table_lock);
-}
-#endif
#if defined(CONFIG_X86) && (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,15))
int drm_map_page_into_agp(struct page *page)