Commit Graph

195 Commits

Author SHA1 Message Date
Vincent Ollivier 512b60564b
Fix device reading (#329)
* Avoid panic when reading device files

* Skip devices in find

* Fix root path in find
2022-04-15 13:00:33 +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 dd2b20f800
Handle backtab key for backward autocompletion (#321)
* Handle backtab key

* Handle backtab in editor
2022-04-09 09:24:05 +02:00
Vincent Ollivier 042367eb80 Update copyright year 2022-04-05 15:02:39 +02:00
Vincent Ollivier 3bef35b707
Upgrade smoltcp (#293)
* Upgrade smoltcp

* Fix issues

* Add back net monitor

* Update doc

* Fix net command help
2022-04-05 13:03:55 +02:00
Vincent Ollivier e785942792
Update rust toolchain (#320)
* Update rust-toolchain file

* Remove stable features

* Update bootloader crate

* Remove toolchain from GitHub Actions

* Avoid running installer interactively

* Remove rustup component add commands
2022-04-05 12:03:31 +02:00
Vincent Ollivier f044066f77
Fix various issues while reading files (#307)
* Define device file buffer in kernel

* Implement from u8 for Device

* Reading /dev/null result in error

* Reading an empty dir should not result in error

* Print all bytes from reading devices

* Print errors while reading devices

* Handle ^C and ^D when reading /dev/console

* Create pseudo device files for clocks

* Avoid hardcoding ^C and ^D

* Add missing comment
2022-01-25 21:42:21 +01:00
Vincent Ollivier d06f641731
Add Box to process data (#306)
* Add Box to file handle array

* Add Box to process table

* Update comment
2022-01-24 20:35:00 +01:00
Vincent Ollivier 5243c08f59 Fix dir creation during install 2022-01-22 21:31:06 +01: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 e2ff0ac6c4
Improve file reading (#296)
* Move path canonicalization from API to kernel

* Add api::fs::read_exact

* Add read-bytes to lisp

* Add str function to lisp

* Rename fs::read to fs::read_to_bytes

* Rename fs::read_exact to fs::read

* Add bytes fonction to lisp

* Add progn special form to lisp

* Fix failing test
2022-01-05 19:47:28 +01:00
Vincent Ollivier e96f250c55
Display RTC during boot (#298) 2022-01-04 10:06:58 +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 1959b31f62
Improve documentation (#294)
* Add calc doc

* Link doc from readme

* Rename stdnil to stdnull

* Add items to the TODO list in the README

* Update instructions in the README

* Improve feature list in README

* Add link to doc in README

* Disable unused show command

* Add colors to chess perf command
2021-12-29 22:56:08 +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 acc4459f64
Add time module to API (#284)
* Add time module to API

* Remove rej files
2021-12-12 11:58:02 +01:00
Vincent Ollivier 313f90ee73
Extend lisp language (#278)
* Add map builtin

* Rename ensure_length macro

* Update documentation

* Update map function

* Rename map to mapcar

* Add modulo to calculator

* Add division, modulo, and exponential to lisp

* Add type to built in functions

* Add string comparisons

* Update atom function

* Add basic load function

* Update load to parse multiple expressions

* Escape quote in string display

* Move print definition

* Rename read-file to read

* Simplify mapcar implementation

* Update tests

* Add comment and test

* Add standard library

* Add lib to install

* Refactor eval

* Refactor eq

* Refactor eval with ensure macros

* Add more tests

* Redefine primitives

* Move primitives to /ini/lisp/core.lsp

* Update install file

* Refactor eval

* Create /ini/lisp
2021-12-12 11:43:57 +01:00
Vincent Ollivier 6f81dcedb6 Fix DNS address 2021-12-06 23:48:04 +01:00
Vincent Ollivier 749b111d68
Rewrite Lisp parser with Nom (#277)
* Rewrite Lisp parser

* Parse special symbols

* Add eval for calculator

* Replace original parser with the new one

* Handle escaped chars in strings

* Add more special characters to parser

* Refactor eval

* Add operations on files

* Refactor more of eval

* Add number parsing

* Refactor eval

* Improve error messages

* Use .lsp for lisp files

* Refactor eval

* Add ensure_len macro
2021-12-04 13:39:14 +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 0f70d67c91
Improve user experience (#274)
* Add default-run attribute

* Use f64 instead of f32 in calc

* Allow empty line in REPL

* Check that FS is mounted before reading superblock

* Add cmd env var

* Update changelog
2021-11-27 10:08:08 +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 35f03ee644
Fix editor cursor after status change (#272) 2021-11-14 09:33:52 +01:00
Vincent Ollivier c30e5a9ed6
Fix autocomplete bug (#271)
* Cleanup code

* Fix autocomplete bug

* Use extend instead of append
2021-11-14 09:27:44 +01:00
Vincent Ollivier 8e828bb619
Enable asm_sym feature (#269) 2021-11-12 10:05:53 +01:00
Vincent Ollivier 0093e8f8a2
Improve UTF-8 support (#267)
* Add support for Extended ASCII to VGA

* Read multibyte chars

* Fix deletion of extended ascii chars

* Add UTF-8 support to Prompt

* Refactor vec char

* Add unicode support to text editor

* Refactor code

* Update changelog
2021-11-06 10:31:14 +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 71303cd455
Fix VGA issues with real hardware (#258)
* Enable cursor after boot

* Remove unused time attribute on file

* Fix compilation warning

* Clear screen after vga init

* Add disable_blinking function

* Set palette registers at boot

* Set default palette

* Fix attribute control registers initialization

* Clear palette address source bit when setting palette

* Refactor code

* Remove index from palette

* Update comment

* Update changelog
2021-10-24 18:23:01 +02:00
Vincent Ollivier d541ed949a
Add rust binaries support (#255)
* Parse elf segments instead of sections

* Add hello binary

* Build only kernel in makefile

* Add rust and nasm userspace examples

* Create empty files prior to compilation

* Change segment locations

* Simplify binaries

* Update binaries

* Update changelog

* Fix stack overflow
2021-10-14 09:49:30 +02:00
Vincent Ollivier 71d83cd688
Add dynamical disk information (#252)
* Add sys::ata::Drive struct

* Add fs size to superblock

* Add missing usage option to disk command

* Update changelog

* Store ata::Drive in AtaBlockDevice

* Store allocated block count in superblock

* Rename Superblock to SuperBlock

* Add superblock to memfs

* Use Block instead of LinkedBlock for BlockBitmap

* Rename BlockBitmap to BitmapBlock

* Fix removed const

* Remove some hardcoded constants

* Fix BitmapBlock::free_all

* Allocate the whole remaining disk space

* Use memory size to alloc memfs

* Dynamically use half of the memory for the heap

* Add SuperBlock::check_ata

* Move init to mod.rs

* Update python fuse

* Add BITMAP_SIZE constant

* Fix available space computation

* Limit the heap to 8 GB max

* Fix memfs size
2021-10-04 21:37:47 +02:00
Vincent Ollivier 1b4075bb3b
Enabe array_map feature (#254) 2021-10-02 22:01:38 +02:00
Konrad Borowski 07075dc6b3
Remove array-macro dependency (#253) 2021-10-02 19:26:29 +02: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