Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
6b779295
Commit
6b779295
authored
Aug 25, 2003
by
David Mosberger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ia64: Use offset_in_page() instead of equivalent open code.
parent
2e6fe16f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
13 deletions
+12
-13
arch/ia64/ia32/sys_ia32.c
arch/ia64/ia32/sys_ia32.c
+10
-11
arch/ia64/kernel/sys_ia64.c
arch/ia64/kernel/sys_ia64.c
+1
-1
include/asm-ia64/pci.h
include/asm-ia64/pci.h
+1
-1
No files found.
arch/ia64/ia32/sys_ia32.c
View file @
6b779295
...
@@ -76,7 +76,6 @@
...
@@ -76,7 +76,6 @@
#define OFFSET4K(a) ((a) & 0xfff)
#define OFFSET4K(a) ((a) & 0xfff)
#define PAGE_START(addr) ((addr) & PAGE_MASK)
#define PAGE_START(addr) ((addr) & PAGE_MASK)
#define PAGE_OFF(addr) ((addr) & ~PAGE_MASK)
#define high2lowuid(uid) ((uid) > 65535 ? 65534 : (uid))
#define high2lowuid(uid) ((uid) > 65535 ? 65534 : (uid))
#define high2lowgid(gid) ((gid) > 65535 ? 65534 : (gid))
#define high2lowgid(gid) ((gid) > 65535 ? 65534 : (gid))
...
@@ -271,11 +270,11 @@ mmap_subpage (struct file *file, unsigned long start, unsigned long end, int pro
...
@@ -271,11 +270,11 @@ mmap_subpage (struct file *file, unsigned long start, unsigned long end, int pro
if
(
old_prot
)
{
if
(
old_prot
)
{
/* copy back the old page contents. */
/* copy back the old page contents. */
if
(
PAGE_OFF
(
start
))
if
(
offset_in_page
(
start
))
copy_to_user
((
void
*
)
PAGE_START
(
start
),
page
,
PAGE_OFF
(
start
));
copy_to_user
((
void
*
)
PAGE_START
(
start
),
page
,
offset_in_page
(
start
));
if
(
PAGE_OFF
(
end
))
if
(
offset_in_page
(
end
))
copy_to_user
((
void
*
)
end
,
page
+
PAGE_OFF
(
end
),
copy_to_user
((
void
*
)
end
,
page
+
offset_in_page
(
end
),
PAGE_SIZE
-
PAGE_OFF
(
end
));
PAGE_SIZE
-
offset_in_page
(
end
));
}
}
if
(
!
(
flags
&
MAP_ANONYMOUS
))
{
if
(
!
(
flags
&
MAP_ANONYMOUS
))
{
...
@@ -330,7 +329,7 @@ emulate_mmap (struct file *file, unsigned long start, unsigned long len, int pro
...
@@ -330,7 +329,7 @@ emulate_mmap (struct file *file, unsigned long start, unsigned long len, int pro
"%s(%d): emulate_mmap() can't share tail (end=0x%lx)
\n
"
,
"%s(%d): emulate_mmap() can't share tail (end=0x%lx)
\n
"
,
current
->
comm
,
current
->
pid
,
end
);
current
->
comm
,
current
->
pid
,
end
);
ret
=
mmap_subpage
(
file
,
max
(
start
,
PAGE_START
(
end
)),
end
,
prot
,
flags
,
ret
=
mmap_subpage
(
file
,
max
(
start
,
PAGE_START
(
end
)),
end
,
prot
,
flags
,
(
off
+
len
)
-
PAGE_OFF
(
end
));
(
off
+
len
)
-
offset_in_page
(
end
));
if
(
IS_ERR
((
void
*
)
ret
))
if
(
IS_ERR
((
void
*
)
ret
))
return
ret
;
return
ret
;
pend
-=
PAGE_SIZE
;
pend
-=
PAGE_SIZE
;
...
@@ -347,14 +346,14 @@ emulate_mmap (struct file *file, unsigned long start, unsigned long len, int pro
...
@@ -347,14 +346,14 @@ emulate_mmap (struct file *file, unsigned long start, unsigned long len, int pro
tmp
=
arch_get_unmapped_area
(
file
,
pstart
-
fudge
,
pend
-
pstart
,
0
,
flags
);
tmp
=
arch_get_unmapped_area
(
file
,
pstart
-
fudge
,
pend
-
pstart
,
0
,
flags
);
if
(
tmp
!=
pstart
)
{
if
(
tmp
!=
pstart
)
{
pstart
=
tmp
;
pstart
=
tmp
;
start
=
pstart
+
PAGE_OFF
(
off
);
/* make start congruent with off */
start
=
pstart
+
offset_in_page
(
off
);
/* make start congruent with off */
end
=
start
+
len
;
end
=
start
+
len
;
pend
=
PAGE_ALIGN
(
end
);
pend
=
PAGE_ALIGN
(
end
);
}
}
}
}
poff
=
off
+
(
pstart
-
start
);
/* note: (pstart - start) may be negative */
poff
=
off
+
(
pstart
-
start
);
/* note: (pstart - start) may be negative */
is_congruent
=
(
flags
&
MAP_ANONYMOUS
)
||
(
PAGE_OFF
(
poff
)
==
0
);
is_congruent
=
(
flags
&
MAP_ANONYMOUS
)
||
(
offset_in_page
(
poff
)
==
0
);
if
((
flags
&
MAP_SHARED
)
&&
!
is_congruent
)
if
((
flags
&
MAP_SHARED
)
&&
!
is_congruent
)
printk
(
KERN_INFO
"%s(%d): emulate_mmap() can't share contents of incongruent mmap "
printk
(
KERN_INFO
"%s(%d): emulate_mmap() can't share contents of incongruent mmap "
...
@@ -588,7 +587,7 @@ sys32_mprotect (unsigned int start, unsigned int len, int prot)
...
@@ -588,7 +587,7 @@ sys32_mprotect (unsigned int start, unsigned int len, int prot)
down
(
&
ia32_mmap_sem
);
down
(
&
ia32_mmap_sem
);
{
{
if
(
PAGE_OFF
(
start
))
{
if
(
offset_in_page
(
start
))
{
/* start address is 4KB aligned but not page aligned. */
/* start address is 4KB aligned but not page aligned. */
retval
=
mprotect_subpage
(
PAGE_START
(
start
),
prot
);
retval
=
mprotect_subpage
(
PAGE_START
(
start
),
prot
);
if
(
retval
<
0
)
if
(
retval
<
0
)
...
@@ -599,7 +598,7 @@ sys32_mprotect (unsigned int start, unsigned int len, int prot)
...
@@ -599,7 +598,7 @@ sys32_mprotect (unsigned int start, unsigned int len, int prot)
goto
out
;
/* retval is already zero... */
goto
out
;
/* retval is already zero... */
}
}
if
(
PAGE_OFF
(
end
))
{
if
(
offset_in_page
(
end
))
{
/* end address is 4KB aligned but not page aligned. */
/* end address is 4KB aligned but not page aligned. */
retval
=
mprotect_subpage
(
PAGE_START
(
end
),
prot
);
retval
=
mprotect_subpage
(
PAGE_START
(
end
),
prot
);
if
(
retval
<
0
)
if
(
retval
<
0
)
...
...
arch/ia64/kernel/sys_ia64.c
View file @
6b779295
...
@@ -242,7 +242,7 @@ sys_mmap2 (unsigned long addr, unsigned long len, int prot, int flags, int fd, l
...
@@ -242,7 +242,7 @@ sys_mmap2 (unsigned long addr, unsigned long len, int prot, int flags, int fd, l
asmlinkage
unsigned
long
asmlinkage
unsigned
long
sys_mmap
(
unsigned
long
addr
,
unsigned
long
len
,
int
prot
,
int
flags
,
int
fd
,
long
off
)
sys_mmap
(
unsigned
long
addr
,
unsigned
long
len
,
int
prot
,
int
flags
,
int
fd
,
long
off
)
{
{
if
(
(
off
&
~
PAGE_MASK
)
!=
0
)
if
(
offset_in_page
(
off
)
!=
0
)
return
-
EINVAL
;
return
-
EINVAL
;
addr
=
do_mmap2
(
addr
,
len
,
prot
,
flags
,
fd
,
off
>>
PAGE_SHIFT
);
addr
=
do_mmap2
(
addr
,
len
,
prot
,
flags
,
fd
,
off
>>
PAGE_SHIFT
);
...
...
include/asm-ia64/pci.h
View file @
6b779295
...
@@ -74,7 +74,7 @@ extern int pcibios_prep_mwi (struct pci_dev *);
...
@@ -74,7 +74,7 @@ extern int pcibios_prep_mwi (struct pci_dev *);
#define pci_dac_dma_supported(pci_dev, mask) (1)
#define pci_dac_dma_supported(pci_dev, mask) (1)
#define pci_dac_page_to_dma(dev,pg,off,dir) ((dma_addr_t) page_to_bus(pg) + (off))
#define pci_dac_page_to_dma(dev,pg,off,dir) ((dma_addr_t) page_to_bus(pg) + (off))
#define pci_dac_dma_to_page(dev,dma_addr) (virt_to_page(bus_to_virt(dma_addr)))
#define pci_dac_dma_to_page(dev,dma_addr) (virt_to_page(bus_to_virt(dma_addr)))
#define pci_dac_dma_to_offset(dev,dma_addr)
((dma_addr) & ~PAGE_MASK
)
#define pci_dac_dma_to_offset(dev,dma_addr)
offset_in_page(dma_addr
)
#define pci_dac_dma_sync_single(dev,dma_addr,len,dir) do { mb(); } while (0)
#define pci_dac_dma_sync_single(dev,dma_addr,len,dir) do { mb(); } while (0)
#define sg_dma_len(sg) ((sg)->dma_length)
#define sg_dma_len(sg) ((sg)->dma_length)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment