Skip to content
Snippets Groups Projects
Commit c0f015af authored by Yurii Zubrytskyi's avatar Yurii Zubrytskyi Committed by Jin Qian
Browse files

[pipe] Fix the pipe driver for x64 platform + correct pages count


- first_page and last_page are page start addresses, so the type
  has to be long for x64

- as those variables are addresses, their difference doesn't
  give the number of pages.

Signed-off-by: default avatarYurii Zubrytskyi <zyy@google.com>
Change-Id: Ia00420c3261dea0ca4bba1f72125a1641c503000
parent 48e6bf57
No related branches found
No related tags found
No related merge requests found
...@@ -308,7 +308,7 @@ static ssize_t goldfish_pipe_read_write(struct file *filp, char __user *buffer, ...@@ -308,7 +308,7 @@ static ssize_t goldfish_pipe_read_write(struct file *filp, char __user *buffer,
unsigned long page_end = (address & PAGE_MASK) + PAGE_SIZE; unsigned long page_end = (address & PAGE_MASK) + PAGE_SIZE;
unsigned long next, avail; unsigned long next, avail;
int status, wakeBit, page_i, num_contiguous_pages; int status, wakeBit, page_i, num_contiguous_pages;
int first_page, last_page, requested_pages; long first_page, last_page, requested_pages;
unsigned long xaddr, xaddr_prev, xaddr_i; unsigned long xaddr, xaddr_prev, xaddr_i;
/* /*
...@@ -316,7 +316,7 @@ static ssize_t goldfish_pipe_read_write(struct file *filp, char __user *buffer, ...@@ -316,7 +316,7 @@ static ssize_t goldfish_pipe_read_write(struct file *filp, char __user *buffer,
*/ */
first_page = address & PAGE_MASK; first_page = address & PAGE_MASK;
last_page = (address_end - 1) & PAGE_MASK; last_page = (address_end - 1) & PAGE_MASK;
requested_pages = (last_page - first_page + 1); requested_pages = ((last_page - first_page) >> PAGE_SHIFT) + 1;
if (requested_pages > MAX_PAGES_TO_GRAB) { if (requested_pages > MAX_PAGES_TO_GRAB) {
requested_pages = MAX_PAGES_TO_GRAB; requested_pages = MAX_PAGES_TO_GRAB;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment