Commit Graph

58 Commits

Author SHA1 Message Date
Vincent Ollivier be6ca0c744
Replace some rust programs with lisp scripts (#445)
* Replace colors command with colors.lsp

* Replace geotime command with geotime.lsp

* Remove commands from shell

* Add comment
2022-11-30 23:27:15 +01:00
Vincent Ollivier 3b519377c7
Fix panic on commands containing only spaces (#442)
* Fix panic on commands containing only spaces

* Add trim
2022-11-30 23:26:55 +01:00
Vincent Ollivier 3be0a0c9a5
Add path to prompt (#444)
* Add path to prompt

* Change tilde position in font

* Update moros.png
2022-11-28 23:21:05 +01:00
Vincent Ollivier 23d622176c
Use git describe to display version (#437)
* Use git describe to print version at boot

* Add version command
2022-11-09 09:29:06 +01:00
Vincent Ollivier f7f1bd85f1
Run clippy (#424) 2022-10-28 09:56:04 +02:00
Vincent Ollivier 892b697bd3
Add BigInt support to Lisp (#415)
* Add bigint support to Lisp

* Remove Box

* Replace BigInt by i64

* Add back big int

* Work around big int errors

* Print floats with a dot

* Add conversion to f64

* Use Number#parse instead of double

* Add trigo functions to Number

* Add conversion from number to byte

* Add addition to Number

* Add multiplication to Number

* Add negation and substraction to Number

* Add division to Number

* Add reminder to Number

* Add pow to Number

* Fix tests

* Re-enable BigInt

* Add parsing and printing of BigInt

* Add sign

* Add operations on BigInt

* Fix compilation issues

* Add support for add and mul overflow

* Fix bigint conversion to and from str

* Add number-type function

* Add tests

* Add support for pow overflow

* Fix tests

* Add more checks for overflow

* Add check for division by zero

* Fix typo

* Return inf for large exponential operations

* Check for division by zero in modulo

* Add shift operations

* Rewrite comparisons

* Add lazy eval to cond expressions

* Add set fonction

* Add loop function

* Add pi example

* Add builtin pi example to shell

* Update allocation error messages

* Rewrite number conversions

* Remove debug output from pi example

* Move pi command to a dedicated file

* Rewrite bytes->number and number->bytes

* Update doc

* Move op impl to Number

* Add macros to dry code

* Add more macros

* Run clippy
2022-10-17 20:58:08 +02:00
Vincent Ollivier 5109608ea3
Add Conway's Game of Life (#409)
* Add the Game of Life

* Add seed interval

* Add option to load seed from file

* Add speed option

* Add a status bar at the bottom of the screen

* Refactor rules computation

* Refactor printing

* Add life to autocomplete list

* Fix autocomplete size

* Refactor file loading

* Add centinal.cells

* Add more cells files

* Add ^C to text editor

* Remove -f option

* Remove two patterns

* Remove extra newlines

* Remove code for comments

* Center cells
2022-09-10 10:57:55 +02:00
Vincent Ollivier 1f54cd5e2f
Improve shell (#405)
* Improve whitespace support in shell

* Add glob variable expansion

* Add panic command

* Add USER env var
2022-09-08 09:43:57 +02:00
Vincent Ollivier d5c0002f6d
Update shell redirections (#399)
* Update shell redirections

* Allow file truncation during redirection

* Print time output to stderr
2022-08-28 17:26:38 +02:00
Vincent Ollivier e0596f9f77
Add file append (#387)
* Add file append

* Fix off by one error

* Use append in reopen for shell redirections

* Add documentation

* Update tests
2022-08-14 01:12:52 +02:00
Vincent Ollivier c341aef9be
Fix variables expansion (#370)
* Add status env var

* Add variable_expansion function

* Add special case for status shortcut

* Remove debug

* Add test
2022-07-17 15:39:38 +02:00
Vincent Ollivier 79682d2302
Add tilde expansion to shell (#367)
* Add tilde expansion to shell

* Add tilde expansion to auto complete

* Move tilde expansion into split_args

* Add doc
2022-07-10 22:00:13 +02:00
Vincent Ollivier 2f25c4a1ef
Improve http command (#365)
* Fix host arg

* Add support for binary output

* Send binary data to stdout directly

* Remove header struct

* Refactor states

* Refactor arg match

* Add missing -v option

* Trim protocol from url

* Fix separator when listing root
2022-07-08 09:02:27 +02:00
Vincent Ollivier e4ce2ab59c
Use exit code to set status var (#360)
* Use exit code

* Add macro_use to sys module

* Replace ExitCode with Result<usize, usize>

* Add status var

* Fix status code

* Replace status with ?

* Fix regex for var substitution

* Remove warnings

* Add temporary fix for failing tests

* Add q shortcut to calc

* Use usize for exit code

* Use process exit codes

* Reintroduce ExitCode enum

* Use ExitCode::UsageError where needed

* Display usage error in find command

* Add doc
2022-06-29 19:23:01 +02:00
Vincent Ollivier 82882ec355
Add shell aliases (#357)
* Add shell aliases

* Fix env output error

* Fix sort

* Read aliases from config file

* Simplify arguments parsing

* Fix test

* Clone params to spawn syscall

* Run clippy

* Revert "Clone params to spawn syscall"

This reverts commit 4c91bea196.

* Disable binary stripping

* Remove exit alias

* Update doc
2022-06-26 10:00:54 +02:00
Vincent Ollivier 629e254a51
Improve regex for redirections (#356) 2022-06-17 20:22:28 +02:00
Vincent Ollivier b16f5fc9fd
Store current direction in DIR shell variable (#355) 2022-06-17 20:08:55 +02:00
Vincent Ollivier 783a41981d
Add shell globbing (#352)
* Add naive implementation

* Add support for multiple files in delete command

* Update find usage

* Ignore quoted params

* Add doc

* Change argument name
2022-06-16 21:29:45 +02:00
Vincent Ollivier dd5899a74d
Read command line args from userspace programs (#351)
* Read command line args from userspace programs

* Use Stop syscall to debug pointers from userpace

* Fix address translation system

* Update binaries

* Move print to bin

* Add hardcoded alias system

* Strip debug from binaries

* Build userspace binaries before running tests

* Save all the args in args including the command invocation name

* Move sleep command to /bin

* Rebuild binaries
2022-06-14 22:43:33 +02:00
Vincent Ollivier 6e3f3afcb0
Add binaries (#350)
* Remove linker args

* Add binaries

* Read /bin for autocomplete

* Add /bin path to commands

* Remove api bin

* Remove usr reboot
2022-06-12 15:28:54 +02:00
Vincent Ollivier cd2e0166e6
Executable loading (#349)
* Add header to binary

* Add result to spawn

* Use spawn result to display error message

* Use info result to change directory

* Fix binary detection

* Fix lock issue
2022-06-09 22:59:33 +02:00
Vincent Ollivier 0831045c64
Add shell variables (#348)
* Add env vars to shell

* Add shell env

* Rename shell::run to shell::repl

* Add script pathname to shell env

* Add shell variables

* Add test

* Add doc

* Fix doc
2022-06-08 20:51:02 +02:00
Vincent Ollivier d5512baeea
Add time command (#346)
* Add time command

* Fix merge artefact

* Fix call to realtime
2022-06-05 13:24:40 +02:00
Vincent Ollivier 530658221d
Add socket command (#341)
* Add socket command

* Add test.html page

* Refactory sending code

* Update documentation

* Fix newlines

* Add interval option

* Replace newlines

* Exit on end of transmission

* Add listen mode

* Fix arguments parsing

* Remove debug output
2022-05-21 10:46:16 +02:00
Vincent Ollivier 4d90d2da75
Refactor code (#330)
* Update changelog

* Update rust version

* Make changes suggested by Clippy
2022-04-19 22:42:15 +02:00
Vincent Ollivier 18bfaf93d7
Add a reboot command (#328)
* Add a reboot command

* Add STOP syscall

* Add ctrl-alt-del reboot keys

* Add comment to keyboard shortcut
2022-04-12 09:55:53 +02:00
Vincent Ollivier 41eaae9fbe
Fix issues with process alloc (#327)
* Fix off by one errors

* Simplify phys_addr

* Add offset to frame allocator

* Change code_addr

* Remove unknown commands

* Use allocated frames counter

* Remove debug code
2022-04-11 19:06:16 +02:00
Vincent Ollivier 946ea95ff0
Refactor network commands (#322)
* Change debug color

* Rewrite net command

* Update doc

* Add dhcp --verbose

* Remove ip and route commands

* Align command outputs

* Adjust colors

* Use system dns if available with host command

* Add error macro

* Display network error

* Use error macro

* Fix broken test

* Update dir listing color

* Update syscall doc

* Use error macro in more commands
2022-04-10 09:27:12 +02:00
Vincent Ollivier 478faa7f27
Autocomplete binary path (#324) 2022-04-10 08:39:51 +02:00
Vincent Ollivier 9708796976
Add directory support to userspace (#303)
* Create dirs from userspace

* Add delete syscall

* Add name to FileStat

* Add offset to Dir

* Add dynamic size to dir

* Add FileStat (de)serializer

* Add ReadDir#block_index

* Add FileStat::root

* Implement FileIO#read for Dir

* Add api::fs::read_dir

* Use read_dir for list command

* Allow read /path/to/dir/ commands

* Save dir size to dir entry

* Fix return value of api::fs::create_device

* Read dir from userspace

* Add proc command

* Close file handle when creating dir

* Add /dev/null

* Remove path restriction

* Allow listing of singular file

* Update doc

* Re-export fs struc in API

* Use read_dir in shell autocomplete

* Use fs::delete in httpd

* Rename stat to info

* Update doc

* Rename attributes
2022-01-18 08:44:10 +01:00
Vincent Ollivier 6d9e46408b
Add 2048 game (#295)
* Add 2048 game

* Fix issue with RNG API

* Fix issue with ANSI cursor movements

* Refactor code

* Fix seed

* Rename pow command to 2048
2022-01-01 18:06:22 +01:00
Vincent Ollivier 237d78339f
Improve help (#291)
* Improve help command

* Impove disk --help

* Add find --help

* Add list --help

* Add net --help

* Improve pci --help

* Add beep --help

* Add http --help

* Fix http args parsing

* Add memory --help

* Add keyboard --help
2021-12-23 18:30:59 +01:00
Vincent Ollivier 5cdf2d4db3
Refactor code (#288)
* Remove test command

* Add changes suggested by clippy

* Update crypto crates

* Fix offset in fuse driver

* Fix RNG on old CPUs

* Add disabled logging to fuse driver

* Remove deplicate code with a generator

* Fix scan of invalid path

* Rewrite fuse fs reading
2021-12-22 20:49:17 +01:00
Vincent Ollivier 20a4bd37d0
Improve ATA driver (#286)
* Improve identify data parsing

* Read status from alternate status register

* Update identify command

* Fix overflow in disk size printing

* Rewrite ATA PIO driver according to ATA-4 spec

* Add 'disk erase' command

* Fix issue with shell redirection in diskless mode

* Check for existence of passwords file during login

* Add IdentifyResponse enum

* Refactor lba match

* Disable debug output on command aborted

* Refactor code

* Pin specific compiler version

* Add spec in comment
2021-12-19 10:03:09 +01:00
Vincent Ollivier 009786b140
Add pci command and switch IDE controllers to compatible mode (#276)
* Add waiting times to identify command

* Read more attributes from PCI devices

* Add pci::list

* Add pci command

* Switch PCI IDE controllers to compatibility mode

* Add comment

* Update changelog
2021-11-28 19:43:40 +01:00
Vincent Ollivier e75c287098
Add process table and exit syscall (#268)
* Add process table

* Add exit syscall

* Update binaries

* Make pid mutable

* Use RW lock for the process table

* Change pid atomic ordering

* Fix return code

* Fix lock issue

* Add debug print

* Add exit to sleep binary

* Enable asm_sym feature

* Use the end of code area for stack area

* Add debug macro

* Use array instead of vec for process

* Refactor process data clone

* Increase max file handles to 32

* Increase sleep to 5 seconds

* Fix MAX_PID calculation

* Revert max file handle value to fix crash

* Close file handle after dup syscall

* Remove init

* Run the test in release mode

* Refactor debug

* Refactor debug output of syscall

* Remove NULL syscall

* Save and restore stack frame

* Fix install

* Save only scratch registers to the stack

* Add write volatile to registers

* Overwrite rax register on exit

* Set pid back to 0 after exit

* Add alloc_page function

* Remove debug output

* Unmap pages after exit

* Allocate memory after kernel heap

* Hide unmap error
2021-11-27 09:56:52 +01:00
Vincent Ollivier d053f17124
Add shell redirections (#262)
* Reorder syscalls

* Add DUP syscall

* Add api::fs::reopen

* Add shell redirections

* Use regex to parse arrow

* Add tests

* Refactor install

* Add eprint macro

* Change exit code of empty command in shell

* Update changelog
2021-11-05 09:06:40 +01:00
Vincent Ollivier 8457c0fc53
Add calc command (#263)
* Add calc command

* Parse float

* Refactor parser

* Add tests

* Refactor parser

* Update changelog
2021-11-01 11:13:52 +01:00
Vincent Ollivier 79860fb6de
Add spawn syscall (#251)
* Add spawn syscall

* Update changelog

* Fix changelog format typo
2021-09-29 22:40:37 +02:00
Vincent Ollivier c67ca13b51
Add ELF loader (#248)
* Add ELF loader

* Add elf reader

* Fix jump to entry point

* Update mapping code

* Update kernel data segment in GDT

* Refactor wrap macro

* Remove debug from process

* Remove jump to entry point

* Update hello binary

* Improve comments on asm code

* Rename Process#entry to Process#entry_point

* Use cli directly

* Add pic::init()

* Disable again interrupts after halt if needed

* Allow keyboard and serial events during memory init

* Update changelog
2021-09-26 22:50:45 +02:00
Vincent Ollivier 07ff76991a
Add basic userspace (#228)
* Testing userspace code

* Update program example

* Refactor code

* Read bin from dsk/bin at compile time

* Create mapper and frame allocator during process creation

* Read bin from disk at runtime

* Add missing file

* Add missing bin

* Add src bin

* Replace debug output by a test syscall+binary

* Remove comments from asm files

* Rewrite sleep

* Replace test by hello

* Refactor hello example

* Translate address from user code segment

* Rename entry label

* Update readme and changelog

* Use entry_name for DirEntry

* Increase stack size
2021-09-24 18:19:37 +02:00
Vincent Ollivier 43ac7cdc8c
Add file syscalls (#242)
* Add file syscalls

* Change syscalls return type

* Add stat syscall

* Add file creation

* Use api::fs::read_to_string in more user programs

* Use syscalls in fs api

* Move some functions from sys::fs to api::fs

* Add FileIO for generic read and write

* Write to stdout

* Add stdout test

* Disable output

* Move FileIO to API

* Add io::stdin and io::stdout to API

* Add a real /dev/random

* Fix test

* Add missing device file

* Refactor stdin read

* Truncate read_line result if larger than buf

* Use fs::read and fs::write to copy files

* Use fs::read for user password database

* Use fs::read for vga command

* Use api::syscall::stat instead of sys::fs::File::open

* Use fs::read and fs::write in httpd

* Add RNG to API

* Add fs::open_dir and fs::create_dir

* Add fs::exists
2021-09-15 22:27:32 +02:00
Vincent Ollivier e55ff2446e
Add beep command (#234)
* Add beep command

* Add pc speaker to qemu

* Add source to beep musics

* Use beep -l instead of beep -t

* Reuse PIT manipulation from time module
2021-08-21 10:57:39 +02:00
Vincent Ollivier f10c3db1ac
Improve baremetal experience (#232)
* Fix rtc bug during update

* Fix panic in hex command

* Add erroneous commands to shell history

* Fix hex command
2021-08-21 10:55:02 +02:00
Vincent Ollivier e5a7b63bc2
Add chess game (#230)
* Add chess game

* Add missing file

* Add moves parsing

* Add autocompletion

* Add perft command to chess

* Update Cargo.lock

* Add undo and time commands

* Improve output of commands

* Add endgame support

* Split main into multiple methods of a Chess struct

* Update littlewing

* Use chess prelude

* Add show board command

* Add help

* Update docs

* Fix url syntax in doc

* Add commands to doc index

* Update doc/index.md

* Fix typos
2021-08-12 23:15:28 +02:00
Vincent Ollivier d706e973aa
Refactor filesystem (#225)
* Split fs file into multiple files

* Use DirEntry#into

* Reorganize dir entry creation prior to refactoring

* Refactor Block

* Refactor bits manipulation in Dir#create_entry

* Refactor ReadDir

* Truncate filename to 255 chars at most

* Refactor Dir#update_entry

* Refactor new block alloc

* Allow different kinds of block devices

* Display disk usage

* Add fs::read to API

* Add command to mount fs in memory

* Add tests
2021-08-07 11:29:45 +02:00
Vincent Ollivier 8f103f6b0b
Add keyboard layout change at runtime (#226)
* Change keyboard layout at runtime

* Add keyboard command

* Add env var to makefile

* Add azerty layout

* Fix tests

* Fix CI
2021-08-04 22:07:26 +02:00
Vincent Ollivier 40a97aa12a Update Prompt#input when receiving ^C
When `Prompt#input` received a `^C` or `^D` it would return `None`.
It is used in a `while let` loop so in the shell and the lisp
interpreter it translated to exiting. This is good for `^D` but `^C`
should just cancel the current line.

So now in the latter case it returns `Some(String::new())` instead and
let the application deal with the empty string, which is fine for the
shell and the lisp interpreter.
2021-08-02 04:50:41 +02:00
Vincent Ollivier de48c87e0c
Add a regular expression engine (#222)
* Add a regular expression engine

* Fix off by one error

* Add + quantifier

* Add more tests

* Use assert_eq instead of assert in tests

* Rewrite tests with an array

* Fix bug in is_match_star

* Use the same do while equivalent in is_match_plus

* Add ? quantifier

* Refactor engine code

* Add backslash char

* Group ifs in match

* Add special escaped chars

* Add doc

* Add find command

* Add Match#find

* Show multiple matches in the same line

* Dry Regex

* Change matches color

* Add greedy version of matching by default

* Add MetaChar enum to fix matching escaped chars

* Change function signatures

* Remove macro_export

* Add TODO

* Find matching lines recursively

* Handle special patterns
2021-08-01 11:35:24 +02:00
Vincent Ollivier 72f9baae6c
Refactor editor (#221)
* Replace sys::vga::clear_screen() by csi code

* Replace all remaining calls of vga functions by csi code

* Remove dead code

* Add some guard clauses

* Add TODO on partially implemented CSI codes

* Fix inverted params on cursor position

* Print newline char between lines

* Add a TODO to load a palette via ANSI OSC commands

* Move cursor after clear screen

* Simplify line insert

* Fix old bug when scrolling twice the screen width

* Simplify backspace code

* Disable interrupts when printing in serial

* Refactor status line

* Hide cursor during printing

* Avoid printing status line over saving status

* Use 1-indexed rows and cols in the user interface
2021-07-29 22:28:57 +02:00