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
31f6a11f
Commit
31f6a11f
authored
Jun 03, 2008
by
Paul Mundt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sh: Consolidate addr/access_ok across mmu/nommu on 32bit.
Signed-off-by:
Paul Mundt
<
lethal@linux-sh.org
>
parent
85247285
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
36 deletions
+3
-36
include/asm-sh/uaccess_32.h
include/asm-sh/uaccess_32.h
+3
-36
No files found.
include/asm-sh/uaccess_32.h
View file @
31f6a11f
...
@@ -19,26 +19,8 @@
...
@@ -19,26 +19,8 @@
#define VERIFY_READ 0
#define VERIFY_READ 0
#define VERIFY_WRITE 1
#define VERIFY_WRITE 1
#if !defined(CONFIG_MMU)
/* NOMMU is always true */
#define __addr_ok(addr) (1)
/*
* __access_ok: Check if address with size is OK or not.
*
* If we don't have an MMU (or if its disabled) the only thing we really have
* to look out for is if the address resides somewhere outside of what
* available RAM we have.
*/
static
inline
int
__access_ok
(
unsigned
long
addr
,
unsigned
long
size
)
{
return
1
;
}
#else
/* CONFIG_MMU */
#define __addr_ok(addr) \
#define __addr_ok(addr) \
((unsigned long)(addr) < (current_thread_info()->addr_limit.seg))
((unsigned long __force)(addr) < current_thread_info()->addr_limit.seg)
/*
/*
* __access_ok: Check if address with size is OK or not.
* __access_ok: Check if address with size is OK or not.
...
@@ -48,23 +30,8 @@ static inline int __access_ok(unsigned long addr, unsigned long size)
...
@@ -48,23 +30,8 @@ static inline int __access_ok(unsigned long addr, unsigned long size)
* sum := addr + size; carry? --> flag = true;
* sum := addr + size; carry? --> flag = true;
* if (sum >= addr_limit) flag = true;
* if (sum >= addr_limit) flag = true;
*/
*/
static
inline
int
__access_ok
(
unsigned
long
addr
,
unsigned
long
size
)
#define __access_ok(addr, size) \
{
(__addr_ok((addr) + (size)))
unsigned
long
flag
,
sum
;
__asm__
(
"clrt
\n\t
"
"addc %3, %1
\n\t
"
"movt %0
\n\t
"
"cmp/hi %4, %1
\n\t
"
"rotcl %0"
:
"=&r"
(
flag
),
"=r"
(
sum
)
:
"1"
(
addr
),
"r"
(
size
),
"r"
(
current_thread_info
()
->
addr_limit
.
seg
)
:
"t"
);
return
flag
==
0
;
}
#endif
/* CONFIG_MMU */
#define access_ok(type, addr, size) \
#define access_ok(type, addr, size) \
(__chk_user_ptr(addr), \
(__chk_user_ptr(addr), \
__access_ok((unsigned long __force)(addr), (size)))
__access_ok((unsigned long __force)(addr), (size)))
...
...
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