Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 93615
b: refs/heads/master
c: 50eae2a
h: refs/heads/master
i:
  93613: 8873e7d
  93611: b434d90
  93607: 5a3d806
  93599: 4fe9897
v: v3
  • Loading branch information
Huang, Ying authored and Ingo Molnar committed Apr 26, 2008
1 parent e2e55eb commit 6bc93d4
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 32 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 0124cecfc85a6664b1ad5f1d28cf0ab8df66fc42
refs/heads/master: 50eae2a7c9862afe263a2003c12f457ecfc9e6a2
22 changes: 22 additions & 0 deletions trunk/arch/x86/kernel/e820_64.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,28 @@ void __init reserve_early(unsigned long start, unsigned long end, char *name)
strncpy(r->name, name, sizeof(r->name) - 1);
}

void __init free_early(unsigned long start, unsigned long end)
{
struct early_res *r;
int i, j;

for (i = 0; i < MAX_EARLY_RES && early_res[i].end; i++) {
r = &early_res[i];
if (start == r->start && end == r->end)
break;
}
if (i >= MAX_EARLY_RES || !early_res[i].end)
panic("free_early on not reserved area: %lx-%lx!", start, end);

for (j = i + 1; j < MAX_EARLY_RES && early_res[j].end; j++)
;

memcpy(&early_res[i], &early_res[i + 1],
(j - 1 - i) * sizeof(struct early_res));

early_res[j - 1].end = 0;
}

void __init early_res_to_bootmem(void)
{
int i;
Expand Down
31 changes: 0 additions & 31 deletions trunk/arch/x86/mm/pat.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
#include <asm/msr.h>
#include <asm/tlbflush.h>
#include <asm/processor.h>
#include <asm/page.h>
#include <asm/pgtable.h>
#include <asm/pat.h>
#include <asm/e820.h>
Expand Down Expand Up @@ -478,33 +477,6 @@ pgprot_t phys_mem_access_prot(struct file *file, unsigned long pfn,
return vma_prot;
}

#ifdef CONFIG_NONPROMISC_DEVMEM
/* This check is done in drivers/char/mem.c in case of NONPROMISC_DEVMEM*/
static inline int range_is_allowed(unsigned long pfn, unsigned long size)
{
return 1;
}
#else
static inline int range_is_allowed(unsigned long pfn, unsigned long size)
{
u64 from = ((u64)pfn) << PAGE_SHIFT;
u64 to = from + size;
u64 cursor = from;

while (cursor < to) {
if (!devmem_is_allowed(pfn)) {
printk(KERN_INFO
"Program %s tried to access /dev/mem between %Lx->%Lx.\n",
current->comm, from, to);
return 0;
}
cursor += PAGE_SIZE;
pfn++;
}
return 1;
}
#endif /* CONFIG_NONPROMISC_DEVMEM */

int phys_mem_access_prot_allowed(struct file *file, unsigned long pfn,
unsigned long size, pgprot_t *vma_prot)
{
Expand All @@ -513,9 +485,6 @@ int phys_mem_access_prot_allowed(struct file *file, unsigned long pfn,
unsigned long ret_flags;
int retval;

if (!range_is_allowed(pfn, size))
return 0;

if (file->f_flags & O_SYNC) {
flags = _PAGE_CACHE_UC;
}
Expand Down
1 change: 1 addition & 0 deletions trunk/include/asm-x86/e820_64.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ extern struct e820map e820;
extern void update_e820(void);

extern void reserve_early(unsigned long start, unsigned long end, char *name);
extern void free_early(unsigned long start, unsigned long end);
extern void early_res_to_bootmem(void);

#endif/*!__ASSEMBLY__*/
Expand Down

0 comments on commit 6bc93d4

Please sign in to comment.