/DragonOS-0.1.8/kernel/src/mm/ |
D | mod.rs | 64 pub fn virt_2_phys(addr: usize) -> usize { in virt_2_phys() argument 65 addr - PAGE_OFFSET as usize in virt_2_phys() 70 pub fn phys_2_virt(addr: usize) -> usize { in phys_2_virt() argument 71 addr + PAGE_OFFSET as usize in phys_2_virt() 85 pub struct PhysAddr(usize); 89 pub const fn new(address: usize) -> Self { in new() 95 pub fn data(&self) -> usize { in data() argument 101 pub fn add(self, offset: usize) -> Self { in add() 107 pub fn check_aligned(&self, align: usize) -> bool { in check_aligned() 123 impl core::ops::Add<usize> for PhysAddr { [all …]
|
D | c_adapter.rs | 24 …static ref C_ALLOCATION_MAP: SpinLock<HashMap<VirtAddr, (VirtAddr, usize, usize)>> = SpinLock::new… 29 pub unsafe extern "C" fn rs_pseudo_map_phys(vaddr: usize, paddr: usize, size: usize) { in rs_pseudo_map_phys() argument 38 pub unsafe extern "C" fn rs_map_phys(vaddr: usize, paddr: usize, size: usize, flags: usize) { in rs_map_phys() argument 45 if flags & PAGE_U_S as usize != 0 { in rs_map_phys() 67 pub unsafe extern "C" fn kzalloc(size: usize, _gfp: gfp_t) -> usize { in kzalloc() argument 73 pub unsafe extern "C" fn kmalloc(size: usize, _gfp: gfp_t) -> usize { in kmalloc() argument 79 fn do_kmalloc(size: usize, zero: bool) -> usize { in do_kmalloc() argument 93 let vaddr = VirtAddr::new(ptr as usize); in do_kmalloc() 94 let len = len as usize; in do_kmalloc() 95 let cap = cap as usize; in do_kmalloc() [all …]
|
D | syscall.rs | 120 len: usize, in mmap() argument 121 prot_flags: usize, in mmap() argument 122 map_flags: usize, in mmap() argument 124 _offset: usize, in mmap() argument 125 ) -> Result<usize, SystemError> { in mmap() argument 170 pub fn munmap(start_vaddr: VirtAddr, len: usize) -> Result<usize, SystemError> { in munmap() argument 201 len: usize, in mprotect() argument 202 prot_flags: usize, in mprotect() argument 203 ) -> Result<usize, SystemError> { in mprotect() argument
|
/DragonOS-0.1.8/kernel/src/syscall/ |
D | mod.rs | 316 pub const SYS_PUT_STRING: usize = 1; 317 pub const SYS_OPEN: usize = 2; 318 pub const SYS_CLOSE: usize = 3; 319 pub const SYS_READ: usize = 4; 320 pub const SYS_WRITE: usize = 5; 321 pub const SYS_LSEEK: usize = 6; 322 pub const SYS_FORK: usize = 7; 323 pub const SYS_VFORK: usize = 8; 324 pub const SYS_BRK: usize = 9; 325 pub const SYS_SBRK: usize = 10; [all …]
|
D | user_access.rs | 24 pub unsafe fn clear_user(dest: VirtAddr, len: usize) -> Result<usize, SystemError> { in clear_user() argument 33 pub unsafe fn copy_to_user(dest: VirtAddr, src: &[u8]) -> Result<usize, SystemError> { in copy_to_user() argument 43 pub unsafe fn copy_from_user(dst: &mut [u8], src: VirtAddr) -> Result<usize, SystemError> { in copy_from_user() argument 71 max_length: Option<usize>, in check_and_clone_cstr() argument 87 copy_from_user(&mut c, VirtAddr::new(addr as usize))?; in check_and_clone_cstr() 123 let mut dst = core::mem::transmute::<[usize; 1], [u8; size_of::<usize>()]>(dst); in check_and_clone_cstr_array() 124 copy_from_user(&mut dst, VirtAddr::new(addr as usize))?; in check_and_clone_cstr_array() 125 let dst = core::mem::transmute::<[u8; size_of::<usize>()], [usize; 1]>(dst); in check_and_clone_cstr_array()
|
/DragonOS-0.1.8/kernel/src/io/ |
D | device.rs | 17 pub type BlockId = usize; 22 pub const LBA_SIZE: usize = 512; 35 fn read_at(&self, offset: usize, len: usize, buf: &mut [u8]) -> Result<usize, SystemError>; in read_at() argument 42 fn write_at(&self, offset: usize, len: usize, buf: &[u8]) -> Result<usize, SystemError>; in write_at() argument 63 count: usize, in read_at() argument 65 ) -> Result<usize, SystemError>; in read_at() argument 77 count: usize, in write_at() argument 79 ) -> Result<usize, SystemError>; in write_at() argument 100 fn block_size(&self) -> usize; in block_size() argument 109 fn read_at(&self, offset: usize, len: usize, buf: &mut [u8]) -> Result<usize, SystemError> { in read_at() argument [all …]
|
/DragonOS-0.1.8/kernel/src/mm/allocator/ |
D | slab.rs | 8 block_size: usize, 17 pub unsafe fn new(start_addr: usize, slab_size: usize, block_size: usize) -> Slab { in new() argument 26 pub fn used_blocks(&self) -> usize { in used_blocks() argument 34 pub fn grow(&mut self, start_addr: usize, slab_size: usize) { in grow() argument 61 len: usize, 66 unsafe fn new(start_addr: usize, block_size: usize, num_of_blocks: usize) -> FreeBlockList { in new() argument 80 fn len(&self) -> usize { in len() argument 120 fn addr(&self) -> usize { in addr() argument 121 return self as *const _ as usize; in addr()
|
D | page_frame.rs | 15 number: usize, 31 pub fn next_by(&self, n: usize) -> Self { in next_by() 80 number: usize, 95 pub fn next_by(&self, n: usize) -> Self { in next_by() 154 pub struct PageFrameCount(usize); 158 pub const fn new(count: usize) -> Self { in new() 162 pub fn data(&self) -> usize { in data() argument 167 pub fn bytes(&self) -> usize { in bytes() argument 174 pub fn from_bytes(bytes: usize) -> Option<Self> { in from_bytes() 219 impl Add<usize> for PageFrameCount { [all …]
|
/DragonOS-0.1.8/kernel/src/libs/ |
D | align.rs | 16 pub struct AlignedBox<T, const ALIGN: usize> { 20 impl<T, const ALIGN: usize> AlignedBox<T, ALIGN> { 22 const fn max(a: usize, b: usize) -> usize { in max() argument 62 impl<T, const ALIGN: usize> Debug for AlignedBox<T, ALIGN> { 75 impl<T, const ALIGN: usize> Drop for AlignedBox<T, ALIGN> { 86 impl<T, const ALIGN: usize> core::ops::Deref for AlignedBox<T, ALIGN> { 94 impl<T, const ALIGN: usize> core::ops::DerefMut for AlignedBox<T, ALIGN> { 100 impl<T: Clone + SafeForZero, const ALIGN: usize> Clone for AlignedBox<T, ALIGN> { 114 unsafe impl<const NUM: usize> SafeForZero for [u8; NUM] {} 121 pub fn page_align_up(addr: usize) -> usize { in page_align_up() argument [all …]
|
/DragonOS-0.1.8/kernel/src/driver/base/char/ |
D | mod.rs | 9 const CHARDEV_MAJOR_HASH_SIZE: usize = 255; 10 const CHARDEV_MAJOR_MAX: usize = 512; 11 const MINOR_BITS: usize = 20; 12 const MINOR_MASK: usize = 1 << MINOR_BITS - 1; 14 const CHARDEV_MAJOR_DYN_END: usize = 234; 16 const CHARDEV_MAJOR_DYN_EXT_START: usize = 511; 17 const CHARDEV_MAJOR_DYN_EXT_END: usize = 384; 63 minorct: usize, // 次设备号数量 76 pub fn new(dev_t: DeviceNumber, minorct: usize, name: &'static str) -> Self { in new() argument 98 pub fn base_minor(&self) -> usize { in base_minor() argument [all …]
|
/DragonOS-0.1.8/kernel/src/process/ |
D | syscall.rs | 15 pub fn fork(&self) -> Result<usize, SystemError> { in fork() argument 21 pub fn vfork(&self) -> Result<usize, SystemError> { in vfork() argument 31 ) -> Result<usize, SystemError> { in execve() argument 41 ) -> Result<usize, SystemError> { in wait4() argument 48 return Ok(ret as usize); in wait4() 56 pub fn exit(status: usize) -> ! { in exit() argument 62 pub fn getpid() -> Result<usize, SystemError> { in getpid() 63 return Ok(current_pcb().pid as usize); in getpid()
|
D | c_adapter.rs | 19 pub extern "C" fn rs_process_copy_mm(clone_vm: bool, new_pcb: &mut process_control_block) -> usize { in rs_process_copy_mm() argument 22 .unwrap_or_else(|err| err.to_posix_errno() as usize); in rs_process_copy_mm() 83 return Box::leak(Box::new(FpState::default())) as *mut FpState as usize as *mut c_void; in rs_dup_fpstate() 86 let state = current_pcb().fp_state as usize as *mut FpState; in rs_dup_fpstate() 91 return state as *mut FpState as usize as *mut c_void; in rs_dup_fpstate() 100 let state = pcb.fp_state as usize as *mut FpState; in rs_process_exit_fpstate()
|
/DragonOS-0.1.8/kernel/src/sched/ |
D | rt.rs | 92 pub fn get_rt_queue_size(&mut self) -> usize { in get_rt_queue_size() argument 120 result.cpu_queue[cpu_id as usize].push(Box::leak(Box::new(RTQueue::new()))); in new() 137 let cpu_queue_i: &mut RTQueue = self.cpu_queue[cpu_id as usize][i as usize]; in pick_next_task_rt() 147 pub fn rt_queue_len(&mut self, cpu_id: u32) -> usize { in rt_queue_len() argument 150 sum += self.cpu_queue[cpu_id as usize][prio as usize].get_rt_queue_size(); in rt_queue_len() 152 return sum as usize; in rt_queue_len() 157 pub fn load_list_len(&mut self, cpu_id: u32) -> usize { in load_list_len() argument 158 return self.load_list[cpu_id as usize].len(); in load_list_len() 162 self.cpu_queue[pcb.cpu_id as usize][pcb.priority as usize].enqueue_front(pcb); in enqueue_front() 208 self.cpu_queue[cpu_id as usize][proc.cpu_id as usize].enqueue_front(proc); in sched() [all …]
|
/DragonOS-0.1.8/kernel/src/exception/ |
D | softirq.rs | 30 static mut __CPU_PENDING: Option<Box<[VecStatus; MAX_CPU_NUM as usize]>> = None; 42 __CPU_PENDING = Some(Box::new([VecStatus::default(); MAX_CPU_NUM as usize])); in softirq_init() 45 cpu_pending[i as usize] = VecStatus::default(); in softirq_init() 60 fn cpu_pending(cpu_id: usize) -> &'static mut VecStatus { in cpu_pending() 102 table: RwLock<[Option<Arc<dyn SoftirqVec>>; MAX_SOFTIRQ_NUM as usize]>, 106 let mut data: [MaybeUninit<Option<Arc<dyn SoftirqVec>>>; MAX_SOFTIRQ_NUM as usize] = in new() 110 data[i as usize] = MaybeUninit::new(None); in new() 113 let data: [Option<Arc<dyn SoftirqVec>>; MAX_SOFTIRQ_NUM as usize] = unsafe { in new() 114 mem::transmute::<_, [Option<Arc<dyn SoftirqVec>>; MAX_SOFTIRQ_NUM as usize]>(data) in new() 137 if table_guard[softirq_num as usize].is_some() { in register_softirq() [all …]
|
/DragonOS-0.1.8/kernel/src/filesystem/vfs/ |
D | mod.rs | 20 pub const MAX_PATHLEN: usize = 1024; 23 pub type InodeId = usize; 118 offset: usize, in read_at() argument 119 len: usize, in read_at() argument 122 ) -> Result<usize, SystemError>; in read_at() argument 135 offset: usize, in write_at() argument 136 len: usize, in write_at() argument 139 ) -> Result<usize, SystemError>; in write_at() argument 171 fn resize(&self, _len: usize) -> Result<(), SystemError> { in resize() 208 _data: usize, in create_with_data() argument [all …]
|
D | syscall.rs | 129 pub fn open(path: &str, mode: FileMode) -> Result<usize, SystemError> { in open() argument 132 if path.len() > PAGE_4K_SIZE as usize { in open() 184 let r = current_pcb().alloc_fd(file, None).map(|fd| fd as usize); in open() 194 pub fn close(fd: usize) -> Result<usize, SystemError> { in close() argument 206 pub fn read(fd: i32, buf: &mut [u8]) -> Result<usize, SystemError> { in read() argument 224 pub fn write(fd: i32, buf: &[u8]) -> Result<usize, SystemError> { in write() argument 242 pub fn lseek(fd: i32, seek: SeekFrom) -> Result<usize, SystemError> { in lseek() argument 274 pub fn chdir(dest_path: &str) -> Result<usize, SystemError> { in chdir() argument 308 pub fn getdents(fd: i32, buf: &mut [u8]) -> Result<usize, SystemError> { in getdents() argument 325 return file.readdir(dirent).map(|x| x as usize); in getdents() [all …]
|
/DragonOS-0.1.8/kernel/src/net/ |
D | syscall.rs | 31 address_family: usize, in socket() argument 32 socket_type: usize, in socket() argument 33 protocol: usize, in socket() argument 34 ) -> Result<usize, SystemError> { in socket() argument 62 let fd = current_pcb().alloc_fd(f, None).map(|x| x as usize); in socket() 75 fd: usize, in setsockopt() argument 76 level: usize, in setsockopt() argument 77 optname: usize, in setsockopt() argument 79 ) -> Result<usize, SystemError> { in setsockopt() argument 98 fd: usize, in getsockopt() argument [all …]
|
D | mod.rs | 20 …pub static ref NET_DRIVERS: RwLock<BTreeMap<usize, Arc<dyn NetDriver>>> = RwLock::new(BTreeMap::ne… 24 pub fn generate_iface_id() -> usize { in generate_iface_id() 72 fn read(&self, buf: &mut [u8]) -> (Result<usize, SystemError>, Endpoint); in read() argument 80 fn write(&self, buf: &[u8], to: Option<Endpoint>) -> Result<usize, SystemError>; in write() argument 121 fn listen(&mut self, _backlog: usize) -> Result<(), SystemError> { in listen() 173 _cmd: usize, in ioctl() argument 174 _arg0: usize, in ioctl() argument 175 _arg1: usize, in ioctl() argument 176 _arg2: usize, in ioctl() argument 177 ) -> Result<usize, SystemError> { in ioctl() argument [all …]
|
/DragonOS-0.1.8/kernel/src/arch/x86_64/mm/ |
D | mod.rs | 51 static KERNEL_PML4E_NO: usize = (X86_64MMArch::PHYS_OFFSET & ((1 << 48) - 1)) >> 39; 57 kernel_code_start: usize, 58 kernel_code_end: usize, 59 kernel_data_end: usize, 60 kernel_rodata_end: usize, 61 start_brk: usize, 84 const PAGE_SHIFT: usize = 12; 87 const PAGE_ENTRY_SHIFT: usize = 9; 90 const PAGE_LEVELS: usize = 4; 95 const ENTRY_ADDRESS_SHIFT: usize = 52; [all …]
|
/DragonOS-0.1.8/kernel/src/smp/ |
D | c_adapter.rs | 4 pub extern "C" fn rs_kick_cpu(cpu_id: usize) -> usize { in rs_kick_cpu() argument 7 .unwrap_or_else(|e| e.to_posix_errno() as usize); in rs_kick_cpu()
|
/DragonOS-0.1.8/kernel/src/ipc/ |
D | pipe.rs | 17 const PIPE_BUFF_SIZE: usize = 1024; 77 _offset: usize, in read_at() argument 78 len: usize, in read_at() argument 81 ) -> Result<usize, crate::syscall::SystemError> { in read_at() argument 104 let mut num = inode.valid_cnt as usize; in read_at() 106 let start = inode.read_pos as usize; in read_at() 108 let mut end = (inode.valid_cnt as usize + inode.read_pos as usize) % PIPE_BUFF_SIZE; in read_at() 110 if len < inode.valid_cnt as usize { in read_at() 111 end = (len + inode.read_pos as usize) % PIPE_BUFF_SIZE; in read_at() 156 _offset: usize, in write_at() argument [all …]
|
/DragonOS-0.1.8/kernel/src/arch/x86_64/asm/ |
D | irqflags.rs | 4 pub fn local_irq_save() -> usize { in local_irq_save() 5 let x: usize; in local_irq_save() 15 pub fn local_irq_restore(x: usize) { in local_irq_restore() argument
|
/DragonOS-0.1.8/kernel/src/driver/disk/ahci/ |
D | ahcidisk.rs | 56 count: usize, // 读取lba的数量 in read_at() argument 58 ) -> Result<usize, SystemError> { in read_at() argument 61 if count * 512 > buf.len() || check_length > u16::MAX as usize { in read_at() 81 volatile_read!(port.clb) as usize in read_at() 82 + slot as usize * size_of::<HbaCmdHeader>() as usize, in read_at() 98 let mut buf_ptr = buf as *mut [u8] as *mut usize as usize; in read_at() 118 buf_ptr = kbuf.as_mut().unwrap().as_mut_ptr() as usize; in read_at() 123 (phys_2_virt(volatile_read!(cmdheader.ctba) as usize) as *mut HbaCmdTable) in read_at() 135 for i in 0..((volatile_read!(cmdheader.prdtl) - 1) as usize) { in read_at() 144 let las = (volatile_read!(cmdheader.prdtl) - 1) as usize; in read_at() [all …]
|
/DragonOS-0.1.8/kernel/src/driver/tty/ |
D | mod.rs | 67 BufferFull(usize), 69 BufferEmpty(usize), 73 EOF(usize), 79 pub const STDIN_BUF_SIZE: usize = 4096; 80 pub const OUTPUT_BUF_SIZE: usize = 4096; 105 pub fn input(&self, buf: &[u8], block: bool) -> Result<usize, TtyError> { in input() argument 122 pub fn output(&self, buf: &mut [u8], block: bool) -> Result<usize, TtyError> { in output() argument 133 pub fn stdout(&self, buf: &[u8], block: bool) -> Result<usize, TtyError> { in stdout() argument 144 pub fn stderr(&self, buf: &[u8], block: bool) -> Result<usize, TtyError> { in stderr() argument 155 pub fn read_stdin(&self, buf: &mut [u8], block: bool) -> Result<usize, TtyError> { in read_stdin() argument [all …]
|
/DragonOS-0.1.8/kernel/src/arch/x86_64/ |
D | syscall.rs | 39 let syscall_num = regs.rax as usize; in syscall_handler() 41 regs.r8 as usize, in syscall_handler() 42 regs.r9 as usize, in syscall_handler() 43 regs.r10 as usize, in syscall_handler() 44 regs.r11 as usize, in syscall_handler() 45 regs.r12 as usize, in syscall_handler() 46 regs.r13 as usize, in syscall_handler() 47 regs.r14 as usize, in syscall_handler() 48 regs.r15 as usize, in syscall_handler() 132 ) -> usize { in rs_do_execve() argument [all …]
|