usermode
ondra05 2022-12-08 20:52:20 +01:00
parent 61e59e45f0
commit 646643838b
16 changed files with 0 additions and 289 deletions

View File

@ -1,12 +0,0 @@
file {
val=
name: "Hi"
extension: "txt"
size: 123
fn|
open: (None)->()
read: (Num)->(String)
write: (Num, String)->(Bool)
close: (None)->(Bool)
}

View File

@ -1,12 +0,0 @@
[package]
name = "asl"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
[dependencies.logos]
version = "0.12.1"
default-features = false

View File

@ -1,10 +0,0 @@
DefinitionBlock ("test.aml", "DSDT", 1, "OEMID ", "TABLEID ", 0x00000000)
{
Scope (_SB)
{
Device (PCI0)
{
Name (_HID, EisaId ("PNP0A03"))
}
}
}

View File

@ -1,35 +0,0 @@
use logos::{Lexer, Logos};
#[derive(Logos, Debug, Clone, Copy, PartialEq)]
enum Token {
#[regex(r"[ \t\n\f]+", logos::skip)]
#[error]
Error,
#[regex("[1-9]+", num_parser)]
Num(isize),
}
fn num_parser(lex: &mut Lexer<Token>) -> isize {
let slice = lex.slice();
let num_str: String = slice.into();
let num = num_str.parse::<isize>();
num.unwrap()
}
#[test]
pub fn num_test() {
let mut lex = Token::lexer("5 42 75");
assert_eq!(lex.next(), Some(Token::Num(5)));
assert_eq!(lex.next(), Some(Token::Num(42)));
assert_eq!(lex.next(), Some(Token::Num(75)));
}
#[test]
pub fn asl_simple_test() {
let lex = Token::lexer(include_str!("../assets/asl/asl_simple.asl"));
for token in lex {
// println!("{:?}", token);
assert_ne!(Token::Error, token);
}
}

View File

@ -1,9 +0,0 @@
[package]
name = "facepalm"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
log = "0.4.0"

View File

@ -1 +0,0 @@
Facepalm is the general purpose debugger bundled with ableOS

View File

@ -1,19 +0,0 @@
#![no_std]
use log::*;
pub const VERSION: &str = env!("CARGO_PKG_VERSION");
#[cfg(debug_assertions)]
pub const RELEASE_TYPE: &str = "debug";
#[cfg(not(debug_assertions))]
pub const RELEASE_TYPE: &str = "release";
pub fn start_facepalm() {
info!("facepalm 🤦 launched!");
info!("facepalm 🤦 version: {}", VERSION);
info!("facepalm 🤦 {} mode", RELEASE_TYPE);
// Drop into a debug shell
}

View File

@ -1,2 +0,0 @@
# ableOS userland

View File

@ -1,77 +0,0 @@
// Utterly stolen from stack overflow
/*
* Standalone BogoMips program
*
* Based on code Linux kernel code in init/main.c and
* include/linux/delay.h
*
* For more information on interpreting the results, see the BogoMIPS
* Mini-HOWTO document.
*
* version: 1.3
* author: Jeff Tranter (Jeff_Tranter@Mitel.COM)
*/
#include <stdio.h>
#include <time.h>
#ifdef CLASSIC_BOGOMIPS
/* the original code from the Linux kernel */
static __inline__ void delay(int loops)
{
__asm__(".align 2,0x90\n1:\tdecl %0\n\tjns 1b": :"a" (loops):"ax");
}
#endif
#ifdef QNX_BOGOMIPS
/* version for QNX C compiler */
void delay(int loops);
#pragma aux delay = \
"l1:" \
"dec eax" \
"jns l1" \
parm nomemory [eax] modify exact nomemory [eax];
#endif
#ifdef PORTABLE_BOGOMIPS
/* portable version */
static void delay(int loops)
{
long i;
for (i = loops; i >= 0 ; i--)
;
}
#endif
int
main(void)
{
unsigned long loops_per_sec = 1;
unsigned long ticks;
printf("Calibrating delay loop.. ");
fflush(stdout);
while ((loops_per_sec <<= 1)) {
ticks = clock();
delay(loops_per_sec);
ticks = clock() - ticks;
if (ticks >= CLOCKS_PER_SEC) {
loops_per_sec = (loops_per_sec / ticks) * CLOCKS_PER_SEC;
printf("ok - %lu.%02lu BogoMips\n",
loops_per_sec/500000,
(loops_per_sec/5000) % 100
);
return 0;
}
}
printf("failed\n");
return -1;
}

View File

@ -1,30 +0,0 @@
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;
}

View File

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

View File

@ -1,7 +0,0 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
[[package]]
name = "rname"
version = "0.1.0"

View File

@ -1,8 +0,0 @@
[package]
name = "rname"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]

View File

@ -1,44 +0,0 @@
//! An implementation of the uname command.
use crate::Arch::*;
use core::fmt;
// an example string "Darwin Roadrunner.local 10.3.0 Darwin Kernel Version 10.3.0: Fri Feb 26 11:58:09 PST 2010; root:xnu-1504.3.12~1/RELEASE_I386 i386"
pub struct RName {
pub arch: Arch,
}
#[derive(Debug, Clone, Copy)]
pub enum Arch {
X86,
X86_64,
ARM,
ARM64,
PPC,
PPC64,
MIPS,
MIPS64,
SPARC,
SPARC64,
Unknown,
}
impl fmt::Display for Arch {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{:?}", self)
}
}
fn main() {
let mut rname_string = "".to_string();
rname_string.push_str("ableOS");
let arch = Some(X86_64);
if let Some(arch) = arch {
let fmt_str = format!(" {:?}", arch);
rname_string.push_str(&fmt_str);
}
println!("{}", rname_string);
}

Binary file not shown.

View File

@ -1,22 +0,0 @@
#![no_std]
extern crate alloc;
use {
alloc::{string::String, vec::Vec},
serde::Deserialize,
};
#[derive(Debug, Deserialize)]
pub struct Version {
pub major: u16,
pub minor: u8,
pub patch: u8,
}
#[derive(Debug, Deserialize)]
pub struct Metadata {
pub name: String,
pub version: Version,
pub authors: Vec<String>,
}