Compare commits

..

No commits in common. "0c0af6414efaf969feb956554a795633a46ca862" and "f567198f75debb73d205ed991368d3b9f94c24fe" have entirely different histories.

6 changed files with 54 additions and 64 deletions

@ -248,7 +248,7 @@ impl ATABus {
self.wait_command_end();
}
pub async fn read_block(&mut self, lba: u32) -> [u8; CD_SECTOR_SIZE] {
pub async fn read_block(&mut self, lba: u32) {
let mut packet = SCSIPacket::new();
packet.op_code = SCSI_READ_12;
@ -277,8 +277,6 @@ impl ATABus {
//(*INTERRUPT_FUTURE).await;
self.wait_command_end();
self.block
}
fn wait_busy(&mut self) {

@ -27,6 +27,14 @@ struct IsoPathTable {
}
impl IsoPathTable {
pub fn from(mapping: &u8) -> &Self {
let ptr: *const u8 = mapping;
let path_table_ptr: *const Self = ptr as *const Self;
unsafe {
&*path_table_ptr
}
}
#[allow(unaligned_references)]
pub fn get_idf(&self) -> &[u8] {
unsafe {
@ -69,6 +77,14 @@ pub struct IsoDir {
}
impl IsoDir {
pub fn from(mapping: &u8) -> &Self {
let ptr: *const u8 = mapping;
let path_table_ptr: *const Self = ptr as *const Self;
unsafe {
&*path_table_ptr
}
}
#[allow(unaligned_references)]
pub fn get_idf(&self) -> &[u8] {
unsafe {
@ -80,7 +96,7 @@ impl IsoDir {
// Primary volume descriptor structure
pub const ISO_PRIM_VOLDESC_BLOCK: u32 = 16;
const ISO_PRIM_VOLDESC_BLOCK: usize = 16;
const ISO_SYSIDF_LEN: usize = 32;
const ISO_VOLIDF_LEN: usize = 32;
@ -95,47 +111,47 @@ const ISO_LDATE_LEN: usize = 17;
#[repr(C, packed)]
pub struct IsoPrimVolDesc {
pub vol_desc_type: u8, // Volume descripto type (1)
pub std_identifier: [u8; 5], // standard identifier ("CD001")
pub vol_desc_version: u8, // Volume descriptor version (1)
vol_desc_type: u8, // Volume descripto type (1)
std_identifier: [u8; 5], // standard identifier ("CD001")
vol_desc_version: u8, // Volume descriptor version (1)
pub _unused1: u8,
_unused1: u8,
pub sys_idf: [u8; ISO_SYSIDF_LEN], // System identifier
pub vol_idf: [u8; ISO_VOLIDF_LEN], // Volume identifier
sys_idf: [u8; ISO_SYSIDF_LEN], // System identifier
vol_idf: [u8; ISO_VOLIDF_LEN], // Volume identifier
pub _unused2: [u8; 8],
_unused2: [u8; 8],
pub vol_blk_count: MultiEndian32, // Number of logical blocks in the volume
vol_blk_count: MultiEndian32, // Number of logical blocks in the volume
pub _unused3: [u8; 32],
_unused3: [u8; 32],
pub vol_set_size: MultiEndian16, // The Volume Set size of the volume
pub vol_seq_num: MultiEndian16, // The number of the volume in the set
pub vol_blk_size: MultiEndian16, // The size in bytes of a logical block
vol_set_size: MultiEndian16, // The Volume Set size of the volume
vol_seq_num: MultiEndian16, // The number of the volume in the set
vol_blk_size: MultiEndian16, // The size in bytes of a logical block
pub path_table_size: MultiEndian32, // Length in bytes of the path table
pub le_path_table_blk: u32, // Path table block index little endian
pub le_opt_path_table_blk: u32, // Optionnal path table block index little endian
pub be_path_table_blk: u32,
pub be_opt_path_table_blk: u32,
path_table_size: MultiEndian32, // Length in bytes of the path table
le_path_table_blk: u32, // Path table block index little endian
le_opt_path_table_blk: u32, // Optionnal path table block index little endian
be_path_table_blk: u32,
be_opt_path_table_blk: u32,
pub root_dir: IsoDir, // Root directory entry
root_dir: IsoDir, // Root directory entry
pub _unused4: [u8; 34 - core::mem::size_of::<IsoDir>()], // Padding
_unused4: [u8; 34 - core::mem::size_of::<IsoDir>()], // Padding
pub volset_idf: [u8; ISO_VOLSET_LEN], // name of the multiple volume set
pub pub_idf: [u8; ISO_PUBIDF_LEN], // Publisher name
pub dprep_idf: [u8; ISO_DPREP_LEN], // Data preparer name
pub app_idf: [u8; ISO_APP_LEN], // Application name
volset_idf: [u8; ISO_VOLSET_LEN], // name of the multiple volume set
pub_idf: [u8; ISO_PUBIDF_LEN], // Publisher name
dprep_idf: [u8; ISO_DPREP_LEN], // Data preparer name
app_idf: [u8; ISO_APP_LEN], // Application name
pub copyright_file: [u8; ISO_CPRFIL_LEN], // Copyright file name in root dir
pub abstract_file: [u8; ISO_ABSFIL_LEN], // Abstract file name in root dir
pub bibli_file: [u8; ISO_BIBFIL_LEN], // Bibliograpgic file name in root dir
pub date_creat: [u8; ISO_LDATE_LEN], // Creation date
pub date_modif: [u8; ISO_LDATE_LEN], // Modification date
pub date_expir: [u8; ISO_LDATE_LEN], // Expiration date
pub date_effect: [u8; ISO_LDATE_LEN], // Effective date
copyright_file: [u8; ISO_CPRFIL_LEN], // Copyright file name in root dir
abstract_file: [u8; ISO_ABSFIL_LEN], // Abstract file name in root dir
bibli_file: [u8; ISO_BIBFIL_LEN], // Bibliograpgic file name in root dir
date_creat: [u8; ISO_LDATE_LEN], // Creation date
date_modif: [u8; ISO_LDATE_LEN], // Modification date
date_expir: [u8; ISO_LDATE_LEN], // Expiration date
date_effect: [u8; ISO_LDATE_LEN], // Effective date
pub file_struct_version: u8, // File structure version (1)
file_struct_version: u8, // File structure version (1)
}

@ -1,18 +1 @@
pub mod iso9660;
use crate::serial_println;
use crate::drivers::atapi::{DRIVE};
use crate::utils::unserialize;
use iso9660::{IsoPrimVolDesc};
pub async fn init_prim_vol_desc() {
let desc_block = DRIVE
.lock()
.as_mut()
.unwrap()
.read_block(iso9660::ISO_PRIM_VOLDESC_BLOCK)
.await;
let prim_vol_desc: &IsoPrimVolDesc = unserialize::<IsoPrimVolDesc>(desc_block.as_ptr());
serial_println!("{:?}", prim_vol_desc.std_identifier);
}
pub mod iso9660;

@ -8,7 +8,6 @@ mod interrupts;
mod memory;
mod task;
mod fs;
mod utils;
//#[macro_use]
extern crate alloc;
@ -57,8 +56,11 @@ pub extern "C" fn julios_main(multiboot_info_addr: usize) -> ! {
println!("***JuliOS V0.1.0***");
serial_println!("Hello serial");
serial_println!("{}", core::mem::size_of::<IsoPrimVolDesc>());
serial_println!("{}", core::mem::size_of::<IsoDir>());
serial_println!("{}", core::mem::size_of::<MultiEndian32>());
let mut executor = Executor::new();
executor.spawn(Task::new(keyboard::print_keypresses()));
executor.spawn(Task::new(fs::iso::init_prim_vol_desc()));
executor.run();
}

@ -1,3 +0,0 @@
pub mod serialize;
pub use serialize::unserialize;

@ -1,6 +0,0 @@
pub fn unserialize<T>(ptr: *const u8) -> &'static T {
let path_table_ptr: *const T = ptr as *const T;
unsafe {
&*path_table_ptr
}
}