Merge branch 'master' into global-asm
This commit is contained in:
@@ -21,8 +21,6 @@ interrupt_stack!(divide_by_zero, |stack| {
|
||||
interrupt_stack!(debug, |stack| {
|
||||
let mut handled = false;
|
||||
|
||||
let guard = ptrace::set_process_regs(stack);
|
||||
|
||||
// Disable singlestep before there is a breakpoint, since the breakpoint
|
||||
// handler might end up setting it again but unless it does we want the
|
||||
// default to be false.
|
||||
@@ -36,8 +34,6 @@ interrupt_stack!(debug, |stack| {
|
||||
stack.set_singlestep(had_singlestep);
|
||||
}
|
||||
|
||||
drop(guard);
|
||||
|
||||
if !handled {
|
||||
println!("Debug trap");
|
||||
stack.dump();
|
||||
@@ -64,11 +60,7 @@ interrupt_stack!(breakpoint, |stack| {
|
||||
// int3 instruction. After all, it's the sanest thing to do.
|
||||
stack.iret.rip -= 1;
|
||||
|
||||
let guard = ptrace::set_process_regs(stack);
|
||||
|
||||
if ptrace::breakpoint_callback(PTRACE_STOP_BREAKPOINT, None).is_none() {
|
||||
drop(guard);
|
||||
|
||||
println!("Breakpoint trap");
|
||||
stack.dump();
|
||||
ksignal(SIGTRAP);
|
||||
|
||||
@@ -190,7 +190,6 @@ interrupt_stack!(pit_stack, |stack| {
|
||||
timeout::trigger();
|
||||
|
||||
if PIT_TICKS.fetch_add(1, Ordering::SeqCst) >= 10 {
|
||||
let _guard = ptrace::set_process_regs(stack);
|
||||
let _ = context::switch();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -77,3 +77,12 @@ impl Entry {
|
||||
self.0 = (self.0 & !COUNTER_MASK) | (count << 52);
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
#[test]
|
||||
fn entry_has_required_arch_alignment() {
|
||||
use super::Entry;
|
||||
assert!(core::mem::align_of::<Entry>() >= core::mem::align_of::<u64>(), "alignment of Entry is less than the required alignment of u64 ({} < {})", core::mem::align_of::<Entry>(), core::mem::align_of::<u64>());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ impl<L> Table<L> where L: TableLevel {
|
||||
}
|
||||
|
||||
pub fn zero(&mut self) {
|
||||
for entry in self.entries.iter_mut() {
|
||||
for entry in unsafe { &mut self.entries }.iter_mut() {
|
||||
entry.set_zero();
|
||||
}
|
||||
}
|
||||
@@ -63,12 +63,12 @@ impl<L> Table<L> where L: TableLevel {
|
||||
/// Set number of entries in first table entry
|
||||
fn set_entry_count(&mut self, count: u64) {
|
||||
debug_assert!(count <= ENTRY_COUNT as u64, "count can't be greater than ENTRY_COUNT");
|
||||
self.entries[0].set_counter_bits(count);
|
||||
unsafe { &mut self.entries[0] }.set_counter_bits(count)
|
||||
}
|
||||
|
||||
/// Get number of entries in first table entry
|
||||
fn entry_count(&self) -> u64 {
|
||||
self.entries[0].counter_bits()
|
||||
unsafe { &self.entries[0] }.counter_bits()
|
||||
}
|
||||
|
||||
pub fn increment_entry_count(&mut self) {
|
||||
@@ -118,12 +118,12 @@ impl<L> Index<usize> for Table<L> where L: TableLevel {
|
||||
type Output = Entry;
|
||||
|
||||
fn index(&self, index: usize) -> &Entry {
|
||||
&self.entries[index]
|
||||
unsafe { &self.entries[index] }
|
||||
}
|
||||
}
|
||||
|
||||
impl<L> IndexMut<usize> for Table<L> where L: TableLevel {
|
||||
fn index_mut(&mut self, index: usize) -> &mut Entry {
|
||||
&mut self.entries[index]
|
||||
unsafe { &mut self.entries[index] }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -275,5 +275,11 @@ pub extern fn ksignal(signal: usize) {
|
||||
println!("NAME {}", unsafe { ::core::str::from_utf8_unchecked(&context.name.lock()) });
|
||||
}
|
||||
}
|
||||
syscall::exit(signal & 0x7F);
|
||||
|
||||
// Try running kill(getpid(), signal), but fallback to exiting
|
||||
syscall::getpid()
|
||||
.and_then(|pid| syscall::kill(pid, signal).map(|_| ()))
|
||||
.unwrap_or_else(|_| {
|
||||
syscall::exit(signal & 0x7F);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user