From: Sunil Kumar <skumar@cisunix.unh.edu>
To: linux-mm@kvack.org
Subject: How to add a user buffer in page table
Date: Tue, 21 Nov 2000 01:44:27 -0500 (EST) [thread overview]
Message-ID: <Pine.OSF.4.21.0011210127200.434702-100000@hopper.unh.edu> (raw)
Hi All
I was trying to port a function written by me from linux 2.2.12 to
2.4-test9 version. The function put_dbuff_page_into_pt puts a
dedicated buffer into page table.
However I am facing problem since the mk_pte function in 2.2.12 was using
unisgned long as its first parameter and in test9 version mk_pte uses
struct page * as its parameter.
Also there is no MAP_NR macro in test9. I guess its being replaced by
virt_to_page function in test9.
Here is my functin in 2.2.12 version. In this function get_empty_pgtable
is written by me.
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;
}
/* end of function */
If anybody has any clue how to modify the mk_pte function. In 2.2.12
version new_phys was an unsigned long, but in test9 version it expects it
to struct page *.
I guess MAP_NR is to replaced by virt_to_page.
thanks
Sunil Kumar
Dept of Computer Science
U of New Hampshire
Email: skumar@cs.unh.edu
Voice: 603-862-0701 (O)
295-4618 (R)
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux.eu.org/Linux-MM/
reply other threads:[~2000-11-21 6:44 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Pine.OSF.4.21.0011210127200.434702-100000@hopper.unh.edu \
--to=skumar@cisunix.unh.edu \
--cc=linux-mm@kvack.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox