/DragonOS/kernel/src/arch/x86_64/syscall/ |
H A D | nr.rs | 4 pub const SYS__SYSCTL: usize = 156; 5 pub const SYS_ACCEPT: usize = 43; 6 pub const SYS_ACCEPT4: usize = 288; 7 pub const SYS_ACCESS: usize = 21; 8 pub const SYS_ACCT: usize = 163; 9 pub const SYS_ADD_KEY: usize = 248; 10 pub const SYS_ADJTIMEX: usize = 159; 11 pub const SYS_AFS_SYSCALL: usize = 183; 12 pub const SYS_ALARM: usize = 37; 13 pub const SYS_ARCH_PRCTL: usize = 158; [all …]
|
/DragonOS/kernel/src/arch/riscv64/syscall/ |
H A D | nr.rs | 3 pub const SYS_ACCEPT: usize = 202; 4 pub const SYS_ACCEPT4: usize = 242; 5 pub const SYS_ACCT: usize = 89; 6 pub const SYS_ADD_KEY: usize = 217; 7 pub const SYS_ADJTIMEX: usize = 171; 8 pub const SYS_ARCH_SPECIFIC_SYSCALL: usize = 244; 9 pub const SYS_BIND: usize = 200; 10 pub const SYS_BPF: usize = 280; 11 pub const SYS_BRK: usize = 214; 12 pub const SYS_CAPGET: usize = 90; [all …]
|
/DragonOS/kernel/src/arch/x86_64/interrupt/ |
H A D | entry.rs | 7 static mut IDT_Table: [usize; 0usize]; 297 set_intr_gate(32, 0, VirtAddr::new(irq_handler32 as usize)); in arch_setup_interrupt_gate() 298 set_intr_gate(33, 0, VirtAddr::new(irq_handler33 as usize)); in arch_setup_interrupt_gate() 299 set_intr_gate(34, 0, VirtAddr::new(irq_handler34 as usize)); in arch_setup_interrupt_gate() 300 set_intr_gate(35, 0, VirtAddr::new(irq_handler35 as usize)); in arch_setup_interrupt_gate() 301 set_intr_gate(36, 0, VirtAddr::new(irq_handler36 as usize)); in arch_setup_interrupt_gate() 302 set_intr_gate(37, 0, VirtAddr::new(irq_handler37 as usize)); in arch_setup_interrupt_gate() 303 set_intr_gate(38, 0, VirtAddr::new(irq_handler38 as usize)); in arch_setup_interrupt_gate() 304 set_intr_gate(39, 0, VirtAddr::new(irq_handler39 as usize)); in arch_setup_interrupt_gate() 305 set_intr_gate(40, 0, VirtAddr::new(irq_handler40 as usize)); in arch_setup_interrupt_gate() [all …]
|
/DragonOS/kernel/crates/bitmap/src/ |
H A D | traits.rs | 7 fn get(bits: &Self, index: usize) -> bool; in get() 8 fn set(bits: &mut Self, index: usize, value: bool) -> bool; in set() argument 10 fn len(bits: &Self) -> usize; in len() argument 11 fn first_index(bits: &Self) -> Option<usize>; in first_index() argument 12 fn first_false_index(bits: &Self) -> Option<usize>; in first_false_index() argument 13 fn last_index(bits: &Self) -> Option<usize>; in last_index() argument 14 fn last_false_index(bits: &Self) -> Option<usize>; in last_false_index() argument 15 fn next_index(bits: &Self, index: usize) -> Option<usize>; in next_index() argument 16 fn next_false_index(bits: &Self, index: usize) -> Option<usize>; in next_false_index() argument 17 fn prev_index(bits: &Self, index: usize) -> Option<usize>; in prev_index() argument [all …]
|
H A D | static_bitmap.rs | 9 pub struct StaticBitmap<const N: usize> 11 [(); N.div_ceil(usize::BITS as usize)]:, 13 pub data: [usize; N.div_ceil(usize::BITS as usize)], 14 core: BitMapCore<usize>, 17 impl<const N: usize> Default for StaticBitmap<N> 19 [(); N.div_ceil(usize::BITS as usize)]:, 26 impl<const N: usize> StaticBitmap<N> 28 [(); N.div_ceil(usize::BITS as usize)]:, 33 data: [0; N.div_ceil(usize::BITS as usize)], in new() 39 impl<const N: usize> BitMapOps<usize> for StaticBitmap<N> [all …]
|
H A D | alloc_bitmap.rs | 9 elements: usize, 10 data: Vec<usize>, 11 core: BitMapCore<usize>, 15 pub fn new(elements: usize) -> Self { in new() 16 let data = vec![0usize; elements.div_ceil(usize::BITS as usize)]; in new() 31 impl BitMapOps<usize> for AllocBitmap { 33 fn get(&self, index: usize) -> Option<bool> { in get() 38 fn set(&mut self, index: usize, value: bool) -> Option<bool> { in set() argument 43 fn len(&self) -> usize { in len() argument 48 fn size(&self) -> usize { in size() argument [all …]
|
/DragonOS/kernel/src/arch/riscv64/ |
H A D | kprobe.rs | 3 pub fn setup_single_step(frame: &mut TrapFrame, step_addr: usize) { in setup_single_step() argument 7 pub fn clear_single_step(frame: &mut TrapFrame, return_addr: usize) { in clear_single_step() argument 14 pub pc: usize, 15 pub ra: usize, 16 pub sp: usize, 17 pub gp: usize, 18 pub tp: usize, 19 pub t0: usize, 20 pub t1: usize, 21 pub t2: usize, [all …]
|
/DragonOS/kernel/src/arch/riscv64/interrupt/ |
H A D | mod.rs | 70 pub epc: usize, 71 pub ra: usize, 72 pub sp: usize, 73 pub gp: usize, 74 pub tp: usize, 75 pub t0: usize, 76 pub t1: usize, 77 pub t2: usize, 78 pub s0: usize, 79 pub s1: usize, [all …]
|
/DragonOS/kernel/src/mm/ |
H A D | mod.rs | 44 pub struct VmFlags:usize{ 100 pub struct MsFlags:usize { 107 impl core::ops::Index<VmFlags> for [usize] { implementation 108 type Output = usize; 115 impl core::ops::IndexMut<VmFlags> for [usize] { implementation 160 pub struct PhysAddr(usize); 164 pub const MAX: Self = PhysAddr(usize::MAX); 167 pub const fn new(address: usize) -> Self { in new() 173 pub const fn data(&self) -> usize { in data() argument 179 pub fn add(self, offset: usize) -> Self { in add() [all …]
|
H A D | c_adapter.rs | 16 …static ref C_ALLOCATION_MAP: SpinLock<HashMap<VirtAddr, (VirtAddr, usize, usize)>> = SpinLock::new… 20 pub unsafe extern "C" fn kzalloc(size: usize, _gfp: u64) -> usize { in kzalloc() argument 26 pub unsafe extern "C" fn kmalloc(size: usize, _gfp: u64) -> usize { in kmalloc() argument 32 fn do_kmalloc(size: usize, _zero: bool) -> usize { in do_kmalloc() argument 38 let vaddr = VirtAddr::new(ptr as usize); in do_kmalloc() 54 return SystemError::ENOMEM.to_posix_errno() as i64 as usize; in do_kmalloc() 59 pub unsafe extern "C" fn kfree(vaddr: usize) -> usize { in kfree() argument 67 return SystemError::EINVAL.to_posix_errno() as i64 as usize; in kfree() 93 let r = mmio_pool().create_mmio(size as usize); in rs_mmio_create() 117 .release_mmio(VirtAddr::new(vaddr as usize), length as usize) in rs_mmio_release()
|
/DragonOS/kernel/src/arch/riscv64/asm/ |
H A D | csr.rs | 2 pub const CSR_SSTATUS: usize = 0x100; 3 pub const CSR_SSCRATCH: usize = 0x140; 4 pub const CSR_SEPC: usize = 0x141; 5 pub const CSR_SCAUSE: usize = 0x142; 6 pub const CSR_STVAL: usize = 0x143; 11 pub const SR_SPP: usize = 0x00000100; 13 pub const SR_SUM: usize = 0x00040000; 16 pub const SR_FS: usize = 0x00006000; 18 pub const SR_VS: usize = 0x00000600; 21 pub const SR_FS_VS: usize = SR_FS | SR_VS;
|
/DragonOS/kernel/src/arch/x86_64/init/pvh/ |
H A D | param.rs | 212 unsafe { ::std::ptr::addr_of!((*ptr).magic) as usize - ptr as usize }, in bindgen_test_layout_hvm_start_info() 222 unsafe { ::std::ptr::addr_of!((*ptr).version) as usize - ptr as usize }, in bindgen_test_layout_hvm_start_info() 232 unsafe { ::std::ptr::addr_of!((*ptr).flags) as usize - ptr as usize }, in bindgen_test_layout_hvm_start_info() 242 unsafe { ::std::ptr::addr_of!((*ptr).nr_modules) as usize - ptr as usize }, in bindgen_test_layout_hvm_start_info() 252 unsafe { ::std::ptr::addr_of!((*ptr).modlist_paddr) as usize - ptr as usize }, in bindgen_test_layout_hvm_start_info() 262 unsafe { ::std::ptr::addr_of!((*ptr).cmdline_paddr) as usize - ptr as usize }, in bindgen_test_layout_hvm_start_info() 272 unsafe { ::std::ptr::addr_of!((*ptr).rsdp_paddr) as usize - ptr as usize }, in bindgen_test_layout_hvm_start_info() 282 unsafe { ::std::ptr::addr_of!((*ptr).memmap_paddr) as usize - ptr as usize }, in bindgen_test_layout_hvm_start_info() 292 unsafe { ::std::ptr::addr_of!((*ptr).memmap_entries) as usize - ptr as usize }, in bindgen_test_layout_hvm_start_info() 302 unsafe { ::std::ptr::addr_of!((*ptr).reserved) as usize - ptr as usize }, in bindgen_test_layout_hvm_start_info() [all …]
|
/DragonOS/kernel/src/libs/ |
H A D | align.rs | 18 pub struct AlignedBox<T, const ALIGN: usize> { 22 impl<T, const ALIGN: usize> AlignedBox<T, ALIGN> { 24 const fn max(a: usize, b: usize) -> usize { in max() argument 70 impl<T, const ALIGN: usize> Debug for AlignedBox<T, ALIGN> { 83 impl<T, const ALIGN: usize> Drop for AlignedBox<T, ALIGN> { 94 impl<T, const ALIGN: usize> core::ops::Deref for AlignedBox<T, ALIGN> { 102 impl<T, const ALIGN: usize> core::ops::DerefMut for AlignedBox<T, ALIGN> { 108 impl<T: Clone + SafeForZero, const ALIGN: usize> Clone for AlignedBox<T, ALIGN> { 126 unsafe impl<const NUM: usize> SafeForZero for [u8; NUM] {} 133 pub const fn page_align_up(addr: usize) -> usize { in page_align_up() argument [all …]
|
/DragonOS/kernel/src/process/ |
H A D | resource.rs | 18 pub ru_maxrss: usize, 20 pub ru_ixrss: usize, 22 pub ru_idrss: usize, 24 pub ru_isrss: usize, 26 pub ru_minflt: usize, 28 pub ru_majflt: usize, 30 pub ru_nswap: usize, 32 pub ru_inblock: usize, 34 pub ru_oublock: usize, 36 pub ru_msgsnd: usize, [all …]
|
/DragonOS/kernel/src/ipc/ |
H A D | shm.rs | 46 int_like!(ShmId, usize); 47 int_like!(ShmKey, usize); 91 impl From<usize> for ShmCtlCmd { 92 fn from(cmd: usize) -> ShmCtlCmd { in from() 110 *self as usize == *other as usize in eq() 128 id_allocator: IdAllocator::new(0, usize::MAX - 1).unwrap(), in new() 149 size: usize, in add() argument 151 ) -> Result<usize, SystemError> { in add() argument 213 pub fn ipc_info(&self, user_buf: *const u8, from_user: bool) -> Result<usize, SystemError> { in ipc_info() argument 226 pub fn shm_info(&self, user_buf: *const u8, from_user: bool) -> Result<usize, SystemError> { in shm_info() argument [all …]
|
/DragonOS/kernel/src/arch/x86_64/process/ |
H A D | syscall.rs | 56 pub fn arch_prctl(option: usize, arg2: usize) -> Result<usize, SystemError> { in arch_prctl() argument 67 option: usize, in do_arch_prctl_64() argument 68 arg2: usize, in do_arch_prctl_64() argument 70 ) -> Result<usize, SystemError> { in do_arch_prctl_64() argument 76 arg2 as *mut usize, in do_arch_prctl_64() 77 core::mem::size_of::<usize>(), in do_arch_prctl_64() 85 arg2 as *mut usize, in do_arch_prctl_64() 86 core::mem::size_of::<usize>(), in do_arch_prctl_64() 112 pub fn do_arch_prctl_common(_option: usize, _arg2: usize) -> Result<usize, SystemError> { in do_arch_prctl_common() argument 117 pub const ARCH_SET_GS: usize = 0x1001; [all …]
|
/DragonOS/kernel/src/arch/x86_64/ |
H A D | time.rs | 16 fn get_cycles() -> usize { in get_cycles() 17 unsafe { x86::time::rdtsc() as usize } in get_cycles() 20 fn cal_expire_cycles(ns: usize) -> usize { in cal_expire_cycles() argument 21 Self::get_cycles() + ns * TSCManager::cpu_khz() as usize / 1000000 in cal_expire_cycles() 26 fn cycles2ns(cycles: usize) -> usize { in cycles2ns() argument 27 cycles * 1000000 / TSCManager::cpu_khz() as usize in cycles2ns()
|
/DragonOS/kernel/src/driver/base/block/ |
H A D | block_device.rs | 32 pub type BlockId = usize; 37 pub const LBA_SIZE: usize = 512; 41 pub lba_start: usize, 42 pub lba_end: usize, 46 pub fn new(lba_start: usize, lba_end: usize) -> Option<Self> { in new() argument 54 pub fn len(&self) -> usize { in len() argument 63 let start = usize::max(self.lba_start, rhs.lba_start); in intersects_with() 64 let end = usize::min(self.lba_end, rhs.lba_end); in intersects_with() 78 pub begin: usize, // 迭代器的起始位置 -> 块设备的地址 (单位是字节) 79 pub end: usize, [all …]
|
/DragonOS/kernel/src/arch/x86_64/init/ |
H A D | mod.rs | 39 static mut GDT_Table: [usize; 0usize]; 40 static mut IDT_Table: [usize; 0usize]; 54 let mut gdtp = DescriptorTablePointer::<usize>::default(); in kernel_main() 56 MMArch::phys_2_virt(PhysAddr::new(&GDT_Table as *const usize as usize)).unwrap(); in kernel_main() constant 58 MMArch::phys_2_virt(PhysAddr::new(&IDT_Table as *const usize as usize)).unwrap(); in kernel_main() constant 59 gdtp.base = gdt_vaddr.data() as *const usize; in kernel_main() constant 62 let idtp = DescriptorTablePointer::<usize> { in kernel_main() 63 base: idt_vaddr.data() as *const usize, in kernel_main() constant 85 let stack_start = unsafe { *(head_stack_start as *const u64) } as usize; in early_setup_arch() 89 MMArch::phys_2_virt(PhysAddr::new(&GDT_Table as *const usize as usize)).unwrap(); in early_setup_arch() constant [all …]
|
/DragonOS/kernel/src/driver/block/cache/ |
H A D | cache_iter.rs | 12 _block_size: usize, 16 pub fn new(lba_id: BlockId, data_start_addr: BlockId, block_size: usize) -> Self { in new() 32 pub fn _block_size(&self) -> usize { in _block_size() argument 44 count: usize, 46 current: usize, 48 block_size: usize, 52 pub fn new(lba_id_start: BlockId, count: usize, block_size: usize) -> Self { in new() argument 86 index: usize, 90 pub fn new(lba_id: BlockId, index: usize) -> Self { in new() 99 pub fn index(&self) -> usize { in index() argument
|
/DragonOS/kernel/src/perf/ |
H A D | bpf.rs | 20 const PAGE_SIZE: usize = MMArch::PAGE_SIZE; 32 offset: usize, 37 size: usize, 38 ptr: usize, 39 data_region_size: usize, 40 lost: usize, 55 pub fn new_init(start: usize, len: usize, phys_addr: PhysAddr) -> Self { in new_init() argument 59 fn init(ptr: *mut u8, size: usize, phys_addr: PhysAddr) -> Self { in init() argument 74 ptr: ptr as usize, in init() 82 fn can_write(&self, data_size: usize, data_tail: usize, data_head: usize) -> bool { in can_write() argument [all …]
|
/DragonOS/kernel/src/driver/tty/ |
H A D | console.rs | 34 sy: usize, in con_clear() argument 35 sx: usize, in con_clear() argument 36 height: usize, in con_clear() argument 37 width: usize, in con_clear() argument 65 count: usize, in con_putcs() argument 76 _pos: usize, in con_getxy() argument 77 ) -> Result<(usize, usize, usize), SystemError> { in con_getxy() argument 129 top: usize, in con_scroll() argument 130 bottom: usize, in con_scroll() argument 132 nr: usize, in con_scroll() argument
|
/DragonOS/kernel/src/arch/x86_64/mm/ |
H A D | mod.rs | 52 kernel_load_base_paddr: usize, 53 kernel_code_start: usize, 54 kernel_code_end: usize, 55 kernel_data_end: usize, 56 kernel_rodata_end: usize, 57 start_brk: usize, 79 const PAGE_SHIFT: usize = 12; 82 const PAGE_ENTRY_SHIFT: usize = 9; 85 const PAGE_LEVELS: usize = 4; 90 const ENTRY_ADDRESS_SHIFT: usize = 52; [all …]
|
/DragonOS/kernel/src/arch/riscv64/mm/ |
H A D | mod.rs | 50 size: usize, in remote_invalidate_page() argument 83 const KERNEL_TOP_PAGE_ENTRY_NO: usize = (RiscV64MMArch::PHYS_OFFSET 91 const PAGE_SHIFT: usize = 12; 93 const PAGE_ENTRY_SHIFT: usize = 9; 96 const PAGE_LEVELS: usize = 3; 98 const ENTRY_ADDRESS_SHIFT: usize = 39; 100 const ENTRY_FLAG_DEFAULT_PAGE: usize = Self::ENTRY_FLAG_PRESENT 106 const ENTRY_FLAG_DEFAULT_TABLE: usize = Self::ENTRY_FLAG_PRESENT; 108 const ENTRY_FLAG_PRESENT: usize = 1 << 0; 110 const ENTRY_FLAG_READONLY: usize = (1 << 1); [all …]
|
/DragonOS/kernel/src/driver/video/console/ |
H A D | dummycon.rs | 27 pub const COLUNMS: usize = 80; 28 pub const ROWS: usize = 25; 38 _pos: usize, in con_getxy() argument 39 ) -> Result<(usize, usize, usize), SystemError> { in con_getxy() argument 84 _sy: usize, in con_clear() argument 85 _sx: usize, in con_clear() argument 86 _height: usize, in con_clear() argument 87 _width: usize, in con_clear() argument 106 _count: usize, in con_putcs() argument 128 _top: usize, in con_scroll() argument [all …]
|