Skip to content

Commit

Permalink
Cleanup.
Browse files Browse the repository at this point in the history
  • Loading branch information
dbittman committed Dec 16, 2024
1 parent 03819c1 commit eea9f81
Show file tree
Hide file tree
Showing 11 changed files with 2 additions and 68 deletions.
21 changes: 1 addition & 20 deletions doc/src/develop.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,26 +18,7 @@ runs on the Twizzler operating system you can follow these steps:
2. Create a new program, named ```hello```. The ```Cargo``` command will actually create the canonical ```Hello world``` program for you.
```cargo new --bin hello```

3. Add the twizzler runtime. First, add the following to the main.rs file within hello/src:

```rust
extern crate twizzler_minruntime;
```

then, add the following to your Cargo.toml, under `[dependencies]`:

```toml
twizzler-minruntime = { path = "../../runtime/minruntime" }
```

and later in the file:

```toml
[package.metadata]
twizzler-build = "static"
```

4. Change directory back to the project root, and edit the Cargo.toml file in the root directory to add the program to the Twizzler build system.
3. Change directory back to the project root, and edit the Cargo.toml file in the root directory to add the program to the Twizzler build system.

The following diff shows the two lines you need to add:

Expand Down
3 changes: 0 additions & 3 deletions src/kernel/src/memory/context/virtmem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,6 @@ impl UserContext for VirtContext {
slot: Slot,
object_info: &ObjectContextInfo,
) -> Result<(), InsertError> {
logln!("inso: {:?}", slot.start_vaddr());
let new_slot_info = VirtContextSlot {
obj: object_info.object().clone(),
slot,
Expand Down Expand Up @@ -308,7 +307,6 @@ impl UserContext for VirtContext {
for arch in arches.values() {
if let Some(maps) = slots.obj_to_slots(obj) {
for map in maps {
logln!("invl: {:?}", map.start_vaddr());
let info = slots
.get(map)
.expect("invalid slot info for a mapped object");
Expand All @@ -329,7 +327,6 @@ impl UserContext for VirtContext {
}

fn remove_object(&self, info: Self::MappingInfo) {
logln!("remv: {:?}", info.start_vaddr());
let mut slots = self.slots.lock();
if let Some(slot) = slots.remove(info) {
let arches = self.secctx.lock();
Expand Down
5 changes: 1 addition & 4 deletions src/kernel/src/obj/control.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,7 @@ impl<Base: BaseType> ControlObjectCacher<Base> {
/// for this type.
pub fn base(&self) -> &Base {
match &self.quick_or_kernel {
QuickOrKernel::Quick(quick) => unsafe {
logln!("quick frame: {:?}", quick.base_frame.start_address());
quick.base_ptr.as_ref()
},
QuickOrKernel::Quick(quick) => unsafe { quick.base_ptr.as_ref() },
QuickOrKernel::Kernel(kobj) => kobj.base(),
}
}
Expand Down
1 change: 0 additions & 1 deletion src/kernel/src/obj/pages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,6 @@ impl Object {

if let Some((page, _)) = obj_page_tree.get_page(page_number, true) {
let t = page.get_mut_to_val::<AtomicU64>(page_offset);
logln!("rau64: {:?}", page.physical_address());
(*t).load(Ordering::SeqCst)
} else {
let page = Page::new();
Expand Down
1 change: 0 additions & 1 deletion src/kernel/src/obj/thread_sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ impl Object {
let mut sleep_info = self.sleep_info.lock();

let cur = unsafe { self.read_atomic_u64(offset) };
logln!("check: read val: {}", cur);
let res = op.check(cur, val, flags);
if res {
if first_sleep {
Expand Down
1 change: 0 additions & 1 deletion src/kernel/src/sched.rs
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,6 @@ fn balance(topo: &CPUTopoNode) {
let donor = get_processor(donor.cpuid);
let recipient = get_processor(recipient.cpuid);
let donor_load = donor.current_load();
// logln!("balance {:?} {}", cpuset, donor_load);
if donor_load <= 2 {
break;
}
Expand Down
5 changes: 0 additions & 5 deletions src/kernel/src/syscall/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,11 +213,6 @@ fn zero_ok<T: Into<u64>>(t: T) -> (u64, u64) {
pub fn syscall_entry<T: SyscallContext>(context: &mut T) {
match context.num().into() {
Syscall::ObjectUnmap => {
logln!(
"unmap slot: {} ({:x})",
context.arg2::<u64>(),
context.arg2::<u64>() * MAX_SIZE as u64
);
context.set_return_values(1u64, 0u64);
}
Syscall::Null => {
Expand Down
11 changes: 0 additions & 11 deletions src/kernel/src/syscall/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,6 @@ struct SleepEvent {

fn prep_sleep(sleep: &ThreadSyncSleep, first_sleep: bool) -> Result<SleepEvent, ThreadSyncError> {
let (obj, offset) = get_obj(sleep.reference)?;
logln!(
" sync {}: found object {:?}",
current_thread_ref().unwrap().id(),
obj.id()
);
let did_sleep = if matches!(sleep.reference, ThreadSyncReference::Virtual32(_)) {
obj.setup_sleep_word32(
offset,
Expand Down Expand Up @@ -168,12 +163,6 @@ pub fn sys_thread_sync(
ops: &mut [ThreadSync],
timeout: Option<&mut Duration>,
) -> Result<usize, ThreadSyncError> {
logln!(
"SYNC: {}: {:?} timeout: {:?}",
current_thread_ref().unwrap().id(),
ops,
timeout
);
if let Some(ref timeout) = timeout {
if ops.is_empty() {
simple_timed_sleep(timeout);
Expand Down
6 changes: 0 additions & 6 deletions src/kernel/src/syscall/thread.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,6 @@ pub fn sys_spawn(args: &ThreadSpawnArgs) -> Result<ObjID, ThreadSpawnError> {
}

pub fn thread_ctrl(cmd: ThreadControl, arg: u64) -> (u64, u64) {
logln!(
"TCTL: {}: {:?} {:x}",
current_thread_ref().unwrap().id(),
cmd,
arg
);
match cmd {
ThreadControl::SetUpcall => {
let Some(data) = (unsafe { (arg as usize as *const UpcallTarget).as_ref() }) else {
Expand Down
14 changes: 0 additions & 14 deletions src/kernel/src/thread.rs
Original file line number Diff line number Diff line change
Expand Up @@ -224,16 +224,8 @@ impl Thread {
{
panic!("cannot signal wake up in set_state_and_code due to call from critical section");
}
logln!("SET STATE: {}", self.id());
let base = self.control_object.base();
logln!("{}: setting state: {:?}", self.id(), state);
let old_state = base.set_state(state, code);
logln!(
"{}: state is: {:?} => {:?}",
self.id(),
old_state,
base.get_state()
);

// Note that since this value can be written to by userspace, we must check if we're
// critical because we can't rely on userspace following the rules. Same for checking if
Expand All @@ -246,12 +238,6 @@ impl Thread {
&& !current_thread_ref().map_or(true, |ct| ct.is_critical())
&& old_state != ExecutionState::Exited
{
logln!(
"wakeup word from exit {}: {:?} off: {:x}",
self.id(),
self.control_object.object().id(),
NULLPAGE_SIZE + offset_of!(ThreadRepr, status)
);
self.control_object
.object()
.wakeup_word(NULLPAGE_SIZE + offset_of!(ThreadRepr, status), usize::MAX);
Expand Down
2 changes: 0 additions & 2 deletions src/rt/reference/src/runtime/thread/mgr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -230,11 +230,9 @@ impl ReferenceRuntime {
let base =
unsafe { (repr.start().add(NULLPAGE_SIZE) as *const ThreadRepr).as_ref() }.unwrap();
loop {
tracing::info!("wait here");
let (state, _code) = base
.wait_until(ExecutionState::Exited, timeout)
.ok_or(JoinError::Timeout)?;
tracing::info!("wait here: done");
if state == ExecutionState::Exited {
let mut inner = THREAD_MGR.inner.lock();
inner.prep_cleanup(id);
Expand Down

0 comments on commit eea9f81

Please sign in to comment.