Skip to content

Commit d0b712c

Browse files
committed
Updated dependencies
Signed-off-by: SlyMarbo <[email protected]>
1 parent 8121be6 commit d0b712c

File tree

8 files changed

+72
-68
lines changed

8 files changed

+72
-68
lines changed

kernel/.cargo/config

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
[unstable]
2+
build-std = ["core", "compiler_builtins", "alloc"]
3+
build-std-features = ["compiler-builtins-mem"]
4+
15
[build]
26
target = "x86_64-firefly.json"
37

kernel/Cargo.lock

Lines changed: 29 additions & 26 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

kernel/Cargo.toml

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,15 @@ authors = ["Jamie Hall <[email protected]>"]
55
edition = "2018"
66

77
[dependencies]
8-
bootloader = { version = "0.9.5", features = ["map_physical_memory"]}
9-
linked_list_allocator = "0.8.4"
10-
pc-keyboard = "0.5.0"
11-
pic8259_simple = "0.2.0"
12-
spin = "0.5.2"
13-
uart_16550 = "0.2.7"
14-
volatile = "0.2.6"
15-
x86_64 = "0.11.1"
16-
17-
[dependencies.lazy_static]
18-
version = "1.0"
19-
features = ["spin_no_std"]
8+
bootloader = { version = "=0.9.19", features = ["map_physical_memory"]}
9+
lazy_static = { version = "=1.4.0", features = ["spin_no_std"]}
10+
linked_list_allocator = "=0.9.0"
11+
pc-keyboard = "=0.5.0"
12+
pic8259 = "=0.10.1"
13+
spin = "=0.5.2"
14+
uart_16550 = "=0.2.15"
15+
volatile = "=0.2.6"
16+
x86_64 = "=0.14.6"
2017

2118
[profile.dev]
2219
panic = "abort"

kernel/build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
set -e
44

5-
cargo bootimage --target ../x86_64-firefly.json --release
5+
cargo bootimage --target x86_64-firefly.json --release

kernel/src/allocator/fixed_size_block.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,9 @@ impl FixedSizeBlockAllocator {
3434
/// new creates an empty FixedSizeBlockAllocator.
3535
///
3636
pub const fn new() -> Self {
37+
const EMPTY: Option<&'static mut ListNode> = None;
3738
FixedSizeBlockAllocator {
38-
list_heads: [None; BLOCK_SIZES.len()],
39+
list_heads: [EMPTY; BLOCK_SIZES.len()],
3940
fallback_allocator: linked_list_allocator::Heap::empty(),
4041
}
4142
}

kernel/src/gdt.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
use lazy_static::lazy_static;
2+
use x86_64::instructions::segmentation::{CS, Segment};
3+
use x86_64::instructions::tables::load_tss;
24
use x86_64::structures::gdt::{Descriptor, GlobalDescriptorTable, SegmentSelector};
35
use x86_64::structures::tss::TaskStateSegment;
46
use x86_64::VirtAddr;
57

68
pub fn init() {
7-
use x86_64::instructions::segmentation::set_cs;
8-
use x86_64::instructions::tables::load_tss;
9-
109
GDT.0.load();
1110
unsafe {
12-
set_cs(GDT.1.code_selector);
11+
CS::set_reg(GDT.1.code_selector);
1312
load_tss(GDT.1.tss_selector);
1413
}
1514
}
@@ -40,11 +39,12 @@ lazy_static! {
4039
static ref TSS: TaskStateSegment = {
4140
let mut tss = TaskStateSegment::new();
4241
tss.interrupt_stack_table[DOUBLE_FAULT_IST_INDEX as usize] = {
43-
const STACK_SIZE: usize = 4096;
42+
const STACK_SIZE: usize = 4096 * 5;
4443
static mut STACK: [u8; STACK_SIZE] = [0; STACK_SIZE];
4544

4645
let stack_start = VirtAddr::from_ptr(unsafe { &STACK });
47-
stack_start + STACK_SIZE
46+
let stack_end = stack_start + STACK_SIZE;
47+
stack_end
4848
};
4949
tss
5050
};

kernel/src/interrupts.rs

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use crate::{gdt, halt_loop, print, println, time};
22
use lazy_static::lazy_static;
3-
use pic8259_simple::ChainedPics;
3+
use pic8259::ChainedPics;
44
use x86_64::structures::idt::{InterruptDescriptorTable, InterruptStackFrame, PageFaultErrorCode};
55

66
pub fn init() {
@@ -11,12 +11,12 @@ lazy_static! {
1111
static ref IDT: InterruptDescriptorTable = {
1212
let mut idt = InterruptDescriptorTable::new();
1313
idt.breakpoint.set_handler_fn(breakpoint_handler);
14+
idt.page_fault.set_handler_fn(page_fault_handler);
1415
unsafe {
1516
idt.double_fault
1617
.set_handler_fn(double_fault_handler)
1718
.set_stack_index(gdt::DOUBLE_FAULT_IST_INDEX);
1819
}
19-
idt.page_fault.set_handler_fn(page_fault_handler);
2020
idt[InterruptIndex::Timer.as_usize()].set_handler_fn(timer_interrupt_handler);
2121
idt[InterruptIndex::Keyboard.as_usize()].set_handler_fn(keyboard_interrupt_handler);
2222

@@ -26,18 +26,31 @@ lazy_static! {
2626

2727
// Interrupt handlers.
2828

29-
extern "x86-interrupt" fn breakpoint_handler(stack_frame: &mut InterruptStackFrame) {
29+
extern "x86-interrupt" fn breakpoint_handler(stack_frame: InterruptStackFrame) {
3030
println!("EXCEPTION: BREAKPOINT\n{:#?}", stack_frame);
3131
}
3232

33+
extern "x86-interrupt" fn page_fault_handler(
34+
stack_frame: InterruptStackFrame,
35+
error_code: PageFaultErrorCode,
36+
) {
37+
use x86_64::registers::control::Cr2;
38+
39+
println!("EXCEPTION: PAGE FAULT");
40+
println!("Accessed Address: {:?}", Cr2::read());
41+
println!("Error Code: {:?}", error_code);
42+
println!("{:#?}", stack_frame);
43+
halt_loop();
44+
}
45+
3346
extern "x86-interrupt" fn double_fault_handler(
34-
stack_frame: &mut InterruptStackFrame,
47+
stack_frame: InterruptStackFrame,
3548
_error_code: u64,
3649
) -> ! {
3750
panic!("EXCEPTION: DOUBLE FAULT\n{:#?}", stack_frame);
3851
}
3952

40-
extern "x86-interrupt" fn keyboard_interrupt_handler(_stack_frame: &mut InterruptStackFrame) {
53+
extern "x86-interrupt" fn keyboard_interrupt_handler(_stack_frame: InterruptStackFrame) {
4154
use pc_keyboard::{layouts, DecodedKey, HandleControl, Keyboard, ScancodeSet1};
4255
use spin::Mutex;
4356
use x86_64::instructions::port::Port;
@@ -67,20 +80,7 @@ extern "x86-interrupt" fn keyboard_interrupt_handler(_stack_frame: &mut Interrup
6780
}
6881
}
6982

70-
extern "x86-interrupt" fn page_fault_handler(
71-
stack_frame: &mut InterruptStackFrame,
72-
error_code: PageFaultErrorCode,
73-
) {
74-
use x86_64::registers::control::Cr2;
75-
76-
println!("EXCEPTION: PAGE FAULT");
77-
println!("Accessed Address: {:?}", Cr2::read());
78-
println!("Error Code: {:?}", error_code);
79-
println!("{:#?}", stack_frame);
80-
halt_loop();
81-
}
82-
83-
extern "x86-interrupt" fn timer_interrupt_handler(_stack_frame: &mut InterruptStackFrame) {
83+
extern "x86-interrupt" fn timer_interrupt_handler(_stack_frame: InterruptStackFrame) {
8484
time::TICKER.tick();
8585

8686
unsafe {

kernel/src/lib.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
#![feature(custom_test_frameworks)]
44
#![feature(abi_x86_interrupt)]
55
#![feature(alloc_error_handler)]
6-
#![feature(const_fn)]
7-
#![feature(const_in_array_repeat_expressions)]
6+
#![feature(const_mut_refs)]
87
#![test_runner(crate::test_runner)]
98
#![reexport_test_harness_main = "test_main"]
109

@@ -64,7 +63,7 @@ impl<A> Locked<A> {
6463
/// Testable represents a test function.
6564
///
6665
pub trait Testable {
67-
fn run(&self);
66+
fn run(&self) -> ();
6867
}
6968

7069
/// Wrap tests with debug statements.

0 commit comments

Comments
 (0)