This commit is contained in:
parent
52c31ccc61
commit
e3ef4823b3
3 changed files with 18 additions and 9 deletions
|
@ -6,4 +6,5 @@ members = ["lib/acpica-rs", "lib/kernel-common", "loader", "kernel", "init"]
|
|||
lto = true
|
||||
|
||||
[profile.dev]
|
||||
opt-level = 3
|
||||
panic = "abort"
|
||||
|
|
|
@ -8,6 +8,7 @@ use core::{
|
|||
use acpica_rs::{ACPI_IO_ADDRESS, ACPI_OSD_HANDLER, ACPI_PHYSICAL_ADDRESS, ACPI_PREDEFINED_NAMES, ACPI_SIZE, ACPI_STATUS, ACPI_STRING, ACPI_TABLE_HEADER, UINT16, UINT32, UINT64, UINT8};
|
||||
use alloc::{boxed::Box, sync::Arc};
|
||||
use kernel_common::{
|
||||
instructions::pause,
|
||||
ioports::{inb, inl, inw, outb, outl, outw},
|
||||
log::log_raw,
|
||||
};
|
||||
|
@ -60,12 +61,17 @@ extern "C" fn AcpiOsCreateSemaphore(max: UINT32, initial: UINT32, out: *mut *mut
|
|||
AE_OK
|
||||
}
|
||||
#[no_mangle]
|
||||
extern "C" fn AcpiOsDeleteLock() {
|
||||
unimplemented!();
|
||||
extern "C" fn AcpiOsDeleteLock(handle: *mut c_void) {
|
||||
unsafe {
|
||||
drop(Box::from_raw(handle));
|
||||
}
|
||||
}
|
||||
#[no_mangle]
|
||||
extern "C" fn AcpiOsDeleteSemaphore() {
|
||||
unimplemented!();
|
||||
extern "C" fn AcpiOsDeleteSemaphore(handle: *mut c_void) -> ACPI_STATUS {
|
||||
unsafe {
|
||||
Arc::from_raw(handle as *const RawSemaphore);
|
||||
}
|
||||
AE_OK
|
||||
}
|
||||
#[no_mangle]
|
||||
extern "C" fn AcpiOsEnterSleep(_sleep_state: UINT8, _reg_a_val: UINT32, _reg_b_val: UINT32) -> ACPI_STATUS {
|
||||
|
@ -166,16 +172,19 @@ extern "C" fn AcpiOsReleaseLock(handle: *mut c_void, _cpu_flags: ACPI_SIZE) {
|
|||
spinlock.raw_unlock();
|
||||
}
|
||||
#[no_mangle]
|
||||
extern "C" fn AcpiOsStall() {
|
||||
unimplemented!();
|
||||
extern "C" fn AcpiOsStall(us: UINT32) {
|
||||
let end_time = get_current_time() + us as usize;
|
||||
while get_current_time() < end_time {
|
||||
pause();
|
||||
}
|
||||
}
|
||||
#[no_mangle]
|
||||
extern "C" fn AcpiOsRemoveInterruptHandler() {
|
||||
unimplemented!();
|
||||
}
|
||||
#[no_mangle]
|
||||
extern "C" fn AcpiOsSignal() {
|
||||
unimplemented!();
|
||||
extern "C" fn AcpiOsSignal(_func: UINT32, _info: *mut c_void) -> ACPI_STATUS {
|
||||
panic!("Received ACPI signal");
|
||||
}
|
||||
#[no_mangle]
|
||||
extern "C" fn AcpiOsSignalSemaphore(handle: *mut c_void, units: UINT32) -> ACPI_STATUS {
|
||||
|
|
|
@ -69,7 +69,6 @@ impl RawSpinlock {
|
|||
let early_lock = self.early_lock.swap(false, Ordering::SeqCst);
|
||||
if interrupts_setup && !early_lock {
|
||||
lapic_id = self.lapic_id.load(Ordering::SeqCst);
|
||||
debug_assert_eq!(lapic_id, get_current_lapic_id());
|
||||
}
|
||||
self.locked.store(false, Ordering::SeqCst);
|
||||
if interrupts_setup && !early_lock {
|
||||
|
|
Loading…
Add table
Reference in a new issue