Implement Default
for TSS.
- Some documentation.
This commit is contained in:
parent
42c9ba12dc
commit
938b1a73a4
|
@ -45,3 +45,7 @@ If the condition is (or should be) unreachable, but if not upheld, leading to UB
|
|||
### Be gentle
|
||||
|
||||
Don't just write as much code as you can as quick as possible. Take your time and be careful.
|
||||
|
||||
### Commits
|
||||
|
||||
Use descriptive commits. One way to force yourself to do that is to not pass the `-m` flag, which will make your editor pop up, so that you can conviniently write long commit messages.
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
//! # IRQ handling
|
||||
//!
|
||||
//! This module defines IRQ handling functions. These functions should all be #[naked],
|
||||
//! unsafe, extern, and end in `iretq`
|
||||
|
||||
/// Interupt Request handler.
|
||||
#[naked]
|
||||
pub unsafe extern fn irq() {
|
||||
|
||||
|
|
|
@ -2,8 +2,7 @@
|
|||
///
|
||||
/// Copy N bytes of memory from one location to another.
|
||||
#[no_mangle]
|
||||
pub unsafe extern fn memcpy(dest: *mut u8, src: *const u8,
|
||||
n: usize) -> *mut u8 {
|
||||
pub unsafe extern fn memcpy(dest: *mut u8, src: *const u8, n: usize) -> *mut u8 {
|
||||
let mut i = 0;
|
||||
while i < n {
|
||||
*dest.offset(i as isize) = *src.offset(i as isize);
|
||||
|
|
|
@ -1,23 +1,25 @@
|
|||
/// Global descriptor table
|
||||
//! X86_64 architecture primitives.
|
||||
|
||||
/// Global descriptor table.
|
||||
pub mod gdt;
|
||||
|
||||
/// Interrupt descriptor table
|
||||
/// Interrupt descriptor table.
|
||||
pub mod idt;
|
||||
|
||||
/// IO Handling
|
||||
/// IO handling.
|
||||
pub mod io;
|
||||
|
||||
/// IRQ Handling
|
||||
/// IRQ handling.
|
||||
pub mod irq;
|
||||
|
||||
/// Initialization and main function
|
||||
/// Initialization and main function.
|
||||
pub mod main;
|
||||
|
||||
/// Memcpy, memmove, etc.
|
||||
/// Core memory routines.
|
||||
pub mod mem;
|
||||
|
||||
/// Serial driver and print! support
|
||||
/// Serial driver and `print!` support.
|
||||
pub mod serial;
|
||||
|
||||
/// Task state segment
|
||||
/// Task state segment.
|
||||
pub mod tss;
|
||||
|
|
|
@ -1,20 +1,22 @@
|
|||
#[repr(packed)]
|
||||
/// The Task State Segment.
|
||||
#[repr(C, packed)]
|
||||
#[derive(Debug, Default, Clone)]
|
||||
pub struct Tss {
|
||||
pub reserved1: u32,
|
||||
pub sp0: u64,
|
||||
pub sp1: u64,
|
||||
pub sp2: u64,
|
||||
pub reserved2: u32,
|
||||
pub reserved3: u32,
|
||||
pub ist1: u64,
|
||||
pub ist2: u64,
|
||||
pub ist3: u64,
|
||||
pub ist4: u64,
|
||||
pub ist5: u64,
|
||||
pub ist6: u64,
|
||||
pub ist7: u64,
|
||||
pub reserved4: u32,
|
||||
pub reserved5: u32,
|
||||
/// Reserved.
|
||||
pub _reserved1: u32,
|
||||
/// The stack-pointers (reg RSP) for the IO privilege level 0 through 2.
|
||||
pub rsp: [u64; 3],
|
||||
/// Reserved.
|
||||
pub _reserved2: u32,
|
||||
/// Reserved.
|
||||
pub _reserved3: u32,
|
||||
pub ist: [u64; 7],
|
||||
/// Reserved.
|
||||
pub _reserved4: u32,
|
||||
/// Reserved.
|
||||
pub _reserved5: u32,
|
||||
// Reserved.
|
||||
pub reserved6: u16,
|
||||
/// The offset to the IOPB.
|
||||
pub iomap_base: u16,
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue