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
Kirill Smelkov
linux
Commits
193dd2ce
Commit
193dd2ce
authored
Apr 04, 2006
by
Ralf Baechle
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[MIPS] R2: Implement shadow register allocation without spinlock.
Signed-off-by:
Ralf Baechle
<
ralf@linux-mips.org
>
parent
62a44215
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
23 deletions
+18
-23
arch/mips/kernel/traps.c
arch/mips/kernel/traps.c
+18
-23
No files found.
arch/mips/kernel/traps.c
View file @
193dd2ce
...
...
@@ -961,15 +961,19 @@ void *set_except_vector(int n, void *addr)
#ifdef CONFIG_CPU_MIPSR2
/*
*
Shadow register
allocation
*
MIPSR2 shadow register set
allocation
* FIXME: SMP...
*/
/* MIPSR2 shadow register sets */
struct
shadow_registers
{
spinlock_t
sr_lock
;
/* */
int
sr_supported
;
/* Number of shadow register sets supported */
int
sr_allocated
;
/* Bitmap of allocated shadow registers */
static
struct
shadow_registers
{
/*
* Number of shadow register sets supported
*/
unsigned
long
sr_supported
;
/*
* Bitmap of allocated shadow registers
*/
unsigned
long
sr_allocated
;
}
shadow_registers
;
void
mips_srs_init
(
void
)
...
...
@@ -980,7 +984,6 @@ void mips_srs_init(void)
shadow_registers
.
sr_supported
);
#endif
shadow_registers
.
sr_allocated
=
1
;
/* Set 0 used by kernel */
spin_lock_init
(
&
shadow_registers
.
sr_lock
);
}
int
mips_srs_max
(
void
)
...
...
@@ -991,32 +994,24 @@ int mips_srs_max(void)
int
mips_srs_alloc
(
void
)
{
struct
shadow_registers
*
sr
=
&
shadow_registers
;
unsigned
long
flags
;
int
set
;
spin_lock_irqsave
(
&
sr
->
sr_lock
,
flags
);
again:
set
=
find_first_zero_bit
(
&
sr
->
sr_allocated
,
sr
->
sr_supported
);
if
(
set
>=
sr
->
sr_supported
)
return
-
1
;
for
(
set
=
0
;
set
<
sr
->
sr_supported
;
set
++
)
{
if
((
sr
->
sr_allocated
&
(
1
<<
set
))
==
0
)
{
sr
->
sr_allocated
|=
1
<<
set
;
spin_unlock_irqrestore
(
&
sr
->
sr_lock
,
flags
);
return
set
;
}
}
if
(
test_and_set_bit
(
set
,
&
sr
->
sr_allocated
))
goto
again
;
/* None available */
spin_unlock_irqrestore
(
&
sr
->
sr_lock
,
flags
);
return
-
1
;
return
set
;
}
void
mips_srs_free
(
int
set
)
{
struct
shadow_registers
*
sr
=
&
shadow_registers
;
unsigned
long
flags
;
spin_lock_irqsave
(
&
sr
->
sr_lock
,
flags
);
sr
->
sr_allocated
&=
~
(
1
<<
set
);
spin_unlock_irqrestore
(
&
sr
->
sr_lock
,
flags
);
clear_bit
(
set
,
&
sr
->
sr_allocated
);
}
static
void
*
set_vi_srs_handler
(
int
n
,
void
*
addr
,
int
srs
)
...
...
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