Commit Graph

40 Commits

Author SHA1 Message Date
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
Vincent Ollivier 1ece87b00d Add missing console drain 2021-07-26 23:37:00 +02:00
Vincent Ollivier 5e115ced6c
Fix clippy warnings (#214)
* Fix slow zero-filled vector initialization

* Fix warnings in user command

* Fix clippy error in httpd command

* Fix warnings about using print instead println

* Fix length comparison to zero

* Fix some clippy warnings

* Fix length comparison to zero

* Fix some clippy warnings

* Fix some clippy warnings

* Fix bug introduced by clippy
2021-07-25 12:41:44 +02:00
Vincent Ollivier f1084bfd62
Refactor line editing (#212)
* Rename height and width to rows and cols

* Refactor line editing

* Add partial support of delete key

* Use parser from vte crate to strip csi

* Use parser from vte crate to read input chars

* Add suppor of delete key in serial

* Move keys handling into separate functions

* Add history navigation

* Add autocompletion

* Use Prompt for shell

* Fix shell exiting

* Leave more space for kernel on disk
2021-07-25 01:07:12 +02:00
Vincent Ollivier b7eeb25dc9
Use CSI for key events (#210)
* Use CSI code for key events

* Merge matches
2021-07-21 23:25:53 +02:00
Vincent Ollivier 8af428beab
Add Lisp interpreter (#207)
* Add lisp interpreter

* Refactor lisp code

* Add copyright notice

* Add multiplication

* Shorten type names

* Remove print import

* Add tests

* Add tests for def and fn

* Add print builtin

* Add file eval

* Add fib.ls

* Use define and lambda instead of def and fn

* Rewrite the primitive operators

* Update fibonacci example

* Add syntactic sugar for quote

* Rename console::abort to console::end_of_text

* Add console::end_of_transmission

* Remove auto parenthesis

* Fix parsing quotes

* Refactor quote primitive

* Add empty list comparison to eq primitive

* Add defun primitive

* Rename example

* Fix install path

* Add doc

* Add eq? and atom? aliases
2021-07-21 09:40:40 +02:00
Vincent Ollivier 6826a9701d
Refactor print macros (#208) 2021-07-17 20:58:04 +02:00
Vincent Ollivier 0b06084dec
Add file offset (#206) 2021-07-17 20:48:01 +02:00
Vincent Ollivier 6b8de261ca
Move kernel code to api (#204)
* Move code to api

* Add palette::from_csv

* Refactor palette::from_str with tests

* Add tests to api::font::from_bytes

* Add TODO comments to fs code

* Rename kernel and user dirs to sys and usr

* Add missing files from migration

* Move console::Style to api

* Add more missing changes
2021-07-16 10:19:18 +02:00