Fix TSS descriptor flags
This commit is contained in:
parent
69bf4c6576
commit
f4200d768b
@ -82,7 +82,7 @@ lazy_static! {
|
||||
let tss_size = size_of::<TaskStateSegment>() as u128 - 1;
|
||||
let mut tss_descriptor: u128 = 0;
|
||||
tss_descriptor.set_bits(56..=95, tss_addr.bits(24..=63)); // Base bits 24..=63
|
||||
tss_descriptor.set_bits(52..=55, 0b0000); // Flags: 1-byte granularity
|
||||
tss_descriptor.set_bits(52..=55, 0b0010); // Flags: 1-byte granularity, long mode
|
||||
tss_descriptor.set_bits(48..=51, tss_size.bits(16..=19)); // Limit bits 16..=19
|
||||
tss_descriptor.set_bits(40..=47, 0b10001001); // Access: Present, ring 0, system segment
|
||||
tss_descriptor.set_bits(16..=39, tss_addr.bits(0..=23)); // Base bits 0..=23
|
||||
@ -147,7 +147,7 @@ pub fn read_gdt() -> GlobalDescriptorTable {
|
||||
#[allow(unused)]
|
||||
pub fn dump_gdt() {
|
||||
let gdt = crate::arch::x86_64::gdt::read_gdt();
|
||||
log_info!("GDT length: {}", gdt.limit() + 1);
|
||||
log_info!("GDT length (Counting null descriptor): {}", gdt.limit() + 1);
|
||||
for entry in gdt.entries() {
|
||||
let flags = x86_64::structures::gdt::DescriptorFlags::from_bits_retain(entry.raw());
|
||||
let seg_type = SegmentType::try_from(entry);
|
||||
|
||||
@ -27,7 +27,7 @@ use lazy_static::lazy_static;
|
||||
use spin::mutex::Mutex;
|
||||
use x86_64::VirtAddr;
|
||||
|
||||
use crate::{arch::x86_64::gdt::SELECTORS, boot::modules::MODULE_RESPONSE};
|
||||
use crate::{arch::x86_64::gdt, boot::modules::MODULE_RESPONSE};
|
||||
|
||||
lazy_static! {
|
||||
pub static ref SERIAL_3F8: Mutex<SerialPort> = Mutex::new(
|
||||
@ -93,15 +93,13 @@ unsafe extern "C" fn main() -> ! {
|
||||
|
||||
log_info!("Trans rights!");
|
||||
|
||||
// TODO: Figure out a way to specify log categories
|
||||
// Especially, get rid of fine grain logs if building in release mode
|
||||
boot::modules::log_modules();
|
||||
memory::log_memory();
|
||||
memory::log_address();
|
||||
gdt::dump_gdt();
|
||||
|
||||
log_info!(
|
||||
"TSS descriptor: 0x{:08x} {:08x}",
|
||||
SELECTORS.gdt.entries()[SELECTORS.sel_tss.index() as usize + 1].raw(),
|
||||
SELECTORS.gdt.entries()[SELECTORS.sel_tss.index() as usize].raw()
|
||||
);
|
||||
if let Some(modules_list) = *MODULE_RESPONSE
|
||||
&& modules_list.modules()[0].path().ends_with("/userboot.bin")
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user