projects
/
pintos-anon
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
2ce1eb4
)
Add memory clobbers to several asm statements,
author
Ben Pfaff
<blp@cs.stanford.edu>
Sat, 11 Nov 2006 14:25:16 +0000
(14:25 +0000)
committer
Ben Pfaff
<blp@cs.stanford.edu>
Sat, 11 Nov 2006 14:25:16 +0000
(14:25 +0000)
to prevent reordering.
src/threads/init.c
patch
|
blob
|
history
src/threads/interrupt.c
patch
|
blob
|
history
src/threads/thread.c
patch
|
blob
|
history
src/userprog/pagedir.c
patch
|
blob
|
history
src/userprog/process.c
patch
|
blob
|
history
diff --git
a/src/threads/init.c
b/src/threads/init.c
index 2931704120c67bf39441ce56aa469a128b556e39..5961deba3e6f8d82cd0e75abab89321d87cda597 100644
(file)
--- a/
src/threads/init.c
+++ b/
src/threads/init.c
@@
-382,7
+382,7
@@
power_off (void)
for (p = s; *p != '\0'; p++)
outb (0x8900, *p);
for (p = s; *p != '\0'; p++)
outb (0x8900, *p);
- asm
("cli; hlt
");
+ asm
volatile ("cli; hlt" : : : "memory
");
printf ("still running...\n");
for (;;);
}
printf ("still running...\n");
for (;;);
}
diff --git
a/src/threads/interrupt.c
b/src/threads/interrupt.c
index 72b37837dcf420f98110b4e1ab23c838b3704a29..3e37213876768fcded5b4ad671636671231e3ea4 100644
(file)
--- a/
src/threads/interrupt.c
+++ b/
src/threads/interrupt.c
@@
-95,7
+95,7
@@
intr_disable (void)
/* Disable interrupts by clearing the interrupt flag.
See [IA32-v2b] "CLI" and [IA32-v3a] 5.8.1 "Masking Maskable
Hardware Interrupts". */
/* Disable interrupts by clearing the interrupt flag.
See [IA32-v2b] "CLI" and [IA32-v3a] 5.8.1 "Masking Maskable
Hardware Interrupts". */
- asm volatile ("cli");
+ asm volatile ("cli"
: : : "memory"
);
return old_level;
}
return old_level;
}
diff --git
a/src/threads/thread.c
b/src/threads/thread.c
index 938d7f87d6b0b296e676ca971928a6ba0823fd27..1dc34adac7770f6bc53b5e5a1fb6b533ec0043f4 100644
(file)
--- a/
src/threads/thread.c
+++ b/
src/threads/thread.c
@@
-389,7
+389,7
@@
idle (void *idle_started_ UNUSED)
See [IA32-v2a] "HLT", [IA32-v2b] "STI", and [IA32-v3a]
7.11.1 "HLT Instruction". */
See [IA32-v2a] "HLT", [IA32-v2b] "STI", and [IA32-v3a]
7.11.1 "HLT Instruction". */
- asm
("sti; hlt
");
+ asm
volatile ("sti; hlt" : : : "memory
");
}
}
}
}
diff --git
a/src/userprog/pagedir.c
b/src/userprog/pagedir.c
index 7d993755ca2b5e10e3e0fe2cb3d530b560dc60c6..30bdfe263b67f58ee9787b413036de6984c7628b 100644
(file)
--- a/
src/userprog/pagedir.c
+++ b/
src/userprog/pagedir.c
@@
-227,7
+227,7
@@
pagedir_activate (uint32_t *pd)
new page tables immediately. See [IA32-v2a] "MOV--Move
to/from Control Registers" and [IA32-v3a] 3.7.5 "Base
Address of the Page Directory". */
new page tables immediately. See [IA32-v2a] "MOV--Move
to/from Control Registers" and [IA32-v3a] 3.7.5 "Base
Address of the Page Directory". */
- asm volatile ("movl %0, %%cr3" :
: "r" (vtop (pd))
);
+ asm volatile ("movl %0, %%cr3" :
: "r" (vtop (pd)) : "memory"
);
}
/* Returns the currently active page directory. */
}
/* Returns the currently active page directory. */
diff --git
a/src/userprog/process.c
b/src/userprog/process.c
index bece1fe95cc990c2e8313bf8481ed0b1e7136f52..675dc254af3db38cfea22ec26d77250aeb9206a9 100644
(file)
--- a/
src/userprog/process.c
+++ b/
src/userprog/process.c
@@
-72,7
+72,7
@@
execute_thread (void *file_name_)
arguments on the stack in the form of a `struct intr_frame',
we just point the stack pointer (%esp) to our stack frame
and jump to it. */
arguments on the stack in the form of a `struct intr_frame',
we just point the stack pointer (%esp) to our stack frame
and jump to it. */
- asm
("movl %0, %%esp; jmp intr_exit" :: "g" (&if_)
);
+ asm
volatile ("movl %0, %%esp; jmp intr_exit" : : "g" (&if_) : "memory"
);
NOT_REACHED ();
}
NOT_REACHED ();
}