1
0
mirror of https://github.com/sgmarz/osblog.git synced 2024-11-24 02:16:19 +04:00
Commit Graph

368 Commits

Author SHA1 Message Date
Stephen Marz
c74316adb5 Added ELF loader in elf.rs 2020-05-15 11:46:51 -04:00
Stephen Marz
bb4f3bc0a6 Move BlockBuffer to buffer.rs and renamed to Buffer. 2020-05-15 11:46:42 -04:00
Stephen Marz
f781c511f4 Let Rust figure out the data type String 2020-05-15 11:12:07 -04:00
Stephen Marz
9d6ee9fb35 Added comments and shrunk string 2020-05-15 11:11:20 -04:00
Stephen Marz
69c7e6c390 Reformatted 2020-05-15 11:00:51 -04:00
Stephen Marz
e1b2150f1b Reduce stack size to 5 pages 2020-05-15 10:54:02 -04:00
Stephen Marz
f8fad1804f Updated file string to avoid creating strings twice in test. 2020-05-15 10:40:37 -04:00
Stephen Marz
5b5e5d9e2b Fix warnings 2020-05-15 10:37:40 -04:00
Stephen Marz
6367e064cf Reworked file system, still much to do, however, now we can get a file by its name instead of inode number. 2020-05-15 10:34:37 -04:00
Stephen Marz
ea33bfe629 Added starting point for GPU code. 2020-05-15 10:34:22 -04:00
Stephen Marz
723963e1ec Resolved 2020-05-01 19:11:42 -04:00
Stephen Marz
21f16b4754 Resolved 2020-05-01 19:10:56 -04:00
Stephen Marz
6cd64c84bf Do not spin lock in an interrupt context, and also add feedback to the caller. 2020-05-01 19:02:58 -04:00
Stephen Marz
fe5a909335 Create a system call to add a process to prevent data race with the process list. 2020-05-01 18:59:38 -04:00
Stephen Marz
30fcd7894a Change lock to try_lock to better align with Rust's verbiage 2020-04-27 09:46:59 -04:00
Stephen Marz
d49ea6e040 Changed formatting settings. 2020-04-26 22:12:00 -04:00
Stephen Marz
532b246f7b Added locking to the scheduler. Since this is invoked so often, it causes a race with the test_elf process. 2020-04-26 21:08:29 -04:00
Stephen Marz
ef0997be74 Add documentation for Mutex 2020-04-26 20:28:20 -04:00
Stephen Marz
a1f9d2c6cd Add Mutex to process list. 2020-04-26 20:11:01 -04:00
Stephen Marz
03018cb55f Removed warnings 2020-04-26 15:55:22 -04:00
Stephen Marz
7dfe0b8182 Run cargo fix 2020-04-26 15:53:26 -04:00
Stephen Marz
3d43bbd93c asm is deprecated in Rust as my compiler warned me. So, let's switch to llvm_asm 2020-04-26 15:52:08 -04:00
Stephen Marz
591f0fdff8 Get rid of useless header. 2020-04-26 14:58:28 -04:00
Stephen Marz
29100f10ae Updated comments 2020-04-26 14:05:50 -04:00
Stephen Marz
af29a0d267 Removed make_hdd.sh, it stores random bytes, now we have a filesystem 2020-04-26 13:55:08 -04:00
Stephen Marz
d62d3f3816 Added more rigorous test, fixed bug in ELF loader 2020-04-26 09:26:41 -04:00
Stephen Marz
bc6ef9d689 Fixed ELF loader and added offset. 2020-04-26 09:19:07 -04:00
Stephen Marz
8f61253aea Removed old code and added comments. 2020-04-26 08:51:25 -04:00
Stephen Marz
cc3b78973c Rearranged code, added comments. 2020-04-26 08:43:03 -04:00
Stephen Marz
42c14bf930 Check and use permission bits in ELF for user pages. 2020-04-26 08:40:43 -04:00
Stephen Marz
fa1a728bd9 Changed to run test_elf for ELF files 2020-04-26 08:34:00 -04:00
Stephen Marz
074dc9547a Now we read ELF files instead of raw binaries 2020-04-26 08:33:49 -04:00
Stephen Marz
de97ebf12d Added ELF structures for reading ELF files. 2020-04-26 08:33:25 -04:00
Stephen Marz
06894d3aff Move BlockBuffer into fs. 2020-04-26 07:12:38 -04:00
Stephen Marz
25009aaa3c Fixed bug in locating the inode. 2020-04-26 07:12:27 -04:00
Stephen Marz
fac882ea73 Clean up scheduler code. 2020-04-25 23:27:00 -04:00
Stephen Marz
fd9c9449b0 Allow sleeping processes that are awoken to immediately execute. 2020-04-25 23:26:14 -04:00
Stephen Marz
60edb9f72a Remove the dumb done flag. 2020-04-25 23:24:55 -04:00
Stephen Marz
58b73e2208 Added tons of comments. 2020-04-25 22:25:32 -04:00
Stephen Marz
b8029e76ac Make helloworld.cpp print a pointer so we can see how we directly affect
the stack.
2020-04-25 21:44:11 -04:00
Stephen Marz
f771883cb0 Added satp_fence. Probably don't need this since we don't reuse pids. 2020-04-25 21:44:05 -04:00
Stephen Marz
eab4a20a61 Added calculations to helloworld 2020-04-25 21:35:32 -04:00
Stephen Marz
0c649f5370 Change wording of helloworld.cpp so it's recognizable when printed to the screen. 2020-04-25 21:24:21 -04:00
Stephen Marz
1627cc7733 Read and start a process...Added userspace library...will switch this to newlib later. 2020-04-25 21:23:00 -04:00
Stephen Marz
cbff6afeca Added comments. 2020-04-25 19:51:27 -04:00
Stephen Marz
cb06702afa Act more like Rust by adding _mut() for those functions that return mutable references or pointers. 2020-04-25 19:36:58 -04:00
Stephen Marz
e5f3eb7f6b Removed mapping the kernel memory into a process' virtual address space. 2020-04-25 19:34:20 -04:00
Stephen Marz
84e5126d29 Added formatting, made syscall.rs clearer to read. 2020-04-25 18:48:23 -04:00
Stephen Marz
056ef5bb2d Added dump_registers as syscall 1--for debugging purposes. 2020-04-25 18:25:18 -04:00
Stephen Marz
d86c65a380 Added comments and removed llvm_asm -- it looks like I'll have to use this in the future 2020-04-25 17:34:06 -04:00
Stephen Marz
018faea21e Check for a 0 zone before adding to blocks seen. 2020-04-25 16:47:13 -04:00
Stephen Marz
3eb61ad188 Remove redundant variable 2020-04-25 16:41:43 -04:00
Stephen Marz
bb4e2d118a Minix reads Direct, Indirect, Doubly-indirect, and Triply-indirect zones 2020-04-25 16:39:50 -04:00
Stephen Marz
0de9b23b17 Change test and added comments 2020-04-25 16:06:29 -04:00
Stephen Marz
080a529f01 Reading up to indirect pointers 2020-04-25 15:15:25 -04:00
Stephen Marz
c2fb6cf90d Fix system calls. Size always comes first now, followed by offset. 2020-04-25 14:16:03 -04:00
Stephen Marz
787f886b6f Clean up code, added deleting a process if a user process causes a fault. 2020-04-24 22:19:41 -04:00
Stephen Marz
bb74161466 Remove use 2020-04-24 19:58:29 -04:00
Stephen Marz
2eb8acabd7 Remove syscall_exit, kernel processes will return via RA 2020-04-24 19:55:49 -04:00
Stephen Marz
71702acd43 Added comments and formatted. 2020-04-24 19:30:00 -04:00
Stephen Marz
0d924e6fab Fixed not waking up the process who made the request. 2020-04-24 19:26:44 -04:00
Stephen Marz
4c31f8c563 Add inode number to fs_read 2020-04-24 19:22:27 -04:00
Stephen Marz
a113db700a Added RA to call syscall_exit for kernel processes. 2020-04-24 19:16:45 -04:00
Stephen Marz
8ae5ebb085 Added syscall_block_read and syscall_fs_read. 2020-04-24 18:56:32 -04:00
Stephen Marz
8081863709 Fix inits loop. We will use WFI to avoid hogging resources. 2020-04-24 18:48:19 -04:00
Stephen Marz
e0a8be5522 Don't let init sleep. This will cause us to hang in the scheduler. 2020-04-24 18:47:49 -04:00
Stephen Marz
58ab3f3b6f Don't let init sleep. This will cause us to hang in the scheduler. 2020-04-24 18:46:31 -04:00
Stephen Marz
73636c1de1 Updates to add a process for a file system read in the system call. 2020-04-24 18:37:48 -04:00
Stephen Marz
2e48b86656 Auto-drop processes, and added delete process. 2020-04-24 15:22:57 -04:00
Stephen Marz
a60d84ed98 Start adding block device stuff and file system stuff. Added test for block driver as a process. 2020-04-24 14:39:56 -04:00
Stephen Marz
599627b74a Updated to allow for system calls that change process state 2020-04-24 14:39:33 -04:00
Stephen Marz
e39f6b71c5 Added information for release builds 2020-04-21 20:31:27 -04:00
Stephen Marz
625df1cf46 Added testing shell, no testing, yet. 2020-04-21 20:30:09 -04:00
Stephen Marz
da92f55d1b Added codegen-units to avoid SEGV 2020-04-21 20:27:13 -04:00
Stephen Marz
8b2b670deb Add testing shell 2020-04-21 20:25:39 -04:00
Stephen Marz
b3e99659de Initial fix 2020-04-21 20:23:39 -04:00
Stephen Marz
f9572be05a Add options in Cargo.toml for lto and optimizer 2020-04-21 20:21:56 -04:00
Stephen Marz
1ae7b115f7 Let's try BUILD.md this way 2020-04-21 20:14:20 -04:00
Stephen Marz
e6d9807c11 Short instructions for building. 2020-04-21 20:13:51 -04:00
Stephen Marz
d1dc1d7b32 Get rid of Makefile, use cargo build and cargo run now. 2020-04-21 19:51:30 -04:00
Stephen Marz
1c329244ce Use Rust out-of-the-box now that it has full support for RISC-V. We need
cargo-binutils and so forth to run these. But, for now all we need is to
run cargo run and it should invoke qemu for us based on .cargo/config
2020-04-21 19:49:23 -04:00
Stephen Marz
86018d30a3 Added assembly module so that Rust will import RISC-V assembly code
without using GNU tools
2020-04-21 19:48:19 -04:00
Stephen Marz
aba5fe0e24 Use cargo to build out-of-the-box here. 2020-04-21 19:47:57 -04:00
Stephen Marz
abd3048afa Use Rust's global_asm to import assembly files 2020-04-21 19:47:38 -04:00
Stephen Marz
4767b6d698 Fixed used index and available index. These are modded by the queue size in the ring only. The index continues to increase until it naturally wraps at the data size 2020-04-12 21:37:06 -04:00
Stephen Marz
fb3a9ccdae Test block device 2020-03-31 11:41:32 -04:00
Stephen Marz
ce5e8b17b2 Fixed C++ isms when translating to Rust 2020-03-28 21:06:31 -04:00
Stephen Marz
55bcc79736 Added MmioDevice structure to put a structure to the MMIO virtio address space. 2020-03-28 21:05:45 -04:00
Stephen Marz
d2ab4a1ad7 Rename inode to node for a more generic filesystem. 2020-03-18 22:37:12 -04:00
Stephen Marz
61d8ace581 Added more FS stuff. 2020-03-18 22:01:05 -04:00
Stephen Marz
e033feee2b Documentation says 0x80000, but I left off a zero :( Thanks to QiuhaoLi 2020-03-18 10:41:57 -04:00
Stephen Marz
b39db75cf4 Add fs and minix 2020-03-18 10:40:27 -04:00
Stephen Marz
d6bf3d2685 Remove testing code, change comments 2020-03-16 15:05:04 -04:00
Stephen Marz
40977c2e45 Add global entropy device list 2020-03-16 14:02:28 -04:00
Stephen Marz
4fd36bf898 Move individual chapters, use tags from now on 2020-03-15 20:21:42 -04:00
Stephen Marz
c184aae307 Add rng.rs for ch9 and overall 2020-03-15 20:18:46 -04:00
Stephen Marz
703c2cf5b0 Finish virtio 2020-03-15 20:18:09 -04:00
Stephen Marz
858c838e73 Updates to power of two ring size 2020-03-15 11:11:59 -04:00
Stephen Marz
973ec7449b Added comments to describe functions and enumerations. Also, assumptions have been spelled out. 2020-03-15 11:09:01 -04:00
Stephen Marz
ea4c8ae9c2 Shortened some code using Rust 2020-03-13 21:45:13 -04:00
Stephen Marz
50df049fbb I messed up the header size, which is why writes failed 2020-03-13 20:01:02 -04:00
Stephen Marz
a6c0ff96fe Remove mepc, satp, and pid, we get these from the frame address 2020-03-13 19:38:31 -04:00
Stephen Marz
4487295308 Remove frame extraction 2020-03-13 19:38:06 -04:00
Stephen Marz
c3e7451997 Change trap frame structure to new function, and added quantum multiplier 2020-03-13 19:37:44 -04:00
Stephen Marz
f881eacf26 Remove unused imports, status isn't currently being used in trap, and removed unsafe from trap 7 2020-03-13 19:37:21 -04:00
Stephen Marz
44f2f3acb5 Changed testing apparatus 2020-03-13 19:36:53 -04:00
Stephen Marz
46afb47ab6 changed used ring to be page aligned 2020-03-13 19:36:34 -04:00
Stephen Marz
0954532a5b changed used ring to be page aligned 2020-03-13 19:36:24 -04:00
Stephen Marz
cfbc4b516a Remove block::init, it's not necessary anymore 2020-03-13 15:33:37 -04:00
Stephen Marz
8f55a9a6ec Remove reference when using ref 2020-03-13 15:31:47 -04:00
Stephen Marz
67f30af9a9 Clean up interrupt code 2020-03-13 13:23:55 -04:00
Stephen Marz
cbc3622c8e Remove debugging output 2020-03-13 13:16:43 -04:00
Stephen Marz
497abf1660 Added comments, will need to centralize the read/write functions 2020-03-13 13:04:41 -04:00
Stephen Marz
5e0be36d45 My fault, the mut's in let Some don't actually do anything. 2020-03-13 12:58:16 -04:00
Stephen Marz
efb26d6aa3 Add cargo 2020-03-13 11:47:11 -04:00
Stephen Marz
08b227e223 Add ignore 2020-03-13 11:46:13 -04:00
Stephen Marz
9524954eb2 Remove unnecessary code 2020-03-13 11:28:39 -04:00
Stephen Marz
eec1047ac9 Document how to get the index from mmio address 2020-03-13 11:23:08 -04:00
Stephen Marz
5b2e780484 move index so that it has more time to write 2020-03-13 11:17:32 -04:00
Stephen Marz
9623de2e50 Added PLIC handler to delegate to virtio. Virtio now delegates to the virtio device type to handle PLIC interrupts. We now handle interrupts from VirtIO as well as free memory associated with it. 2020-03-13 11:15:12 -04:00
Stephen Marz
016520a354 Support new block list 2020-03-12 20:44:53 -04:00
Stephen Marz
72563c3161 Switch to a static block list. This will make it easier to determine
which drive we're talking about. 1 is 0x1000_1000 ... 8 is 0x1000_8000
2020-03-12 20:44:28 -04:00
Stephen Marz
93969a2bf5 Added testing first 10 bytes of the hdd.dsk file 2020-03-12 20:10:36 -04:00
Stephen Marz
58efe7e3ac Added block request read. Quite dirty, but for now it works 2020-03-12 19:47:58 -04:00
Stephen Marz
552595d901 Fixed to use new scheduler return values 2020-03-12 13:56:21 -04:00
Stephen Marz
7b038cdc24 Right now, we return a pointer by usize. This is not good programming in
Rust. Instead, the scheduler needs to be modified to return a process
structure's reference. Then, we can extract the fields and then switch.
However, this will require us to have to change how the PROCESS_LIST
works. Since it uses move constructs, we cannot move a process out of it
when we replace the process list.
2020-03-12 13:55:11 -04:00
Stephen Marz
d9b1743698 Changed scheduler to only return the frame and satp register. The mepc
is now stored in the trap frame.
2020-03-12 13:54:39 -04:00
Stephen Marz
c6b261bf20 Added comments and reformatted using rustfmt 2020-03-12 13:36:50 -04:00
Stephen Marz
bc9158bd23 Changed the queue size to only take one page. 2020-03-12 13:36:18 -04:00
Stephen Marz
f5ce75dbe8 Finished setup, rearranged queue creation and testing bits. This makes it so we don't have to free anything if we fail after setting up the queue. 2020-03-12 13:36:08 -04:00
Stephen Marz
a32c6fc995 Updates 2020-03-11 17:09:09 -04:00
Stephen Marz
46a6296dec Added block specific routines and stub setup routine for block devices 2020-03-10 19:29:29 -04:00
Stephen Marz
39cb72ad9f Added virtio probing to kinit 2020-03-10 17:17:12 -04:00
Stephen Marz
a29698221d Added virtio structures and stubs for setting up devices 2020-03-10 17:16:57 -04:00
Stephen Marz
d403ae8b7b Add hdd.dsk to ignore 2020-03-10 17:16:44 -04:00
Stephen Marz
3ffb53405d Add many virtio devices 2020-03-10 17:16:13 -04:00
Stephen Marz
795e7945f8 Load block device through make run 2020-03-10 16:51:22 -04:00
Stephen Marz
d44f729957 Split CTX switch time and frequency and also use build_satp for switching to user process 2020-03-10 15:35:21 -04:00
Stephen Marz
f2b1e2018a Moved PC to trap frame so we don't restart the function 2020-03-10 14:55:26 -04:00
Stephen Marz
2984472493 Added chapter 9 2020-03-10 13:52:09 -04:00
Stephen Marz
d154e86d9e Added Cargo.lock 2020-03-10 13:51:44 -04:00
Stephen Marz
08c5ddafc2 Updated comments and removed debugging code 2020-03-10 13:50:08 -04:00
Stephen Marz
2bcf1bb000 Change cycle time 2020-03-10 13:01:32 -04:00
Stephen Marz
b27784ed52 Separate sched and switch_to_user 2020-03-10 12:59:36 -04:00
Stephen Marz
cb54d823d2 Fire off the first CTX switch timer! 2020-03-10 12:46:52 -04:00
Stephen Marz
429b056921 Updates to system call. Change stack pointer for MMU 2020-03-10 12:44:08 -04:00
Stephen Marz
88c672171e Fixed trap. Forgot to reset mtvec in switch_to_user 2020-03-10 12:41:16 -04:00
Stephen Marz
f2f5c855cf M 2020-03-10 11:21:15 -04:00
Stephen Marz
57145beefd Fixed trap handler, load kernel stack from trap, fixed init, map a larger swath of memory for init. 2020-03-10 11:20:00 -04:00
Stephen Marz
e6ccf15bda Added .gitignore to make this doable 2020-03-09 17:51:32 -04:00