Skip to content

Commit

Permalink
chore(deps): upgrade x86_64 to v0.15
Browse files Browse the repository at this point in the history
  • Loading branch information
GZTimeWalker committed Mar 19, 2024
1 parent 2d743b4 commit c40d532
Show file tree
Hide file tree
Showing 10 changed files with 23 additions and 23 deletions.
4 changes: 2 additions & 2 deletions docs/labs/0x02/tasks.md
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ impl XApic {
use super::consts::*;

pub unsafe fn register_idt(idt: &mut InterruptDescriptorTable) {
idt[Interrupts::IrqBase as usize + Irq::Timer as usize]
idt[Interrupts::IrqBase as u8 + Irq::Timer as u8]
.set_handler_fn(clock_handler);
}

Expand Down Expand Up @@ -578,7 +578,7 @@ static int init_serial() {
use super::consts::*;

pub unsafe fn register_idt(idt: &mut InterruptDescriptorTable) {
idt[Interrupts::IrqBase as usize + Irq::Serial0 as usize]
idt[Interrupts::IrqBase as u8 + Irq::Serial0 as u8]
.set_handler_fn(serial_handler);
}

Expand Down
2 changes: 1 addition & 1 deletion src/0x01/pkg/boot/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ arrayvec = { version = "0.7", default-features = false }
uefi = "0.26"
uefi-services = { version = "0.23", optional = true}
log = "0.4"
x86_64 = "0.14"
x86_64 = "0.15"
xmas-elf = "0.9"
elf = { package = "ysos_elf", path = "../elf" }

Expand Down
2 changes: 1 addition & 1 deletion src/0x01/pkg/elf/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ edition = "2021"

[dependencies]
log = "0.4"
x86_64 = "0.14"
x86_64 = "0.15"
xmas-elf = "0.9"
2 changes: 1 addition & 1 deletion src/0x01/pkg/kernel/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ lazy_static = { version = "1.4", features = ["spin_no_std"] }
paste = "1.0"
spin = "0.9"
x86 = "0.52"
x86_64 = "0.14"
x86_64 = "0.15"
log = "0.4"
bitflags = "2.3"
libm = "0.2"
2 changes: 1 addition & 1 deletion src/0x02/pkg/kernel/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ crossbeam-queue = { version = "0.3", default-features = false, features = ["allo
paste = "1.0"
spin = "0.9"
x86 = "0.52"
x86_64 = "0.14"
x86_64 = "0.15"
log = "0.4"
bitflags = "2.3"
bit_field = "0.10"
Expand Down
2 changes: 1 addition & 1 deletion src/0x02/pkg/kernel/src/interrupt/exceptions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ pub extern "x86-interrupt" fn page_fault_handler(
panic!(
"EXCEPTION: PAGE FAULT, ERROR_CODE: {:?}\n\nTrying to access: {:#x}\n{:#?}",
err_code,
Cr2::read(),
Cr2::read().unwrap_or(0xdeadbeef),
stack_frame
);
}
2 changes: 1 addition & 1 deletion src/0x02/pkg/kernel/src/memory/allocator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pub fn init() {
static mut HEAP: [u8; HEAP_SIZE] = [0; HEAP_SIZE];

let heap_start = VirtAddr::from_ptr(unsafe { HEAP.as_ptr() });
let heap_end = heap_start + HEAP_SIZE;
let heap_end = heap_start + HEAP_SIZE as u64;

unsafe {
ALLOCATOR.lock().init(HEAP.as_mut_ptr(), HEAP_SIZE);
Expand Down
8 changes: 4 additions & 4 deletions src/0x02/pkg/kernel/src/memory/gdt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ lazy_static! {
const STACK_SIZE: usize = IST_SIZES[0];
static mut STACK: [u8; STACK_SIZE] = [0; STACK_SIZE];
let stack_start = VirtAddr::from_ptr(unsafe { STACK.as_ptr() });
let stack_end = stack_start + STACK_SIZE;
let stack_end = stack_start + STACK_SIZE as u64;
info!(
"Privilege Stack : 0x{:016x}-0x{:016x}",
stack_start.as_u64(),
Expand All @@ -40,9 +40,9 @@ lazy_static! {
lazy_static! {
static ref GDT: (GlobalDescriptorTable, KernelSelectors) = {
let mut gdt = GlobalDescriptorTable::new();
let code_selector = gdt.add_entry(Descriptor::kernel_code_segment());
let data_selector = gdt.add_entry(Descriptor::kernel_data_segment());
let tss_selector = gdt.add_entry(Descriptor::tss_segment(&TSS));
let code_selector = gdt.append(Descriptor::kernel_code_segment());
let data_selector = gdt.append(Descriptor::kernel_data_segment());
let tss_selector = gdt.append(Descriptor::tss_segment(&TSS));
(
gdt,
KernelSelectors {
Expand Down
2 changes: 1 addition & 1 deletion src/0x03/pkg/kernel/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ crossbeam-queue = { version = "0.3", default-features = false, features = ["allo
paste = "1.0"
spin = "0.9"
x86 = "0.52"
x86_64 = "0.14"
x86_64 = "0.15"
log = "0.4"
bitflags = "2.3"
bit_field = "0.10"
Expand Down
20 changes: 10 additions & 10 deletions src/0x03/pkg/kernel/src/proc/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ impl ProcessContext {
self.value.stack_frame.stack_pointer = stack_top;
self.value.stack_frame.instruction_pointer = entry;
self.value.stack_frame.cpu_flags =
(RFlags::IOPL_HIGH | RFlags::IOPL_LOW | RFlags::INTERRUPT_FLAG).bits();
RFlags::IOPL_HIGH | RFlags::IOPL_LOW | RFlags::INTERRUPT_FLAG;

let selector = get_selector();
self.value.stack_frame.code_segment = selector.code_selector.0 as u64;
self.value.stack_frame.stack_segment = selector.data_selector.0 as u64;
self.value.stack_frame.code_segment = selector.code_selector;
self.value.stack_frame.stack_segment = selector.data_selector;

trace!("Init stack frame: {:#?}", &self.stack_frame);
}
Expand All @@ -60,13 +60,13 @@ impl Default for ProcessContextValue {
fn default() -> Self {
Self {
regs: RegistersValue::default(),
stack_frame: InterruptStackFrameValue {
instruction_pointer: VirtAddr::new_truncate(0),
code_segment: 8,
cpu_flags: 0,
stack_pointer: VirtAddr::new_truncate(0),
stack_segment: 0,
},
stack_frame: InterruptStackFrameValue::new(
VirtAddr::new(0x1000),
SegmentSelector(0),
RFlags::empty(),
VirtAddr::new(0x2000),
SegmentSelector(0),
),
}
}
}
Expand Down

0 comments on commit c40d532

Please sign in to comment.