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
99ef44b7
Commit
99ef44b7
authored
May 20, 2002
by
Linus Torvalds
Committed by
Linus Torvalds
May 20, 2002
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clean up %cr3 loading on x86, fix lazy TLB problem
parent
6c52c43c
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
13 additions
and
5 deletions
+13
-5
arch/i386/kernel/process.c
arch/i386/kernel/process.c
+1
-1
arch/i386/kernel/smp.c
arch/i386/kernel/smp.c
+4
-0
arch/i386/mm/init.c
arch/i386/mm/init.c
+1
-1
include/asm-i386/mmu_context.h
include/asm-i386/mmu_context.h
+3
-3
include/asm-i386/processor.h
include/asm-i386/processor.h
+4
-0
No files found.
arch/i386/kernel/process.c
View file @
99ef44b7
...
...
@@ -321,7 +321,7 @@ void machine_real_restart(unsigned char *code, int length)
/*
* Use `swapper_pg_dir' as our page directory.
*/
asm
volatile
(
"movl %0,%%cr3"
:
:
"r"
(
__pa
(
swapper_pg_dir
))
);
load_cr3
(
swapper_pg_dir
);
/* Write 0x1234 to absolute memory location 0x472. The BIOS reads
this on booting to tell it to "Bypass memory test (also warm
...
...
arch/i386/kernel/smp.c
View file @
99ef44b7
...
...
@@ -299,12 +299,16 @@ static spinlock_t tlbstate_lock = SPIN_LOCK_UNLOCKED;
/*
* We cannot call mmdrop() because we are in interrupt context,
* instead update mm->cpu_vm_mask.
*
* We need to reload %cr3 since the page tables may be going
* away from under us..
*/
static
void
inline
leave_mm
(
unsigned
long
cpu
)
{
if
(
cpu_tlbstate
[
cpu
].
state
==
TLBSTATE_OK
)
BUG
();
clear_bit
(
cpu
,
&
cpu_tlbstate
[
cpu
].
active_mm
->
cpu_vm_mask
);
load_cr3
(
swapper_pg_dir
);
}
/*
...
...
arch/i386/mm/init.c
View file @
99ef44b7
...
...
@@ -307,7 +307,7 @@ void __init paging_init(void)
{
pagetable_init
();
__asm__
(
"movl %0,%%cr3
\n
"
::
"r"
(
__pa
(
swapper_pg_dir
))
);
load_cr3
(
swapper_pg_dir
);
#if CONFIG_X86_PAE
/*
...
...
include/asm-i386/mmu_context.h
View file @
99ef44b7
...
...
@@ -38,7 +38,7 @@ static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, str
set_bit
(
cpu
,
&
next
->
cpu_vm_mask
);
/* Re-load page tables */
asm
volatile
(
"movl %0,%%cr3"
:
:
"r"
(
__pa
(
next
->
pgd
))
);
load_cr3
(
next
->
pgd
);
/* load_LDT, if either the previous or next thread
* has a non-default LDT.
...
...
@@ -53,9 +53,9 @@ static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, str
BUG
();
if
(
!
test_and_set_bit
(
cpu
,
&
next
->
cpu_vm_mask
))
{
/* We were in lazy tlb mode and leave_mm disabled
* tlb flush IPI delivery. We must
flush our tlb
.
* tlb flush IPI delivery. We must
reload %cr3
.
*/
lo
cal_flush_tlb
(
);
lo
ad_cr3
(
next
->
pgd
);
load_LDT
(
&
next
->
context
);
}
}
...
...
include/asm-i386/processor.h
View file @
99ef44b7
...
...
@@ -173,6 +173,10 @@ static inline unsigned int cpuid_edx(unsigned int op)
return
edx
;
}
#define load_cr3(pgdir) \
asm volatile("movl %0,%%cr3": :"r" (__pa(pgdir)))
/*
* Intel CPU features in CR4
*/
...
...
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