/DragonOS-0.1.7/kernel/src/libs/ |
D | keyboard_parser.rs | 6 pub const NUM_SCAN_CODES: u8 = 0x80; 8 pub const TYPE1_KEYCODE_MAP_TABLE_COLS: u8 = 2; 11 pub const TYPE1_KEYCODE_FLAG_BREAK: u8 = 0x80; // 用于判断按键是否被按下 14 #[repr(u8)] 18 NoneFlag = 0 as u8, 19 PauseBreak = 1 as u8, 20 PrintScreenPress = 2 as u8, 21 PrintScreenRelease = 4 as u8, 22 OtherKey = 8 as u8, // 除了上面两个按键以外的功能按键(不包括下面的第三类按键) 46 pub fn parse(&mut self, scancode: u8) -> TypeOneFSMState { in parse() [all …]
|
D | vec_cursor.rs | 13 data: Vec<u8>, 20 pub fn new(data: Vec<u8>) -> Self { in new() 35 pub fn get_mut(&mut self) -> &mut Vec<u8> { in get_mut() argument 40 pub fn get_ref(&self) -> &Vec<u8> { in get_ref() argument 45 pub fn read_u8(&mut self) -> Result<u8, SystemError> { in read_u8() argument 101 pub fn read_exact(&mut self, buf: &mut [u8]) -> Result<(), SystemError> { in read_exact() 157 pub fn write_u8(&mut self, value: u8) -> Result<u8, SystemError> { in write_u8() argument 174 self.data[self.pos] = (value & 0xff) as u8; in write_u16() 176 self.data[self.pos] = ((value >> 8) & 0xff) as u8; in write_u16() 189 self.data[self.pos] = ((value >> (i * 8)) & 0xff) as u8; in write_u32() [all …]
|
/DragonOS-0.1.7/kernel/src/driver/disk/ahci/ |
D | hba.rs | 11 pub const ATA_CMD_READ_DMA_EXT: u8 = 0x25; // 读操作,并且退出 12 pub const ATA_CMD_WRITE_DMA_EXT: u8 = 0x35; // 写操作,并且退出 14 pub const ATA_CMD_IDENTIFY: u8 = 0xEC; 16 pub const ATA_CMD_IDENTIFY_PACKET: u8 = 0xA1; 18 pub const ATA_CMD_PACKET: u8 = 0xA0; 19 pub const ATA_DEV_BUSY: u8 = 0x80; 20 pub const ATA_DEV_DRQ: u8 = 0x08; 81 pub _rsv: [u8; 116], // 0x2C - 0x9F, Reserved 82 pub vendor: [u8; 96], // 0xA0 - 0xFF, Vendor specific registers 100 pub cfis: [u8; 64], // Command FIS [all …]
|
D | ahcidisk.rs | 30 pub ctrl_num: u8, 31 pub port_num: u8, 56 buf: &mut [u8], in read_at() argument 89 (1 << 5) - 1 as u8, in read_at() 90 (size_of::<FisRegH2D>() / size_of::<u32>()) as u8 in read_at() 97 let mut buf_ptr = buf as *mut [u8] as *mut usize as usize; in read_at() 132 ((&mut cmdtbl.cfis) as *mut [u8] as *mut usize as *mut FisRegH2D) in read_at() 136 volatile_write!(cmdfis.fis_type, FisType::RegH2D as u8); in read_at() 140 volatile_write!(cmdfis.lba0, (lba_id_start & 0xFF) as u8); in read_at() 141 volatile_write!(cmdfis.lba1, ((lba_id_start >> 8) & 0xFF) as u8); in read_at() [all …]
|
D | mod.rs | 78 Box::leak(Box::new([0u8; (1 << 20) as usize])) as *mut u8 as usize; in ahci_rust_init() 131 i as u8, in ahci_rust_init() 132 j as u8, in ahci_rust_init() 183 pub fn _port(ctrl_num: u8, port_num: u8) -> &'static mut HbaPort { in _port() argument 199 buf[i] = i as u8; in __test_ahci()
|
/DragonOS-0.1.7/kernel/src/mm/ |
D | allocator.rs | 8 unsafe fn local_alloc(&self, layout: Layout, gfp: gfp_t) -> *mut u8; in local_alloc() argument 9 unsafe fn local_alloc_zeroed(&self, layout: Layout, gfp: gfp_t) -> *mut u8; in local_alloc_zeroed() argument 10 unsafe fn local_dealloc(&self, ptr: *mut u8, layout: Layout); in local_dealloc() argument 17 unsafe fn local_alloc(&self, layout: Layout, gfp: gfp_t) -> *mut u8 { in local_alloc() argument 21 return kmalloc(layout.size() as u64, gfp) as *mut u8; in local_alloc() 24 unsafe fn local_alloc_zeroed(&self, layout: Layout, gfp: gfp_t) -> *mut u8 { in local_alloc_zeroed() argument 28 return kmalloc(layout.size() as u64, gfp | __GFP_ZERO) as *mut u8; in local_alloc_zeroed() 31 unsafe fn local_dealloc(&self, ptr: *mut u8, layout: Layout) { in local_dealloc() argument 38 unsafe fn alloc(&self, layout: Layout) -> *mut u8 { in alloc() argument 42 unsafe fn alloc_zeroed(&self, layout: Layout) -> *mut u8 { in alloc_zeroed() argument [all …]
|
/DragonOS-0.1.7/kernel/src/driver/timers/rtc/ |
D | rtc.rs | 38 let status_register_b: u8 = read_cmos(0x0B); // 读取状态寄存器B in get() 52 self.year = read_cmos(CMOSTimeSelector::Year as u8) as i32; in get() 53 self.month = read_cmos(CMOSTimeSelector::Month as u8) as i32; in get() 54 self.day = read_cmos(CMOSTimeSelector::Day as u8) as i32; in get() 55 self.hour = read_cmos(CMOSTimeSelector::Hour as u8) as i32; in get() 56 self.minute = read_cmos(CMOSTimeSelector::Minute as u8) as i32; in get() 57 self.second = read_cmos(CMOSTimeSelector::Second as u8) as i32; in get() 59 if self.second == read_cmos(CMOSTimeSelector::Second as u8) as i32 { in get() 92 fn read_cmos(addr: u8) -> u8 { in read_cmos() argument 100 #[repr(u8)]
|
/DragonOS-0.1.7/kernel/src/driver/pci/ |
D | pci.rs | 111 class_code: u8, in get_pci_device_structure_mut() argument 112 subclass: u8, in get_pci_device_structure_mut() argument 130 class_code: u8, in get_pci_device_structure() argument 131 subclass: u8, in get_pci_device_structure() argument 144 const BAR0_OFFSET: u8 = 0x10; 146 const STATUS_COMMAND_OFFSET: u8 = 0x04; 148 pub const PCI_CAP_ID_VNDR: u8 = 0x09; 221 Unrecognised(u8), 224 impl From<u8> for HeaderType { 225 fn from(value: u8) -> Self { in from() [all …]
|
/DragonOS-0.1.7/kernel/src/driver/uart/ |
D | uart.rs | 64 reg_data: u8, 65 reg_interrupt_enable: u8, 66 reg_ii_fifo: u8, // Interrupt Identification and FIFO control registers 67 reg_line_config: u8, 68 reg_modem_config: u8, 69 reg_line_status: u8, 70 reg_modem_statue: u8, 71 reg_scartch: u8, 109 io_out8(port + 0, (divisor & 0xff) as u8); // Set divisor (lo byte) in uart_init() 110 io_out8(port + 1, ((divisor >> 8) & 0xff) as u8); // (hi byte) in uart_init() [all …]
|
/DragonOS-0.1.7/kernel/src/driver/tty/ |
D | mod.rs | 51 stdin_rx: mpsc::Receiver<u8>, 52 stdin_tx: mpsc::Sender<u8>, 54 output_rx: mpsc::Receiver<u8>, 55 output_tx: mpsc::Sender<u8>, 82 let (stdin_tx, stdin_rx) = mpsc::channel::<u8>(Self::STDIN_BUF_SIZE); in new() 83 let (output_tx, output_rx) = mpsc::channel::<u8>(Self::OUTPUT_BUF_SIZE); in new() 103 pub fn input(&self, buf: &[u8], block: bool) -> Result<usize, TtyError> { in input() argument 120 pub fn output(&self, buf: &mut [u8], block: bool) -> Result<usize, TtyError> { in output() argument 131 pub fn stdout(&self, buf: &[u8], block: bool) -> Result<usize, TtyError> { in stdout() argument 142 pub fn stderr(&self, buf: &[u8], block: bool) -> Result<usize, TtyError> { in stderr() argument [all …]
|
/DragonOS-0.1.7/kernel/src/filesystem/ |
D | mbr.rs | 8 pub flags: u8, // 引导标志符,标记此分区为活动分区 9 pub starting_head: u8, // 起始磁头号 11 pub part_type: u8, // 分区类型ID 12 pub ending_head: u8, // 结束磁头号 37 pub reserved: [u8; 446],
|
/DragonOS-0.1.7/kernel/src/driver/virtio/ |
D | virtio_impl.rs | 15 fn dma_alloc(pages: usize, _direction: BufferDirection) -> (PhysAddr, NonNull<u8>) { in dma_alloc() argument 30 unsafe fn dma_dealloc(paddr: PhysAddr, _vaddr: NonNull<u8>, pages: usize) -> i32 { in dma_dealloc() argument 43 unsafe fn mmio_phys_to_virt(_paddr: PhysAddr, _size: usize) -> NonNull<u8> { in mmio_phys_to_virt() argument 49 unsafe fn share(buffer: NonNull<[u8]>, _direction: BufferDirection) -> PhysAddr { in share() argument 50 let vaddr = buffer.as_ptr() as *mut u8 as usize; in share() 56 unsafe fn unshare(_paddr: PhysAddr, _buffer: NonNull<[u8]>, _direction: BufferDirection) { in unshare() argument
|
D | transport_pci.rs | 39 const CAP_BAR_OFFSET: u8 = 4; 41 const CAP_BAR_OFFSET_OFFSET: u8 = 8; 43 const CAP_LENGTH_OFFSET: u8 = 12; 45 const CAP_NOTIFY_OFF_MULTIPLIER_OFFSET: u8 = 16; 48 const VIRTIO_PCI_CAP_COMMON_CFG: u8 = 1; 50 const VIRTIO_PCI_CAP_NOTIFY_CFG: u8 = 2; 52 const VIRTIO_PCI_CAP_ISR_CFG: u8 = 3; 54 const VIRTIO_PCI_CAP_DEVICE_CFG: u8 = 4; 87 isr_status: NonNull<Volatile<u8>>, 119 let cap_len = capability.private_header as u8; in new() [all …]
|
/DragonOS-0.1.7/kernel/src/process/ |
D | pid.rs | 5 #[repr(u8)] 18 *self as u8 == *other as u8 in eq()
|
/DragonOS-0.1.7/kernel/src/filesystem/fat/ |
D | bpb.rs | 17 pub jmp_boot: [u8; 3], 20 pub oem_name: [u8; 8], 26 pub sector_per_cluster: u8, 32 pub num_fats: u8, 41 pub media: u8, 76 pub drive_num: u8, 78 pub reserved1: u8, 80 pub boot_sig: u8, 123 pub reserved0: [u8; 12], 127 pub drive_num: u8, [all …]
|
D | entry.rs | 24 value: u8, 85 buf: &mut [u8], in read() argument 162 buf: &[u8], in write() argument 326 let zeroes: Vec<u8> = vec![0u8; (range_end - range_start) as usize]; in zero_range() 714 short_name: &[u8; 11], in create_dir_entries() 897 pub const READ_ONLY: u8 = 1 << 0; 898 pub const HIDDEN: u8 = 1 << 1; 899 pub const SYSTEM: u8 = 1 << 2; 900 pub const VOLUME_ID: u8 = 1 << 3; 901 pub const DIRECTORY: u8 = 1 << 4; [all …]
|
D | utils.rs | 8 pub fn decode_u8_ascii(value: u8) -> char { in decode_u8_ascii()
|
/DragonOS-0.1.7/kernel/src/net/ |
D | mod.rs | 72 fn read(&self, buf: &mut [u8]) -> (Result<usize, SystemError>, Endpoint); in read() 80 fn write(&self, buf: &[u8], to: Option<Endpoint>) -> Result<usize, SystemError>; in write() argument 197 _optval: &[u8], in setsockopt() argument 212 #[repr(u8)] 224 Unknown(u8), 247 let x: u8 = value.into(); in from() 252 impl From<u8> for Protocol { 253 fn from(value: u8) -> Self { in from() 270 impl Into<u8> for Protocol { 271 fn into(self) -> u8 { in into() argument
|
D | syscall.rs | 45 let socket_type = PosixSocketType::try_from((socket_type & 0xf) as u8)?; in do_socket() 53 Protocol::from(protocol as u8), in do_socket() 83 return do_setsockopt(fd, level, optname, optval as *const u8, optlen) in sys_setsockopt() constant 99 optval: *const u8, in do_setsockopt() argument 111 let data: &[u8] = unsafe { core::slice::from_raw_parts(optval, optlen) }; in do_setsockopt() 124 return do_getsockopt(fd, level, optname, optval as *mut u8, optlen as *mut u32) in sys_getsockopt() 142 optval: *mut u8, in do_getsockopt() argument 146 if unsafe { verify_area(optval as u64, core::mem::size_of::<u8>() as u64) } == false { in do_getsockopt() 164 if level as u8 == SOL_SOCKET { in do_getsockopt() 278 buf as *const u8, in sys_sendto() constant [all …]
|
/DragonOS-0.1.7/kernel/src/io/ |
D | device.rs | 20 const BLK_SIZE_LOG2_LIMIT: u8 = 12; // 设定块设备的块大小不能超过 1 << 12. 35 fn read_at(&self, offset: usize, len: usize, buf: &mut [u8]) -> Result<usize, SystemError>; in read_at() 42 fn write_at(&self, offset: usize, len: usize, buf: &[u8]) -> Result<usize, SystemError>; in write_at() 64 buf: &mut [u8], in read_at() argument 78 buf: &[u8], in write_at() argument 86 fn blk_size_log2(&self) -> u8; in blk_size_log2() argument 109 fn read_at(&self, offset: usize, len: usize, buf: &mut [u8]) -> Result<usize, SystemError> { in read_at() 145 fn write_at(&self, offset: usize, len: usize, buf: &[u8]) -> Result<usize, SystemError> { in write_at() 192 pub blk_size_log2: u8, 204 pub blk_size_log2: u8, [all …]
|
/DragonOS-0.1.7/kernel/src/arch/ |
D | mod.rs | 13 fn read_config(bus_device_function: &BusDeviceFunction, offset: u8) -> u32; in read_config() 18 fn write_config(bus_device_function: &BusDeviceFunction, offset: u8, data: u32); in write_config() argument
|
/DragonOS-0.1.7/kernel/src/driver/acpi/ |
D | acpi.rs | 9 pub bus_begin: u8, 10 pub bus_end: u8,
|
/DragonOS-0.1.7/kernel/src/filesystem/vfs/ |
D | syscall.rs | 80 let buf: &mut [u8] = in sys_read() 81 unsafe { core::slice::from_raw_parts_mut::<'static, u8>(buf_vaddr as *mut u8, len) }; in sys_read() 109 let buf: &[u8] = in sys_write() 110 unsafe { core::slice::from_raw_parts::<'static, u8>(buf_vaddr as *mut u8, len) }; in sys_write() 443 pub iov_base: *mut u8, 453 pub struct IoVecs(Vec<&'static mut [u8]>); 479 let mut slices: Vec<&mut [u8]> = vec![]; in from_user() 500 pub fn gather(&self) -> Vec<u8> { in gather() argument 509 pub fn scatter(&mut self, data: &[u8]) { in scatter() argument 510 let mut data: &[u8] = data; in scatter() [all …]
|
D | file.rs | 128 pub fn read(&mut self, len: usize, buf: &mut [u8]) -> Result<usize, SystemError> { in read() 149 pub fn write(&mut self, len: usize, buf: &[u8]) -> Result<usize, SystemError> { in write() 250 let name_bytes: &[u8] = name.as_bytes(); in readdir() 256 dirent.d_type = sub_inode.metadata().unwrap().file_type.get_file_type_num() as u8; in readdir() 259 let ptr = &mut dirent.d_name as *mut u8; in readdir() 260 let buf: &mut [u8] = in readdir() 261 ::core::slice::from_raw_parts_mut::<'static, u8>(ptr, name_bytes.len()); in readdir()
|
/DragonOS-0.1.7/kernel/src/filesystem/procfs/ |
D | mod.rs | 32 #[repr(u8)] 41 impl From<u8> for ProcFileType { 42 fn from(value: u8) -> Self { in from() 76 data: Vec<u8>, 95 data: Vec<u8>, 108 fn trim_string(&self, data: &mut Vec<u8>) { in trim_string() argument 109 data.drain_filter(|x: &mut u8| *x == 0); in trim_string() 130 let pdata: &mut Vec<u8> = &mut pdata.data; in open_status() 132 let tmp_name: Vec<u8> = "Unknown".as_bytes().to_vec(); in open_status() 190 return Ok((pdata.len() * size_of::<u8>()) as i64); in open_status() [all …]
|