1 // Copyright 2025 The Pigweed Authors 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); you may not 4 // use this file except in compliance with the License. You may obtain a copy of 5 // the License at 6 // 7 // https://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 // License for the specific language governing permissions and limitations under 13 // the License. 14 15 use pw_log::info; 16 17 use crate::arch::ArchInterface; 18 use crate::scheduler::{SchedulerState, Stack}; 19 use crate::sync::spinlock::SpinLockGuard; 20 21 mod spinlock; 22 23 pub struct ThreadState {} 24 25 impl super::ThreadState for ThreadState { new() -> Self26 fn new() -> Self { 27 Self {} 28 } 29 context_switch( mut _sched_state: SpinLockGuard<'_, SchedulerState>, _old_thread_state: *mut ThreadState, _new_thread_state: *mut ThreadState, ) -> SpinLockGuard<'_, SchedulerState>30 unsafe fn context_switch( 31 mut _sched_state: SpinLockGuard<'_, SchedulerState>, 32 _old_thread_state: *mut ThreadState, 33 _new_thread_state: *mut ThreadState, 34 ) -> SpinLockGuard<'_, SchedulerState> { 35 panic!("unimplemented"); 36 } initialize_frame(&mut self, _stack: Stack, _initial_function: fn(usize), _arg0: usize)37 fn initialize_frame(&mut self, _stack: Stack, _initial_function: fn(usize), _arg0: usize) { 38 panic!("unimplemented"); 39 } 40 } 41 42 pub struct Arch {} 43 44 impl ArchInterface for Arch { 45 type ThreadState = ThreadState; 46 type BareSpinLock = spinlock::BareSpinLock; 47 early_init()48 fn early_init() { 49 info!("HOST arch early init"); 50 } init()51 fn init() { 52 info!("HOST arch init"); 53 } enable_interrupts()54 fn enable_interrupts() { 55 todo!("unimplemented"); 56 } disable_interrupts()57 fn disable_interrupts() { 58 todo!(""); 59 } interrupts_enabled() -> bool60 fn interrupts_enabled() -> bool { 61 todo!(""); 62 } 63 } 64