forked from AbleOS/ableos
syscall
This commit is contained in:
parent
df86c272f3
commit
5a1a84b1c7
|
@ -41,7 +41,6 @@ pub fn kernel_main() -> ! {
|
||||||
init::init();
|
init::init();
|
||||||
log::set_max_level(BOOT_CONF.log_level());
|
log::set_max_level(BOOT_CONF.log_level());
|
||||||
|
|
||||||
{
|
|
||||||
{
|
{
|
||||||
let mut scheduler = SCHEDULER.lock();
|
let mut scheduler = SCHEDULER.lock();
|
||||||
|
|
||||||
|
@ -60,7 +59,7 @@ pub fn kernel_main() -> ! {
|
||||||
|
|
||||||
use crate::proto_filetable::file::FileLocations;
|
use crate::proto_filetable::file::FileLocations;
|
||||||
|
|
||||||
{
|
if false {
|
||||||
let mut sock_print_id = SimpleSock::new();
|
let mut sock_print_id = SimpleSock::new();
|
||||||
sock_print_id.register_protocol("Screen Printer".to_string());
|
sock_print_id.register_protocol("Screen Printer".to_string());
|
||||||
sock_print_id.write(format!("🐑").into());
|
sock_print_id.write(format!("🐑").into());
|
||||||
|
@ -73,12 +72,13 @@ pub fn kernel_main() -> ! {
|
||||||
}
|
}
|
||||||
mode.copy_to_buffer();
|
mode.copy_to_buffer();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if false {
|
if false {
|
||||||
// Currently not implemented
|
// Currently not implemented
|
||||||
let acpi_handler = ACPI_struct {};
|
let acpi_handler = AcpiStruct {};
|
||||||
|
let mut table;
|
||||||
unsafe {
|
unsafe {
|
||||||
let table = AcpiTables::search_for_rsdp_bios(acpi_handler);
|
table = AcpiTables::search_for_rsdp_bios(acpi_handler);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -95,6 +95,7 @@ pub fn tick() {
|
||||||
crate::kernel_state::KERNEL_STATE.lock().update_state();
|
crate::kernel_state::KERNEL_STATE.lock().update_state();
|
||||||
// let mut scheduler = SCHEDULER.lock();
|
// let mut scheduler = SCHEDULER.lock();
|
||||||
// scheduler.bump_exec();
|
// scheduler.bump_exec();
|
||||||
|
// drop(scheduler);
|
||||||
|
|
||||||
TICK.store(data, Relaxed)
|
TICK.store(data, Relaxed)
|
||||||
}
|
}
|
||||||
|
@ -124,9 +125,9 @@ pub fn generate_process_pass() -> u128 {
|
||||||
|
|
||||||
// TODO: move to a better place
|
// TODO: move to a better place
|
||||||
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||||
pub struct ACPI_struct {}
|
pub struct AcpiStruct {}
|
||||||
|
|
||||||
impl acpi::AcpiHandler for ACPI_struct {
|
impl acpi::AcpiHandler for AcpiStruct {
|
||||||
unsafe fn map_physical_region<T>(
|
unsafe fn map_physical_region<T>(
|
||||||
&self,
|
&self,
|
||||||
physical_address: usize,
|
physical_address: usize,
|
||||||
|
|
|
@ -18,13 +18,16 @@ pub extern "C" fn remove_directory(path: Path, force_delete: bool) {
|
||||||
/// # Arguments
|
/// # Arguments
|
||||||
/// * `full_path` - The full path of the directory to create
|
/// * `full_path` - The full path of the directory to create
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn create_directory(path: Path) -> Result<(), FileErrors> {
|
pub extern "C" fn create_directory(path: Path) -> FSReturns {
|
||||||
unimplemented!();
|
unimplemented!();
|
||||||
}
|
}
|
||||||
|
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
/// Errors that can occur when messing with files
|
/// A return used by the file related system calls
|
||||||
pub enum FileErrors {
|
pub enum FSReturns {
|
||||||
|
/// The system call was successful
|
||||||
|
Ok,
|
||||||
|
|
||||||
/// The directory can not be created
|
/// The directory can not be created
|
||||||
DirectoryCouldNotBeCreated,
|
DirectoryCouldNotBeCreated,
|
||||||
/// The directory could not be removed
|
/// The directory could not be removed
|
||||||
|
|
29
lib_syscalls/C/file_calls.c
Normal file
29
lib_syscalls/C/file_calls.c
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
enum FSReturns {
|
||||||
|
/// The system call was successful
|
||||||
|
Ok,
|
||||||
|
/// The directory can not be created
|
||||||
|
DirectoryCouldNotBeCreated,
|
||||||
|
/// The directory could not be removed
|
||||||
|
DirectoryCouldNotBeRemoved,
|
||||||
|
///
|
||||||
|
FileCouldNotBeCreated,
|
||||||
|
///
|
||||||
|
FileCouldNotBeRemoved,
|
||||||
|
/// The file could not be opened
|
||||||
|
FileCouldNotBeOpened,
|
||||||
|
///
|
||||||
|
FileCouldNotBeClosed,
|
||||||
|
};
|
||||||
|
|
||||||
|
int create_directory(path) {
|
||||||
|
return DirectoryCouldNotBeCreated;
|
||||||
|
}
|
||||||
|
///
|
||||||
|
int remove_directory(path) {
|
||||||
|
return DirectoryCouldNotBeRemoved;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
1
lib_syscalls/README.md
Normal file
1
lib_syscalls/README.md
Normal file
|
@ -0,0 +1 @@
|
||||||
|
# The libraries here are simplified examples of syscall APi
|
Loading…
Reference in a new issue