[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Changes in Memory Routines
Hi All
I am porting a memory routine written in 2.2.12 version of linux to 2.4.0
version.
The routine maps a page into the user page table. The routine was using
couple of functions like mk_pte and MAP_NR. However while using these
functions in 2.4.0 causes compilation errors/warnings.
It looks MAP_NR is now replaced by virt_to_page function. And mk_pte
function which was earlier expecting an unsigned long as its first
parameter is now expecting struct *page as its first parameter in 2.4.0
version.
Any help in this matter will be appreciated.
Here is the code used in 2.2.12 version.
/* this function maps the page used for dbuffer into the user page tables
at
the correct linear address.
argument: the physical address of the page
return value: phy_address for OK, -1 for error
*/
static unsigned long put_dbuff_page_into_pt( struct task_struct *tsp,
unsigned long phy_addr
)
{
pte_t *page_table;
unsigned long linear_address = TO_VIRTUAL(phy_addr);
int repeat = 10;
unsigned long new_phys = phy_addr;
do {/* calculating the position of the page table entry in page table */
if( (page_table = get_empty_pgtable(tsp, linear_address)) == NULL)
{
printk("put_dbuff_page_into_pt: Out of mem for pt.\n");
return -1;
}
if( !pte_none(*page_table) )
{
printk("put_dbuff_page_into_pt: PTE_VAL = %lx\n",
pte_val(*page_table));
dirty_pages[dp_count] = linear_address;
dp_count++;
if(!(new_phys = __get_free_page(GFP_KERNEL)))
{
printk("put_dbuff_page_into_pt: No free pages.\n");
return -1;
}
linear_address = TO_VIRTUAL(new_phys);
repeat--;
}
else
repeat = 0;
} while(repeat);
*page_table = mk_pte(new_phys, PAGE_SHARED);
mem_map_reserve(MAP_NR(new_phys));
printk("p_d: l_a=%x\n", linear_address);
return new_phys;
}
Sunil Kumar
Dept of Computer Science
U of New Hampshire
Email: skumar@cs.unh.edu
Voice: 603-295-4618 (R)
-
Linux-mm-bugs: bugzilla list for the Linux-MM subsystem
Archive: http://mail.nl.linux.org/linux-mm-bugs/
Web site: http://www.linux.eu.org/Linux-MM/
Development: linux-mm@kvack.org