1
0
mirror of https://github.com/sgmarz/osblog.git synced 2024-11-27 20:03:32 +04:00
Commit Graph

314 Commits

Author SHA1 Message Date
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
Stephen Marz
ee92f8e123 Ugh. Remove target 2020-03-09 17:51:10 -04:00
Stephen Marz
b139313874 Added chapter 8 2020-02-22 08:53:59 -05:00
Alex Chi
2474df886c
Add data flush in uart put function 2020-02-03 10:33:00 +08:00
Stephen Marz
4ffb6e3e3b Added syscall and shell scheduler 2020-01-18 20:22:47 -05:00
Stephen Marz
e8e379e557 Updates to ch6 -- post ready. 2019-12-08 14:30:41 -05:00
Stephen Marz
eb0c943a71 Updates to process. 2019-12-07 22:04:13 -05:00
Stephen Marz
c1e247cad5 Move lots of code to support user processes. 2019-12-07 13:59:39 -05:00
Stephen Marz
f8c2faa3ae Updates to process code. 2019-12-05 19:52:02 -05:00
Stephen Marz
fa82110eac Added adjustment constants. 2019-11-28 12:27:13 -05:00
Stephen Marz
ba678d2252 Fixed HEAP map bug. 2019-11-28 12:22:42 -05:00
Stephen Marz
b723763292 Free root table. 2019-11-28 12:05:24 -05:00
Stephen Marz
b61b3ebbf5 Use zalloc to clear page tables. 2019-11-28 12:04:21 -05:00
Stephen Marz
c99bff8944 Use zalloc to clear page tables. 2019-11-28 12:02:37 -05:00
Stephen Marz
c5179e60d6 Added virtual memory allocation. 2019-11-28 12:01:52 -05:00
Stephen Marz
26e37d33d3 Added comments to process 2019-11-27 23:42:50 -05:00
Stephen Marz
d0c3c9ff6e Add Process structure and routines. 2019-11-27 17:02:07 -05:00
Stephen Marz
4ec1301e8f Added chapter 6 2019-11-27 12:59:29 -05:00
Stephen Marz
b9158e5ef7 Added comments for plic. 2019-11-18 19:30:19 -05:00
Stephen Marz
5ca14d6e65 Added comments, moved UART 2019-11-18 19:21:32 -05:00
Stephen Marz
61bb8f3a43 Added comments 2019-11-18 19:19:05 -05:00
Stephen Marz
7faf580765 Added PLIC 2019-11-18 19:14:16 -05:00
Stephen Marz
fb86ff06da Added PLIC 2019-11-18 19:14:08 -05:00
Stephen Marz
03ff50ef30 Added PLIC 2019-11-18 19:13:52 -05:00
Stephen Marz
b3cd92dc41 Added comments 2019-11-10 09:20:40 -05:00
Stephen Marz
e2dfa8661f Remove public constants 2019-11-04 15:35:24 -05:00
Stephen Marz
f7547d5c59 Add comments about pointer arithmetic. 2019-11-04 15:27:56 -05:00
Stephen Marz
783cdcfc3b Remove if statement--let boolean condition stand 2019-11-04 15:26:47 -05:00
Stephen Marz
0c71107da8 Add PLIC functions 2019-11-04 15:25:27 -05:00
Stephen Marz
49d8d6666a Start chapter 5 2019-11-04 13:14:28 -05:00
Stephen Marz
f13948d5c0 Fixed typos, updates. 2019-11-04 13:04:00 -05:00
Stephen Marz
6cbf12ada9 Updates to pages 2019-11-03 21:26:39 -05:00
Stephen Marz
6cc5cba4b8 Added return_pc as mutable 2019-11-03 21:23:30 -05:00
Stephen Marz
07dffe1823 added ecall printf 2019-11-03 21:21:43 -05:00
Stephen Marz
175c4fc7eb Added timer reset in async 7 2019-11-03 21:17:29 -05:00
Stephen Marz
4211090d17 Fixed typos 2019-11-03 19:08:35 -05:00
Stephen Marz
a76745278e Fixed unit type 2019-11-03 19:07:42 -05:00
Stephen Marz
ac5e41ceb4 Update comments 2019-11-03 19:06:38 -05:00
Stephen Marz
79a6500c0b Rename stat to status 2019-11-03 19:03:10 -05:00
Stephen Marz
5a8523099a Added epc to trap 3 and 11 2019-11-03 19:00:46 -05:00
Stephen Marz
efaecf96d6 Fixed typo 2019-11-03 19:00:24 -05:00
Stephen Marz
ee5094d821 Added shell traps 2019-11-03 19:00:14 -05:00
Stephen Marz
ccad138c03 Changed trap to machine-only 2019-11-03 18:56:43 -05:00
Stephen Marz
d8b0313842 Remove s_trap in ASM 2019-11-03 18:41:21 -05:00
Stephen Marz
bb64443076 Remove s_trap 2019-11-03 18:41:07 -05:00
Stephen Marz
aaad7c1cec Added comments and updates to traps 2019-11-02 02:44:40 -04:00
Stephen Marz
6f333bd8f0 Ran rustfmt 2019-10-27 16:03:37 -04:00
Stephen Marz
0b2506e8e5 Updates for ch4 2019-10-27 16:03:12 -04:00
Stephen Marz
b95aacadb4 Changed SATP fence functions 2019-10-25 18:39:59 -04:00
Stephen Marz
7e3d97b908 Fixed mapping kernel stack 2019-10-21 13:19:52 -04:00
Stephen Marz
ce0cc7df11 Fixed mapping kernel stack 2019-10-21 13:19:13 -04:00
Stephen Marz
eb2b9a6aca Fixed stack location, mapping 2019-10-14 22:15:03 -04:00
Stephen Marz
fb4f3eea91 Fixed stack location, mapping 2019-10-14 22:12:44 -04:00
Stephen Marz
9baea58551 Added cpu.rs for CPU routines. Changed context-switch code. 2019-10-14 21:23:20 -04:00
Stephen Marz
731e428f66 Added timer reset in trap 2019-10-14 16:22:13 -04:00
Stephen Marz
3c99c5cffa Switched to using mret for trap 2019-10-14 16:14:42 -04:00
Stephen Marz
ccaf9b6a5c Switched to using mret for trap 2019-10-14 16:14:22 -04:00
Stephen Marz
a10926df76 Change C++ to Rust 2019-10-12 21:33:27 -04:00
Stephen Marz
e82192913f Change C++ to Rust 2019-10-12 21:32:57 -04:00
Stephen Marz
1411743210 Added chapter 4 2019-10-12 20:42:55 -04:00
Stephen Marz
a8079377dd Merge branch 'next' 2019-10-12 19:13:42 -04:00
Stephen Marz
03e34ebf96 Added comments, switched KERNEL_TABLE to data section 2019-10-12 19:12:50 -04:00
Stephen Marz
88f5cb514f Map heap descriptors 2019-10-12 00:11:24 -04:00
Stephen Marz
86d1fa858b Update id_map_range 2019-10-11 23:38:35 -04:00
Stephen Marz
8ec9fe3fb8 Update id_map_range 2019-10-11 23:38:23 -04:00
Stephen Marz
11bc25b670 Updates 2019-10-11 23:31:47 -04:00
Stephen Marz
aa4a5b1403 Revert "Format uart.rs"
This reverts commit 72ea82b224.
2019-10-11 23:30:29 -04:00
Stephen Marz
4772efe99d Created a larger pager which autodetects the range for GB, MB, and KB pages 2019-10-11 22:52:35 -04:00
Stephen Marz
72ea82b224 Format uart.rs 2019-10-10 08:46:16 -04:00
Stephen Marz
450a152b24 Add sanity check from kmalloc. Don't zero if it is null 2019-10-10 08:45:39 -04:00
Stephen Marz
a110d17355 Optimized LCR. Reading from MMIO is slower than overwriting 2019-10-10 08:34:31 -04:00
Stephen Marz
ed45e30076 Merge branch 'master' of ssh://github.com/pavehawk2007/osblog 2019-10-10 08:03:08 -04:00
Stephen Marz
4fa3f329a1 Fixed UART overwriting word length bits 2019-10-10 08:03:03 -04:00
Stephen Marz
e89ad79cca Fixed UART overriding bits 2019-10-10 08:01:39 -04:00
Stephen Marz
16d3e4e9fe Added info to page allocation table. 2019-10-09 22:02:58 -04:00
Stephen Marz
d667e9c4d6 Added info to page allocation table. 2019-10-09 21:59:17 -04:00
Stephen Marz
deb5c972c2 Make id_map_range easier to read 2019-10-09 21:36:54 -04:00
Stephen Marz
5928b07621 Added comments, fixed formatting 2019-10-09 21:22:29 -04:00
Stephen Marz
1abe0bb336 Fixed over-sizing with kzmalloc 2019-10-09 20:58:31 -04:00
Stephen Marz
88abfb57f2 Fixed typos 2019-10-09 20:57:24 -04:00
Stephen Marz
c4b824dfa7 Fixed looping bug 2019-10-09 20:36:39 -04:00
Stephen Marz
99b98111a4 Added kzmalloc for zeroing allocated memory 2019-10-09 20:36:05 -04:00
Stephen Marz
19eac921db Change to id_map_range 2019-10-09 20:27:45 -04:00
Stephen Marz
7a6ba92732 Ran rustfmt and removed dead code 2019-10-09 20:24:19 -04:00
Stephen Marz
8ad7d2c24c Finished sret comparison 2019-10-09 20:21:25 -04:00
Stephen Marz
72f4ce8d46 Updated delegation and removed sie bit in favor of spie 2019-10-09 20:11:21 -04:00
Stephen Marz
3adc054e2d Added _stack_start and _stack_end to map the stack space 2019-10-09 19:50:03 -04:00
Stephen Marz
d81c619e60 Removed unsafe for id_map_range, added comments 2019-10-09 19:44:39 -04:00
Stephen Marz
037e7044ac No need for a space literal 2019-10-09 19:42:11 -04:00
Stephen Marz
5634c8342b Remove drive..no need for it until block 2019-10-09 19:41:47 -04:00
Stephen Marz
6aff7529c2 Disable interrupts for duration of kinit(), reenable in supervisor mode 2019-10-09 18:35:14 -04:00
Stephen Marz
a2a94006f3 Added newline at the end of file, mapped all of PLIC and CLINT 2019-10-09 18:21:43 -04:00
Stephen Marz
982c4afb77 Switch to gcc so that a stage 1 build is sufficient (./do.sh 91) 2019-10-09 18:21:20 -04:00
Stephen Marz
5ad54c6299 Finished MMU, page allocation, and kmem allocation. Switched to supervisor mode in kmain() 2019-10-09 18:09:56 -04:00
Adam Short
0c9fb68846 Fixed do.sh to remove Linux build directory
Originally, the do.sh script would remove the linux folder, not the
build folder.
2019-10-08 23:23:26 -04:00
Adam Short
575f055df6 Added TOOLCHAIN_ROOT to .build.config
to add prefix where toolchain is being installed to (primarily used
if not using sudo)
2019-10-08 22:53:08 -04:00
Stephen Marz
7f00a999d3 Rename mem.rs to page.rs. We will make a localized allocator for mem.rs, later 2019-10-07 16:43:48 -04:00
Stephen Marz
4a6c58cda6 Added comments 2019-10-07 16:38:03 -04:00
Stephen Marz
d64cad37b9 Update boxed feel. Both are fine, just want to represent both ways to do this. 2019-10-07 16:33:38 -04:00
Stephen Marz
0fe8e027d3 Get rid of spurious mut 2019-10-07 16:33:07 -04:00
Stephen Marz
2937d95f71 Get rid of spurious mut 2019-10-07 16:32:16 -04:00
Stephen Marz
9aa757f9f2 Updates, added a table length 2019-10-07 16:31:27 -04:00
Stephen Marz
076dceff73 Added global allocator and tests 2019-10-07 16:03:39 -04:00
Stephen Marz
a321507a3b Added chapter 3 2019-10-07 14:43:28 -04:00
Stephen Marz
77994f2289 Added chapter 3 2019-10-06 22:20:39 -04:00
Dr. Koutheir Attouchi
b6f9be4bbb
More comments on what's going on 2019-10-06 17:52:59 +02:00
Dr. Koutheir Attouchi
68e33189fd
Commenting what's being done 2019-10-06 17:16:42 +02:00
Stephen Marz
0b2cbfcb35 Closes issue #5 : Added comments to virt.lds to explain what each section does. 2019-10-06 11:06:51 -04:00
Stephen Marz
33d27d9efa Use byte iterator 2019-10-05 00:18:24 -04:00
Stephen Marz
691c5b1653 Go back to 8000_0000 2019-10-04 14:11:32 -04:00
Stephen Marz
7a55de2601 Parse out words for initialization 2019-10-04 08:25:39 -04:00
Stephen Marz
14f67420e0 Remove stop bits 2019-10-03 22:07:43 -04:00
Stephen Marz
661ccca9d0 Updates to chapter 2 2019-10-03 21:56:19 -04:00
Stephen Marz
10c493738e Added chapter 2 2019-10-02 08:41:58 -04:00
Stephen Marz
1402b8c8bd Fixes issue #1 - assembly trap vector has been added and commented
to give context to what it will do in the future.
2019-09-29 08:04:36 -04:00
Stephen Marz
e5190b7dc4 The original OS won't compile if the asm_trap_vector isn't there. It won't
do anything, since we haven't gotten that far, yet, but it needs to at least
be a symbol for the linker to have.
2019-09-29 08:00:12 -04:00
Stephen Marz
1dea574177 Rust gets a little mad with the three forward-slashes /// due to
rustdoc. So, these were spaced out to look like normal comments.
2019-09-29 07:59:45 -04:00
Stephen Marz
f110f25ad8 Added make_hdd.sh to make hdd.dsk 2019-09-27 13:19:51 -04:00
Stephen Marz
a9bbdf8554 Added chapters 0 and 1 2019-09-27 13:17:29 -04:00