/DragonOS/kernel/crates/rbpf/src/ |
H A D | helpers.rs | 47 pub fn bpf_time_getns(unused1: u64, unused2: u64, unused3: u64, unused4: u64, unused5: u64) -> u64 { in bpf_time_getns() argument 95 pub fn bpf_trace_printf(unused1: u64, unused2: u64, arg3: u64, arg4: u64, arg5: u64) -> u64 { in bpf_trace_printf() argument 101 (x as f64).log(16.0).floor() as u64 + 1 in bpf_trace_printf() 104 "bpf_trace_printf: 0x, 0x, 0x\n".len() as u64 + size_arg(arg3) + size_arg(arg4) + size_arg(arg5) in bpf_trace_printf() 120 pub fn gather_bytes(arg1: u64, arg2: u64, arg3: u64, arg4: u64, arg5: u64) -> u64 { in gather_bytes() argument 146 pub fn memfrob(ptr: u64, len: u64, unused3: u64, unused4: u64, unused5: u64) -> u64 { in memfrob() argument 191 pub fn sqrti(arg1: u64, unused2: u64, unused3: u64, unused4: u64, unused5: u64) -> u64 { in sqrti() argument 192 (arg1 as f64).sqrt() as u64 in sqrti() 210 pub fn strcmp(arg1: u64, arg2: u64, arg3: u64, unused4: u64, unused5: u64) -> u64 { in strcmp() argument 213 return u64::MAX; in strcmp() [all …]
|
H A D | interpreter.rs | 18 addr: u64, in check_mem() argument 35 mbuff.as_ptr() as u64, in check_mem() 37 mem.as_ptr() as u64, in check_mem() 39 stack.as_ptr() as u64, in check_mem() 47 addr: u64, in check_mem() argument 55 if let Some(addr_end) = addr.checked_add(len as u64) { in check_mem() 56 if mbuff.as_ptr() as u64 <= addr && addr_end <= mbuff.as_ptr() as u64 + mbuff.len() as u64 { in check_mem() 59 if mem.as_ptr() as u64 <= addr && addr_end <= mem.as_ptr() as u64 + mem.len() as u64 { in check_mem() 62 if stack.as_ptr() as u64 <= addr && addr_end <= stack.as_ptr() as u64 + stack.len() as u64 { in check_mem() 70 mbuff.as_ptr() as u64, mbuff.len(), in check_mem() [all …]
|
H A D | lib.rs | 72 pub type Helper = fn(u64, u64, u64, u64, u64) -> u64; 298 pub fn execute_program(&self, mem: &[u8], mbuff: &[u8]) -> Result<u64, Error> { in execute_program() argument 391 ) -> Result<u64, Error> { in execute_program_jit() argument 502 ) -> Result<u64, Error> { in execute_program_cranelift() argument 763 function: fn(u64, u64, u64, u64, u64) -> u64, in register_helper() argument 798 pub fn execute_program(&mut self, mem: &'a mut [u8]) -> Result<u64, Error> { in execute_program() argument 807 mem.as_ptr() as u64, in execute_program() 811 mem.as_ptr() as u64 + mem.len() as u64, in execute_program() 901 pub unsafe fn execute_program_jit(&mut self, mem: &'a mut [u8]) -> Result<u64, Error> { in execute_program_jit() argument 1003 pub fn execute_program_cranelift(&mut self, mem: &'a mut [u8]) -> Result<u64, Error> { in execute_program_cranelift() argument [all …]
|
/DragonOS/kernel/src/arch/x86_64/driver/ |
H A D | tsc.rs | 19 static mut TSC_KHZ: u64 = 0; 20 static mut CPU_KHZ: u64 = 0; 23 const DEFAULT_THRESHOLD: u64 = 0x20000; 103 fn calibrate_cpu_by_pit_hpet_ptimer() -> Result<u64, SystemError> { in calibrate_cpu_by_pit_hpet_ptimer() 110 let mut tsc_pit_min = u64::MAX; in calibrate_cpu_by_pit_hpet_ptimer() 111 let mut tsc_ref_min = u64::MAX; in calibrate_cpu_by_pit_hpet_ptimer() 134 let tsc_pit_khz = Self::pit_calibrate_tsc(latch, ms, loopmin).unwrap_or(u64::MAX); in calibrate_cpu_by_pit_hpet_ptimer() 151 if tsc1 == u64::MAX || tsc2 == u64::MAX { in calibrate_cpu_by_pit_hpet_ptimer() 180 if i == 1 && tsc_pit_min == u64::MAX { in calibrate_cpu_by_pit_hpet_ptimer() 187 if tsc_pit_min == u64::MAX { in calibrate_cpu_by_pit_hpet_ptimer() [all …]
|
/DragonOS/kernel/src/driver/timers/hpet/ |
H A D | mod.rs | 9 _reserved0: Volatile<u64>, 10 general_config: Volatile<u64>, 11 _reserved1: Volatile<u64>, 12 general_intr_status: Volatile<u64>, 13 _reserved2: [Volatile<u64>; 25], 14 main_counter_value: Volatile<u64>, 15 _reserved3: Volatile<u64>, 28 pub fn counter_clock_period(&self) -> u64 { in counter_clock_period() argument 31 period as u64 in counter_clock_period() 35 pub fn frequency(&self) -> u64 { in frequency() argument [all …]
|
/DragonOS/kernel/src/sched/ |
H A D | cputime.rs | 11 pub fn irq_time_read(cpu: usize) -> u64 { in irq_time_read() argument 31 pub total: u64, 32 pub tick_delta: u64, 33 pub irq_start_time: u64, 38 pub fn account_delta(&mut self, delta: u64) { in account_delta() argument 45 pub fn irqtime_tick_accounted(&mut self, max: u64) -> u64 { in irqtime_tick_accounted() argument 55 irq_time.irq_start_time = SchedClock::sched_clock_cpu(cpu) as u64; in irqtime_start() 64 let delta = SchedClock::sched_clock_cpu(cpu) as u64 - irq_time.irq_start_time; in irqtime_account_irq() 77 ticks: u64, in irqtime_account_process_tick() argument 79 let cputime = TICK_NESC as u64 * ticks; in irqtime_account_process_tick() [all …]
|
H A D | pelt.rs | 19 pub const LOAD_AVG_PERIOD: u64 = 32; 26 pub last_update_time: u64, 28 pub load_sum: u64, 30 pub runnable_sum: u64, 32 pub util_sum: u64, 49 now: u64, in update_load_sum() argument 78 mut delta: u64, in accumulate_sum() argument 82 ) -> u64 { in accumulate_sum() argument 85 delta += self.period_contrib as u64; in accumulate_sum() 107 self.load_sum += (contrib * load) as u64; in accumulate_sum() [all …]
|
/DragonOS/kernel/src/arch/x86_64/init/ |
H A D | boot.rs | 7 const BOOT_ENTRY_TYPE_MULTIBOOT: u64 = 1; 8 const BOOT_ENTRY_TYPE_MULTIBOOT2: u64 = 2; 9 const BOOT_ENTRY_TYPE_LINUX_32: u64 = 3; 10 const BOOT_ENTRY_TYPE_LINUX_64: u64 = 4; 11 const BOOT_ENTRY_TYPE_LINUX_32_PVH: u64 = 5; 14 #[repr(u64)] 23 impl TryFrom<u64> for BootProtocol { 26 fn try_from(value: u64) -> Result<Self, Self::Error> { in try_from() 40 boot_entry_type: u64, in early_boot_init() argument 41 arg1: u64, in early_boot_init() argument [all …]
|
/DragonOS/kernel/src/virt/kvm/ |
H A D | host_mem.rs | 50 pub guest_phys_addr: u64, // 虚机内存区间起始物理地址 51 pub memory_size: u64, // 虚机内存区间大小 52 pub userspace_addr: u64, // 虚机内存区间对应的主机虚拟地址 57 pub base_gfn: u64, // 虚机内存区间起始物理页框号 58 pub npages: u64, // 虚机内存区间页数,即内存区间的大小 59 pub userspace_addr: u64, // 虚机内存区间对应的主机虚拟地址 87 fn __gfn_to_memslot(slots: KvmMemorySlots, gfn: u64) -> Option<KvmMemorySlot> { in __gfn_to_memslot() 99 fn __gfn_to_hva(slot: KvmMemorySlot, gfn: u64) -> u64 { in __gfn_to_hva() argument 100 return slot.userspace_addr + (gfn - slot.base_gfn) * (PAGE_SIZE as u64); in __gfn_to_hva() 104 gfn: u64, in __gfn_to_hva_many() argument [all …]
|
/DragonOS/kernel/src/include/bindings/ |
H A D | linux_bpf.rs | 49 pub fn get(&self, bit_offset: usize, bit_width: u8) -> u64 { in get() argument 67 pub fn set(&mut self, bit_offset: usize, bit_width: u8, val: u64) { in set() argument 206 self._bitfield_1.set(0usize, 4u8, val as u64) in set_dst_reg() 217 self._bitfield_1.set(4usize, 4u8, val as u64) in set_src_reg() 225 dst_reg as u64 229 src_reg as u64 1023 self._bitfield_1.set(0usize, 1u8, val as u64) in set_gpl_compatible() 1031 gpl_compatible as u64 1565 unsafe { ::core::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u64) } in disabled() 1570 let val: u64 = ::core::mem::transmute(val); in set_disabled() [all …]
|
/DragonOS/kernel/src/bpf/helper/ |
H A D | print.rs | 23 pub fn trace_printf(fmt_ptr: u64, _fmt_len: u64, arg3: u64, arg4: u64, arg5: u64) -> u64 { in trace_printf() argument 24 unsafe { printf(&mut TerminalOut, fmt_ptr as _, arg3, arg4, arg5) as u64 } in trace_printf()
|
/DragonOS/kernel/src/arch/x86_64/kvm/vmx/ |
H A D | vmexit.rs | 68 interrupt_info as u64, in vmexit_vmx_instruction_executed() 71 …let rflags: u64 = vmx_vmread(VmcsFields::GUEST_RFLAGS as u32).unwrap() | 0x0001_0000; // set RF fl… in vmexit_vmx_instruction_executed() 132 pub r15: u64, 133 pub r14: u64, 134 pub r13: u64, 135 pub r12: u64, 136 pub r11: u64, 137 pub r10: u64, 138 pub r9: u64, 139 pub r8: u64, [all …]
|
H A D | mmu.rs | 57 fn(vcpu: &mut VmxVcpu, gpa: u64, error_code: u32, prefault: bool) -> Result<(), SystemError>; 60 pub root_hpa: u64, 64 pub get_cr3: Option<fn(&VmxVcpu) -> u64>, 65 pub set_eptp: Option<fn(u64) -> Result<(), SystemError>>, 86 fn tdp_get_cr3(_vcpu: &VmxVcpu) -> u64 { in tdp_get_cr3() argument 91 fn tdp_set_eptp(root_hpa: u64) -> Result<(), SystemError> { in tdp_set_eptp() 97 eptp |= root_hpa & (PAGE_MASK as u64); in tdp_set_eptp() 104 gpa: u64, in tdp_page_fault() argument 206 gpa: u64, in __direct_map() argument 210 _gfn: u64, in __direct_map() argument [all …]
|
/DragonOS/kernel/src/syscall/ |
H A D | misc.rs | 19 uptime: u64, 20 loads: [u64; 3], 21 totalram: u64, 22 freeram: u64, 23 sharedram: u64, 24 bufferram: u64, 25 totalswap: u64, 26 freeswap: u64, 29 totalhigh: u64, 30 freehigh: u64, [all …]
|
/DragonOS/kernel/crates/intertrait/src/ |
H A D | hasher.rs | 7 pub struct FastHasher(u64); 13 fn finish(&self) -> u64 { in finish() argument 19 while bytes.len() > size_of::<u64>() { in write() 20 let (u64_bytes, remaining) = bytes.split_at(size_of::<u64>()); in write() 21 self.0 ^= u64::from_ne_bytes(u64_bytes.try_into().unwrap()); in write() 26 .fold(0u64, |result, b| (result << 8) | *b as u64); in write()
|
/DragonOS/kernel/crates/crc/src/tables/ |
H A D | crc64.rs | 5 pub table: [u64; 256], 6 pub poly: u64, 10 pub const fn new(poly: u64, table: [u64; 256]) -> Self { in new() argument 16 type Target = [u64; 256];
|
/DragonOS/user/apps/test_statx/src/ |
H A D | main.rs | 10 pub stx_attributes: u64, 16 pub stx_ino: u64, 17 pub stx_size: u64, 18 pub stx_blocks: u64, 19 pub stx_attributes_mask: u64, 28 pub stx_mnt_id: u64, 31 __statx_pad3: [u64; 12],
|
/DragonOS/kernel/src/driver/base/block/ |
H A D | disk_info.rs | 7 pub type SectorT = u64; 13 pub lba_start: u64, // 起始LBA号 14 pub sectors_num: u64, // 该分区的扇区数 24 lba_start: u64, in new() argument 25 sectors_num: u64, in new() argument 38 pub fn new_raw(start_sector: SectorT, lba_start: u64, sectors_num: u64, partno: u16) -> Self { in new_raw() argument
|
/DragonOS/kernel/src/filesystem/fat/ |
H A D | fs.rs | 46 const FAT_MAX_NAMELEN: u64 = 255; 49 pub const MAX_FILE_SIZE: u64 = 0xffff_ffff; 56 pub cluster_num: u64, 57 pub parent_cluster: u64, 83 pub first_data_sector: u64, 260 offset: Option<u64>, 329 let root_dir_sectors: u64 = in new() 330 (bpb.root_entries_cnt as u64 * 32).div_ceil(bpb.bytes_per_sector as u64); in new() 334 bpb.fat_size_16 as u64 in new() 337 FATType::FAT32(x) => x.fat_size_32 as u64, in new() [all …]
|
/DragonOS/kernel/src/time/ |
H A D | mod.rs | 46 pub const FSEC_PER_SEC: u64 = 1000000000000000; 49 pub const PIT_TICK_RATE: u64 = 1193182; 84 CurrentTimeArch::get_cycles() as u64 / khz, in now_cpu_time() 106 Duration::from_micros((sec * 1000000 + nsec / 1000) as u64) in sub() 130 Duration::from_micros(val.tv_sec as u64 * 1000000 + val.tv_nsec as u64 / 1000) in from() 182 let mut year: u64 = year0.into(); in mktime64() 183 let day: u64 = day.into(); in mktime64() 184 let hour: u64 = hour.into(); in mktime64() 185 let min: u64 = min.into(); in mktime64() 186 let sec: u64 = sec.into(); in mktime64() [all …]
|
H A D | timer.rs | 34 pub static ref TIMER_LIST: SpinLock<Vec<(u64, Arc<Timer>)>> = SpinLock::new(Vec::new()); 43 int_like!(Jiffies, u64); 47 pub fn timer_jiffies(&self) -> u64 { in timer_jiffies() argument 64 let ms = jiffies.data() / 1_000_000 * NSEC_PER_JIFFY as u64; in from() 81 let jiffies = ms.as_millis() as u64 * 1_000_000 / NSEC_PER_JIFFY as u64; in from() 119 pub fn new(timer_func: Box<dyn TimerFunction>, expire_jiffies: u64) -> Arc<Self> { in new() 210 pub expire_jiffies: u64, 287 pub fn next_n_ms_timer_jiffies(expire_ms: u64) -> u64 { in next_n_ms_timer_jiffies() argument 288 return TIMER_JIFFIES.load(Ordering::SeqCst) + expire_ms * 1000000 / NSEC_PER_JIFFY as u64; in next_n_ms_timer_jiffies() 291 pub fn next_n_us_timer_jiffies(expire_us: u64) -> u64 { in next_n_us_timer_jiffies() argument [all …]
|
/DragonOS/kernel/crates/rust-slabmalloc/src/ |
H A D | zone.rs | 42 total: u64, 122 self.total -= (just_reclaimed * OBJECT_PAGE_SIZE) as u64; in try_reclaim_base_pages() 131 pub fn free_space(&mut self) -> u64 { in free_space() argument 148 free as u64 in free_space() 198 self.total += OBJECT_PAGE_SIZE as u64; in refill() 209 total: u64, 211 free: u64, 216 pub fn new(total: u64, free: u64) -> Self { in new() argument 220 pub fn total(&self) -> u64 { in total() argument 224 pub fn used(&self) -> u64 { in used() argument [all …]
|
/DragonOS/kernel/src/arch/x86_64/interrupt/ |
H A D | trap.rs | 42 pub struct TrapNr: u64 { 115 unsafe extern "C" fn do_divide_error(regs: &'static TrapFrame, error_code: u64) { in do_divide_error() argument 129 unsafe extern "C" fn do_debug(regs: &'static mut TrapFrame, error_code: u64) { in do_debug() argument 143 unsafe extern "C" fn do_nmi(regs: &'static TrapFrame, error_code: u64) { in do_nmi() argument 157 unsafe extern "C" fn do_int3(regs: &'static mut TrapFrame, error_code: u64) { in do_int3() argument 171 unsafe extern "C" fn do_overflow(regs: &'static TrapFrame, error_code: u64) { in do_overflow() argument 185 unsafe extern "C" fn do_bounds(regs: &'static TrapFrame, error_code: u64) { in do_bounds() argument 199 unsafe extern "C" fn do_undefined_opcode(regs: &'static TrapFrame, error_code: u64) { in do_undefined_opcode() argument 213 unsafe extern "C" fn do_dev_not_avaliable(regs: &'static TrapFrame, error_code: u64) { in do_dev_not_avaliable() argument 227 unsafe extern "C" fn do_double_fault(regs: &'static TrapFrame, error_code: u64) { in do_double_fault() argument [all …]
|
/DragonOS/kernel/crates/crc/src/ |
H A D | crc64.rs | 41 pub fn crc64_be(mut crc: u64, buf: &[u8]) -> u64 { in crc64_be() argument 43 let t = ((crc >> 56) ^ (byte as u64)) & 0xff; in crc64_be() 57 pub fn crc64_rocksoft_generic(mut crc: u64, buf: &[u8]) -> u64 { in crc64_rocksoft_generic() argument
|
/DragonOS/kernel/src/arch/x86_64/process/ |
H A D | kthread.rs | 31 frame.rbx = create_info as usize as u64; in __inner_create() 32 frame.ds = KERNEL_DS.bits() as u64; in __inner_create() 33 frame.es = KERNEL_DS.bits() as u64; in __inner_create() 34 frame.cs = KERNEL_CS.bits() as u64; in __inner_create() 35 frame.ss = KERNEL_DS.bits() as u64; in __inner_create() 40 frame.rip = kernel_thread_bootstrap_stage1 as usize as u64; in __inner_create()
|