1
0
mirror of https://github.com/rcore-os/rCore.git synced 2024-11-23 16:36:18 +04:00
Commit Graph

153 Commits

Author SHA1 Message Date
Philipp Oppermann
d2060e76f8 Create a GDT descriptor struct 2017-11-19 14:24:33 +01:00
Philipp Oppermann
f651987666 Add a dependency on bit_field 2017-11-19 14:24:33 +01:00
Philipp Oppermann
eea8c10a97 Create a interrupts::gdt submodule 2017-11-19 14:24:27 +01:00
Philipp Oppermann
e1d2af5ea7 Rename interrupts.rs to interrupts/mod.rs 2017-11-19 14:24:27 +01:00
Philipp Oppermann
a05db759d7 Create a TSS and save the double fault stack pointer it its IST 2017-11-19 14:24:27 +01:00
Philipp Oppermann
00bbd6fbc6 Pass the memory controller to interrupts::init and use it to create a double fault stack 2017-11-19 14:24:27 +01:00
Philipp Oppermann
f1459a552c Return a memory controller from memory::init 2017-11-19 14:24:27 +01:00
Philipp Oppermann
73d4390f27 Create a memory manager for convenience 2017-11-19 14:23:45 +01:00
Philipp Oppermann
0e3857ca50 Create a stack allocator module 2017-11-19 14:23:45 +01:00
Philipp Oppermann
3efe54169e Provoke a stack overflow, which still causes a boot loop 2017-11-19 14:23:45 +01:00
Philipp Oppermann
2b9d880e48 Add a double fault handler 2017-11-19 14:23:45 +01:00
Philipp Oppermann
91ffde4728 Trigger a double fault by causing a page fault 2017-11-19 14:23:45 +01:00
Philipp Oppermann
93aff8cfa8 Test our exception handler by invoking a breakpoint exception 2017-11-19 14:22:24 +01:00
Philipp Oppermann
fab320271a Create and load an IDT 2017-11-19 14:21:51 +01:00
Philipp Oppermann
7becaf5f30 Add a dependency on lazy_static 2017-11-19 14:21:51 +01:00
Philipp Oppermann
3bbc2a0bdc Add a simple handler function for the breakpoint exception 2017-11-19 14:21:36 +01:00
Philipp Oppermann
c2d22af1c7 Create a new interrupts module 2017-11-19 14:21:12 +01:00
Philipp Oppermann
ad211de615 Use linked list allocator instead of bump allocator 2017-11-19 14:20:46 +01:00
Philipp Oppermann
01f8c43ffb Map the heap pages to physical frames 2017-11-19 14:20:46 +01:00
Philipp Oppermann
f2bbe43099 Use once crate to ensure that memory::init is only called once 2017-11-19 14:20:45 +01:00
Philipp Oppermann
76550dcd95 Refactor: Move memory initialization to memory::init function 2017-11-19 14:20:45 +01:00
Philipp Oppermann
c0d403abbe Set a global allocator 2017-11-19 14:20:45 +01:00
Philipp Oppermann
9dc998222a Make the bump allocator lock free and impl Alloc for shared reference 2017-11-19 14:20:45 +01:00
Philipp Oppermann
1f6633fe44 Add a heap_allocator module with a basic bump allocator 2017-11-19 14:20:45 +01:00
Philipp Oppermann
5f017124dd Add a dependency on the alloc crate 2017-11-19 14:20:45 +01:00
Philipp Oppermann
c6dd37dcc5 Turn page of old P4 into guard page 2017-11-19 11:44:50 +01:00
Philipp Oppermann
2a3ce863fd Enable write protect bit to improve safety 2017-11-19 11:44:50 +01:00
Philipp Oppermann
ffaddeb84e Fix boot loop by enabling the NXE bit in the EFER register 2017-11-19 11:44:50 +01:00
Philipp Oppermann
0ce2b46ad1 Use the correct entry flags for kernel sections 2017-11-19 11:44:50 +01:00
Philipp Oppermann
11993b7e15 Also identity map the multiboot info structure 2017-11-19 11:44:50 +01:00
Philipp Oppermann
fdacfb24f0 Fix boot loop by identity mapping the vga buffer 2017-11-19 11:44:50 +01:00
Philipp Oppermann
564c6b64e9 Switch to the new page table after mapping all sections 2017-11-19 11:44:50 +01:00
Philipp Oppermann
fa3b572d68 Only print kernel/multiboot start/end in rust_main 2017-11-19 11:44:50 +01:00
Philipp Oppermann
40f1732ccb Call remap_the_kernel from rust_main 2017-11-19 11:44:49 +01:00
Philipp Oppermann
5d898d8474 Page align all sections as they will be individually mapped 2017-11-19 11:44:49 +01:00
Philipp Oppermann
e029eabe18 Add a remap_the_kernel function 2017-11-19 11:44:49 +01:00
Philipp Oppermann
60d7c736a5 Add a (now safe) with method 2017-11-19 11:44:49 +01:00
Philipp Oppermann
2f30b0f7cf Create a new ActivePageTable struct that derefs to Mapper 2017-11-19 11:44:49 +01:00
Philipp Oppermann
ce9c4d6e43 Refactor: Move ActivePageTable to new mapper submodule and rename to Mapper 2017-11-19 11:44:49 +01:00
Philipp Oppermann
4160cb6d7e Begin creating an ActivePageTable::with function 2017-11-19 11:42:33 +01:00
Philipp Oppermann
b2e79752fd Fix InactivePageTable::new function using a temporary page 2017-11-19 11:42:33 +01:00
Philipp Oppermann
11ae7e8aeb Create a temporary_page module 2017-11-19 11:42:33 +01:00
Philipp Oppermann
1737f48284 Create a InactivePageTable struct 2017-11-19 11:42:33 +01:00
Philipp Oppermann
1f1f6c62da Derive Copy and Clone for Page and add a Frame::clone method 2017-11-19 11:42:33 +01:00
Philipp Oppermann
1007c5157d Remove paging testing code again 2017-11-19 11:42:16 +01:00
Philipp Oppermann
55e602dc61 Fix unmap function by flushing the TLB 2017-11-19 11:42:16 +01:00
Philipp Oppermann
eb5c9afa51 Add a dependency on the x86_64 crate 2017-11-19 11:42:16 +01:00
Philipp Oppermann
0ee4ed738a Test the unmap function (it doesn't work correctly) 2017-11-19 11:42:16 +01:00
Philipp Oppermann
b49cb6986c Test the map_to function 2017-11-19 11:42:16 +01:00
Philipp Oppermann
15c9f43622 Add an (unfinished) unmap method 2017-11-19 11:42:16 +01:00
Philipp Oppermann
3696c7bacb Add map and identity_map functions for convenience 2017-11-19 11:42:16 +01:00
Philipp Oppermann
bb473c7907 Make translate and map_to safe by making them methods of a new ActivePageTable struct 2017-11-19 11:42:16 +01:00
Philipp Oppermann
dedf6e8959 Add a map_to function 2017-11-19 11:42:16 +01:00
Philipp Oppermann
83d56aa9de Add translate and translate_page functions 2017-11-19 11:42:16 +01:00
Philipp Oppermann
a7170a4a44 Use type system tricks to make next_table methods safe 2017-11-19 11:42:16 +01:00
Philipp Oppermann
0874625269 Add methods to retrieve a (mutual) reference to the next table 2017-11-19 10:39:17 +01:00
Philipp Oppermann
3706331a43 Add a P4 constant and a Table::next_table_address method 2017-11-19 10:39:17 +01:00
Philipp Oppermann
8fcea7951b Recursive map the P4 table 2017-11-19 10:39:17 +01:00
Philipp Oppermann
e50d70c02e Add a Table::zero method to clear all entries 2017-11-19 10:39:17 +01:00
Philipp Oppermann
2b7fa410fb Implement the Index and IndexMut traits for Table 2017-11-19 10:39:17 +01:00
Philipp Oppermann
62d655fbdd Create a memory::paging::table submodule with a Table struct 2017-11-19 10:39:17 +01:00
Philipp Oppermann
fe464463eb Add pointed_frame and set methods to Entry 2017-11-19 10:39:17 +01:00
Philipp Oppermann
148d506629 Use bitflags to create an EntryFlags type 2017-11-19 10:39:17 +01:00
Philipp Oppermann
f957f2ecde Add a dependency on the bitflags crate 2017-11-19 10:39:17 +01:00
Philipp Oppermann
c4c27c10e6 Create a memory::paging::entry submodule with an Entry struct 2017-11-19 10:39:17 +01:00
Philipp Oppermann
c7c02d7dca Create a memory::paging module with a Page struct 2017-11-19 10:39:17 +01:00
Philipp Oppermann
9f1a69cafa Create a new AreaFrameAllocator and allocate maximum number of frames 2017-11-19 10:39:13 +01:00
Philipp Oppermann
edb2e693da Create an AreaFrameAllocator 2017-11-19 10:39:13 +01:00
Philipp Oppermann
84c337e6f0 Create a memory module with a Frame struct and FrameAllocator trait 2017-11-19 10:39:13 +01:00
Philipp Oppermann
98d97703f4 Calculate start and end of kernel and multiboot struct 2017-11-19 10:39:13 +01:00
Philipp Oppermann
402ec77bc0 Reduce number of ELF section by merging .text.* (etc.) sections together 2017-11-19 10:39:13 +01:00
Philipp Oppermann
9a86f60835 Print kernel ELF sections 2017-11-19 10:39:13 +01:00
Philipp Oppermann
cbc9e112bd Print a proper message on panics 2017-11-19 10:39:13 +01:00
Philipp Oppermann
f231f2c7f2 Print available memory areas 2017-11-19 10:39:13 +01:00
Philipp Oppermann
5f65e1d31f Add dependency on multiboot2 crate 2017-11-19 10:39:13 +01:00
Philipp Oppermann
28ce5310c8 Pass address of multiboot info structure to rust_main 2017-11-19 10:39:13 +01:00
Philipp Oppermann
08a4e795a4 Increase stack size to 16k 2017-11-19 10:39:13 +01:00
Philipp Oppermann
9f448fbe0e Avoid deadlock on nested print! invokation 2017-11-19 10:39:05 +01:00
Philipp Oppermann
59b8133396 Add print! and println! macros and a clear_screen function 2017-11-19 10:39:05 +01:00
Philipp Oppermann
40aed4fa0f Create a static WRITER protected by a spinlock 2017-11-19 10:39:05 +01:00
Philipp Oppermann
f24c7bc322 Implement the new_line method 2017-11-19 10:31:00 +01:00
Philipp Oppermann
5e0ccd5aa5 Implement the fmt::Write trait and print something with the write! macro 2017-11-19 10:31:00 +01:00
Philipp Oppermann
578717a9b8 Add a write_str method and print “Hello!” 2017-11-19 10:31:00 +01:00
Philipp Oppermann
0ed21fb943 Use volatile writes for printing to screen 2017-11-19 10:31:00 +01:00
Philipp Oppermann
6aa3f67331 Add a print_something function to print an H in the lower left 2017-11-19 10:30:48 +01:00
Philipp Oppermann
46d47f8d2e Create a Writer struct with a write_byte function 2017-11-19 10:30:48 +01:00
Philipp Oppermann
afc2c26a9d Create a vga_buffer module 2017-11-19 10:30:48 +01:00
Philipp Oppermann
bef5f13560 Print a “Hello World!” in Rust 2017-11-19 10:30:36 +01:00
Philipp Oppermann
ff623a90e3 Use --gc-sections to remove unused program sections 2017-11-19 10:30:36 +01:00
Philipp Oppermann
5d8758df59 Add a dependency on rlibc 2017-11-18 11:10:17 +01:00
Philipp Oppermann
ca2ccc31aa Call the rust_main function from assembly 2017-11-18 11:10:17 +01:00
Philipp Oppermann
8e5a85ece4 Create a new no_std cargo project 2017-05-12 21:31:28 +02:00
Philipp Oppermann
9136a7b66f Zero all segment registers 2017-05-12 21:31:28 +02:00
Philipp Oppermann
415d27814f Do a far jump to long mode and print OKAY 2017-05-12 21:31:28 +02:00
Philipp Oppermann
e684bfd262 Create and load a 64-bit GDT 2017-05-12 21:31:28 +02:00
Philipp Oppermann
936e2073a9 Enable paging 2017-05-12 21:31:24 +02:00
Philipp Oppermann
b199b02578 Set up page tables for identity mapping 2017-05-12 21:31:24 +02:00
Philipp Oppermann
90e716827a Check multiboot magic number and for CPUID/long mode support 2017-05-12 21:31:24 +02:00
Philipp Oppermann
9819e17a28 Create and load a stack 2017-05-12 21:31:24 +02:00
Philipp Oppermann
5ebdd89ffb Add an error function 2017-05-12 21:31:24 +02:00