This commit is contained in:
Able 2022-02-07 06:38:18 -06:00
parent df86c272f3
commit 5a1a84b1c7
4 changed files with 70 additions and 36 deletions

View file

@ -42,43 +42,43 @@ pub fn kernel_main() -> ! {
log::set_max_level(BOOT_CONF.log_level());
{
{
let mut scheduler = SCHEDULER.lock();
let mut scheduler = SCHEDULER.lock();
use crate::scheduler::Priority::*;
let mut process_1 = scheduler.new_process(High);
process_1.capabilities.files = FileAccess::Some(vec![PathRep {
location: FileLocations::Home,
file_name: "test".to_string(),
}]);
scheduler.add_process(process_1);
for ref_process in &scheduler.list {
trace!("{:?}", ref_process);
}
drop(scheduler);
}
use crate::proto_filetable::file::FileLocations;
{
let mut sock_print_id = SimpleSock::new();
sock_print_id.register_protocol("Screen Printer".to_string());
sock_print_id.write(format!("🐑").into());
let mut mode = SCREEN_BUFFER.lock();
mode.force_redraw();
for current in (*String::from_utf8_lossy(&sock_print_id.peek().unwrap())).chars() {
mode.draw_char(0, 0, current, from_vga_16(Color16::Red));
}
mode.copy_to_buffer();
use crate::scheduler::Priority::*;
let mut process_1 = scheduler.new_process(High);
process_1.capabilities.files = FileAccess::Some(vec![PathRep {
location: FileLocations::Home,
file_name: "test".to_string(),
}]);
scheduler.add_process(process_1);
for ref_process in &scheduler.list {
trace!("{:?}", ref_process);
}
drop(scheduler);
}
use crate::proto_filetable::file::FileLocations;
if false {
let mut sock_print_id = SimpleSock::new();
sock_print_id.register_protocol("Screen Printer".to_string());
sock_print_id.write(format!("🐑").into());
let mut mode = SCREEN_BUFFER.lock();
mode.force_redraw();
for current in (*String::from_utf8_lossy(&sock_print_id.peek().unwrap())).chars() {
mode.draw_char(0, 0, current, from_vga_16(Color16::Red));
}
mode.copy_to_buffer();
}
if false {
// Currently not implemented
let acpi_handler = ACPI_struct {};
let acpi_handler = AcpiStruct {};
let mut table;
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();
// let mut scheduler = SCHEDULER.lock();
// scheduler.bump_exec();
// drop(scheduler);
TICK.store(data, Relaxed)
}
@ -124,9 +125,9 @@ pub fn generate_process_pass() -> u128 {
// TODO: move to a better place
#[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>(
&self,
physical_address: usize,

View file

@ -18,13 +18,16 @@ pub extern "C" fn remove_directory(path: Path, force_delete: bool) {
/// # Arguments
/// * `full_path` - The full path of the directory to create
#[no_mangle]
pub extern "C" fn create_directory(path: Path) -> Result<(), FileErrors> {
pub extern "C" fn create_directory(path: Path) -> FSReturns {
unimplemented!();
}
#[repr(C)]
/// Errors that can occur when messing with files
pub enum FileErrors {
/// A return used by the file related system calls
pub enum FSReturns {
/// The system call was successful
Ok,
/// The directory can not be created
DirectoryCouldNotBeCreated,
/// The directory could not be removed

View 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
View file

@ -0,0 +1 @@
# The libraries here are simplified examples of syscall APi