Commit Graph

18 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 b2da75189f
Improve Lisp (#344)
* Add println

* Rewrite fib

* Refactor parse

* Update lisp completer

* Store args in env

* Add 'or' and 'and' builtins

* Add factorial.lsp

* Update docs

* Add cat operation

* Add join operation

* Add system command

* Add time command (#346)

* Add time command

* Fix merge artefact

* Fix call to realtime

* Replace clock syscalls with device files (#345)

* Replace clock syscalls with device files

* Add missing newline to read

* Update time command

* Use Rc<RefCell<Env>>

* Add first TCO

* Remove Box

* Change result of env_for_lambda

* Run clippy

* Remove env clone

* Remove TCO

* Change return type of env_for_lambda
2022-06-06 16:02:34 +02:00
Vincent Ollivier 28759df00c
Replace clock syscalls with device files (#345)
* Replace clock syscalls with device files

* Add missing newline to read

* Update time command
2022-06-05 13:58:05 +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 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 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 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 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 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 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 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 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