/DragonOS/kernel/crates/rbpf/src/ |
H A D | jit.rs | 11 mem, 80 ( $mem:ident, $data:tt, $t:ty ) => {{ 81 let size = mem::size_of::<$t>() as usize; 82 assert!($mem.offset + size <= $mem.contents.len()); 84 let mut ptr = $mem.contents.as_ptr().add($mem.offset) as *mut $t; 87 $mem.offset += size; 113 fn emit1(&self, mem: &mut JitMemory, data: u8) { in emit1() 114 emit_bytes!(mem, data, u8); in emit1() 117 fn emit2(&self, mem: &mut JitMemory, data: u16) { in emit2() 118 emit_bytes!(mem, data, u16); in emit2() [all …]
|
H A D | lib.rs | 298 pub fn execute_program(&self, mem: &[u8], mbuff: &[u8]) -> Result<u64, Error> { in execute_program() 299 interpreter::execute_program(self.prog, mem, mbuff, &self.helpers) in execute_program() 389 mem: &mut [u8], in execute_program_jit() 396 let mem_ptr = match mem.len() { in execute_program_jit() 398 _ => mem.as_ptr() as *mut u8, in execute_program_jit() 408 mem.len(), in execute_program_jit() 500 mem: &mut [u8], in execute_program_cranelift() 507 let mem_ptr = match mem.len() { in execute_program_cranelift() 509 _ => mem.as_ptr() as *mut u8, in execute_program_cranelift() 517 Ok(prog.execute(mem_ptr, mem.len(), mbuff.as_ptr() as *mut u8, mbuff.len())) in execute_program_cranelift() [all …]
|
H A D | interpreter.rs | 23 mem: &[u8], in check_mem() 37 mem.as_ptr() as u64, in check_mem() 38 mem.len(), in check_mem() 52 mem: &[u8], 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() 71 mem.as_ptr() as u64, mem.len(), in check_mem() 85 mem: &[u8], in execute_program() 118 } else if !mem.is_empty() { in execute_program() 119 reg[1] = mem.as_ptr() as u64; in execute_program() 123 check_mem(addr, len, "load", insn_ptr, mbuff, mem, stack) in execute_program() [all …]
|
/DragonOS/kernel/src/driver/firmware/efi/ |
H A D | guid.rs | 1 use core::{fmt, mem}; 7 unsafe { mem::transmute_copy(&0xddf1d47cu32) }, 8 unsafe { mem::transmute_copy(&0x102cu32) }, 9 unsafe { mem::transmute_copy(&0xaaf9u32) }, 16 unsafe { mem::transmute_copy(&0xdcfa911du32) }, 17 unsafe { mem::transmute_copy(&0x26ebu32) }, 18 unsafe { mem::transmute_copy(&0x469fu32) }, 25 unsafe { mem::transmute_copy(&0x888eb0c6u32) }, 26 unsafe { mem::transmute_copy(&0x8edeu32) }, 27 unsafe { mem::transmute_copy(&0x4ff5u32) }, [all …]
|
/DragonOS/kernel/crates/rbpf/tests/ |
H A D | misc.rs | 236 let mem = &[0xaa, 0xbb, 0x11, 0x22, 0xcc, 0xdd]; in test_vm_mbuff() localVariable 242 data.write_unaligned(mem.as_ptr() as u64); in test_vm_mbuff() 243 data_end.write_unaligned(mem.as_ptr() as u64 + mem.len() as u64); in test_vm_mbuff() 247 assert_eq!(vm.execute_program(mem, &mbuff).unwrap(), 0x2211); in test_vm_mbuff() 270 let mem = &[0xaa, 0xbb, 0x11, 0x22, 0xcc, 0xdd]; in test_vm_mbuff_with_rust_api() localVariable 276 *data = mem.as_ptr() as u64; in test_vm_mbuff_with_rust_api() 277 *data_end = mem.as_ptr() as u64 + mem.len() as u64; in test_vm_mbuff_with_rust_api() 281 assert_eq!(vm.execute_program(mem, &mbuff).unwrap(), 0x2211); in test_vm_mbuff_with_rust_api() 294 let mem = &mut [0xaa, 0xbb, 0x11, 0x22, 0xcc, 0xdd]; in test_jit_mbuff() localVariable 300 *data = mem.as_ptr() as u64; in test_jit_mbuff() [all …]
|
H A D | cranelift.rs | 23 ($name:ident, $prog:expr, $mem:expr, $expected:expr) => { 27 let mem = &mut $mem; localVariable 30 assert_eq!(vm.execute_program_cranelift(mem).unwrap(), $expected); 314 let mem = &mut [0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08]; in test_cranelift_call_memfrob() localVariable 317 vm.execute_program_cranelift(mem).unwrap(), in test_cranelift_call_memfrob() 2035 let mem = &mut [ in test_cranelift_tcp_port80_match() localVariable 2047 assert_eq!(vm.execute_program_cranelift(mem).unwrap(), 0x1); in test_cranelift_tcp_port80_match() 2052 let mem = &mut [ in test_cranelift_tcp_port80_nomatch() localVariable 2064 assert_eq!(vm.execute_program_cranelift(mem).unwrap(), 0x0); in test_cranelift_tcp_port80_nomatch() 2069 let mem = &mut [ in test_cranelift_tcp_port80_nomatch_ethertype() localVariable [all …]
|
H A D | ubpf_vm.rs | 290 let mem = &mut [0x11, 0x22]; in test_vm_be16() localVariable 292 assert_eq!(vm.execute_program(mem).unwrap(), 0x1122); in test_vm_be16() 304 let mem = &mut [0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88]; in test_vm_be16_high() localVariable 306 assert_eq!(vm.execute_program(mem).unwrap(), 0x1122); in test_vm_be16_high() 318 let mem = &mut [0x11, 0x22, 0x33, 0x44]; in test_vm_be32() localVariable 320 assert_eq!(vm.execute_program(mem).unwrap(), 0x11223344); in test_vm_be32() 332 let mem = &mut [0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88]; in test_vm_be32_high() localVariable 334 assert_eq!(vm.execute_program(mem).unwrap(), 0x11223344); in test_vm_be32_high() 346 let mem = &mut [0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88]; in test_vm_be64() localVariable 348 assert_eq!(vm.execute_program(mem).unwrap(), 0x1122334455667788); in test_vm_be64() [all …]
|
H A D | ubpf_jit_x86_64.rs | 260 let mem = &mut [0x11, 0x22]; in test_jit_be16() localVariable 264 assert_eq!(vm.execute_program_jit(mem).unwrap(), 0x1122); in test_jit_be16() 277 let mem = &mut [0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88]; in test_jit_be16_high() localVariable 281 assert_eq!(vm.execute_program_jit(mem).unwrap(), 0x1122); in test_jit_be16_high() 294 let mem = &mut [0x11, 0x22, 0x33, 0x44]; in test_jit_be32() localVariable 298 assert_eq!(vm.execute_program_jit(mem).unwrap(), 0x11223344); in test_jit_be32() 311 let mem = &mut [0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88]; in test_jit_be32_high() localVariable 315 assert_eq!(vm.execute_program_jit(mem).unwrap(), 0x11223344); in test_jit_be32_high() 328 let mem = &mut [0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88]; in test_jit_be64() localVariable 332 assert_eq!(vm.execute_program_jit(mem).unwrap(), 0x1122334455667788); in test_jit_be64() [all …]
|
/DragonOS/kernel/src/virt/kvm/ |
H A D | vm.rs | 50 mem: &KvmUserspaceMemoryRegion, in set_user_memory_region() 53 let id: u16 = mem.slot as u16; // slot id in set_user_memory_region() 54 let as_id = mem.slot >> 16; // address space id in set_user_memory_region() 58 if mem.slot as usize >= self.nr_mem_slots as usize { in set_user_memory_region() 62 self.check_memory_region_flag(mem)?; in set_user_memory_region() 64 if (mem.memory_size & (MMArch::PAGE_SIZE - 1) as u64) != 0 in set_user_memory_region() 65 || (mem.guest_phys_addr & (MMArch::PAGE_SIZE - 1) as u64) != 0 in set_user_memory_region() 77 let base_gfn = mem.guest_phys_addr >> PAGE_SHIFT; in set_user_memory_region() 78 let npages = mem.memory_size >> PAGE_SHIFT; in set_user_memory_region() 89 userspace_addr: mem.userspace_addr, // 虚机内存区间对应的主机虚拟地址 in set_user_memory_region() [all …]
|
/DragonOS/kernel/src/include/bindings/ |
H A D | linux_bpf.rs | 200 unsafe { ::core::mem::transmute(self._bitfield_1.get(0usize, 4u8) as u8) } in dst_reg() 205 let val: u8 = ::core::mem::transmute(val); in set_dst_reg() 211 unsafe { ::core::mem::transmute(self._bitfield_1.get(4usize, 4u8) as u8) } in src_reg() 216 let val: u8 = ::core::mem::transmute(val); in set_src_reg() 224 let dst_reg: u8 = unsafe { ::core::mem::transmute(dst_reg) }; 228 let src_reg: u8 = unsafe { ::core::mem::transmute(src_reg) }; 1017 unsafe { ::core::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u32) } in gpl_compatible() 1022 let val: u32 = ::core::mem::transmute(val); in set_gpl_compatible() 1030 let gpl_compatible: u32 = unsafe { ::core::mem::transmute(gpl_compatible) }; 1565 unsafe { ::core::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u64) } in disabled() [all …]
|
/DragonOS/kernel/src/arch/x86_64/init/pvh/ |
H A D | param.rs | 199 const UNINIT: ::std::mem::MaybeUninit<HvmStartInfo> = ::std::mem::MaybeUninit::uninit(); in bindgen_test_layout_hvm_start_info() 202 ::std::mem::size_of::<HvmStartInfo>(), in bindgen_test_layout_hvm_start_info() 207 ::std::mem::align_of::<HvmStartInfo>(), in bindgen_test_layout_hvm_start_info() 315 const UNINIT: ::std::mem::MaybeUninit<HvmModlistEntry> = ::std::mem::MaybeUninit::uninit(); in bindgen_test_layout_hvm_modlist_entry() 318 ::std::mem::size_of::<HvmModlistEntry>(), in bindgen_test_layout_hvm_modlist_entry() 323 ::std::mem::align_of::<HvmModlistEntry>(), in bindgen_test_layout_hvm_modlist_entry() 371 const UNINIT: ::std::mem::MaybeUninit<HvmMemmapTableEntry> = in bindgen_test_layout_hvm_memmap_table_entry() 372 ::std::mem::MaybeUninit::uninit(); in bindgen_test_layout_hvm_memmap_table_entry() 375 ::std::mem::size_of::<HvmMemmapTableEntry>(), in bindgen_test_layout_hvm_memmap_table_entry() 380 ::std::mem::align_of::<HvmMemmapTableEntry>(), in bindgen_test_layout_hvm_memmap_table_entry()
|
/DragonOS/kernel/src/syscall/ |
H A D | user_access.rs | 4 mem::size_of, 132 let mut dst = core::mem::transmute::<[usize; 1], [u8; size_of::<usize>()]>(dst); in check_and_clone_cstr_array() 134 let dst = core::mem::transmute::<[u8; size_of::<usize>()], [usize; 1]>(dst); in check_and_clone_cstr_array() 246 if byte_buffer.len() % core::mem::size_of::<T>() != 0 || byte_buffer.is_empty() { in convert_with_offset() 253 byte_buffer.len() / core::mem::size_of::<T>(), in convert_with_offset() 260 if offset + core::mem::size_of::<T>() > src.len() { in convert_one_with_offset() 263 let byte_buffer: &[u8] = &src[offset..offset + core::mem::size_of::<T>()]; in convert_one_with_offset() 333 if byte_buffer.len() % core::mem::size_of::<T>() != 0 || byte_buffer.is_empty() { in convert_with_offset() 340 byte_buffer.len() / core::mem::size_of::<T>(), in convert_with_offset() 347 if offset + core::mem::size_of::<T>() > src.len() { in convert_one_with_offset() [all …]
|
H A D | misc.rs | 37 let mut writer = UserBufferWriter::new(info, core::mem::size_of::<SysInfo>(), true)?; in sysinfo() 40 let mem = unsafe { LockedFrameAllocator.usage() }; in sysinfo() localVariable 44 sysinfo.totalram = mem.total().bytes() as u64; in sysinfo() 45 sysinfo.freeram = mem.free().bytes() as u64 + slab_usage.free(); in sysinfo()
|
/DragonOS/kernel/src/libs/futex/ |
H A D | syscall.rs | 24 verify_area(uaddr, core::mem::size_of::<u32>())?; in do_futex() 25 verify_area(uaddr2, core::mem::size_of::<u32>())?; in do_futex() 117 verify_area(head_uaddr, core::mem::size_of::<u32>())?; in set_robust_list() 129 verify_area(head_uaddr, core::mem::size_of::<u32>())?; in get_robust_list() 130 verify_area(len_ptr_uaddr, core::mem::size_of::<u32>())?; in get_robust_list()
|
H A D | futex.rs | 8 mem, 253 UserBufferReader::new(uaddr.as_ptr::<u32>(), core::mem::size_of::<u32>(), true)?; in futex_wait() 420 UserBufferReader::new(uaddr1.as_ptr::<u32>(), core::mem::size_of::<u32>(), true)?; in futex_requeue() 511 if uaddr.data() & (core::mem::size_of::<u32>() - 1) != 0 { in get_futex_key() 613 UserBufferReader::new(uaddr.as_ptr::<u32>(), core::mem::size_of::<u32>(), true)?; in arch_futex_atomic_op_inuser() 680 let robust_list_head_len = mem::size_of::<&RobustListHead>(); in set_robust_list() 687 mem::size_of::<RobustListHead>(), in set_robust_list() 726 core::mem::size_of::<usize>(), in get_robust_list() 729 user_writer.copy_one_to_user(&mem::size_of::<RobustListHead>(), 0)?; in get_robust_list() 733 mem::size_of::<RobustListHead>(), in get_robust_list() [all …]
|
/DragonOS/tools/debugging/logmonitor/src/backend/monitor/ |
H A D | mod.rs | 16 if buf.len() != std::mem::size_of::<T>() { in new() 20 std::mem::size_of::<T>() in new()
|
/DragonOS/kernel/src/libs/ |
H A D | align.rs | 32 core::mem::size_of::<T>(), 33 max(ALIGN, core::mem::align_of::<T>()), 76 core::mem::align_of::<T>(), in fmt() 78 core::mem::size_of::<T>() in fmt()
|
/DragonOS/kernel/crates/klog_types/src/ |
H A D | lib.rs | 6 use core::{fmt::Debug, mem::size_of_val}; 76 core::mem::size_of::<Self>() - core::mem::size_of::<u64>(), in calculate_checksum() 239 element_size: core::mem::size_of::<AllocatorLog>() as u32, in new()
|
/DragonOS/kernel/src/arch/riscv64/interrupt/ |
H A D | mod.rs | 112 pub const SIZE: usize = core::mem::size_of::<TrapFrame>(); 155 status: unsafe { core::mem::zeroed() }, in new() 157 cause: unsafe { core::mem::zeroed() }, in new()
|
/DragonOS/kernel/src/arch/riscv64/ |
H A D | rand.rs | 11 let x: usize = unsafe { core::mem::transmute(buf) }; in rand()
|
/DragonOS/kernel/src/time/ |
H A D | syscall.rs | 114 UserBufferWriter::new::<PosixTimeval>(tv, core::mem::size_of::<PosixTimeval>(), true)?; in gettimeofday() 121 core::mem::size_of::<PosixTimeZone>(), in gettimeofday() 147 core::mem::size_of::<PosixTimeSpec>(), in clock_gettime()
|
/DragonOS/kernel/.cargo/ |
H A D | config.toml | 3 # build-std-features = ["compiler-builtins-mem"]
|
/DragonOS/kernel/src/net/event_poll/ |
H A D | syscall.rs | 58 max_events as usize * core::mem::size_of::<EPollEvent>(), in epoll_wait() 79 core::mem::size_of::<EPollEvent>(), in epoll_ctl()
|
/DragonOS/kernel/src/arch/x86_64/process/ |
H A D | syscall.rs | 77 core::mem::size_of::<usize>(), in do_arch_prctl_64() 86 core::mem::size_of::<usize>(), in do_arch_prctl_64()
|
/DragonOS/kernel/crates/rust-slabmalloc/src/ |
H A D | pages.rs | 5 mem, 330 unsafe { mem::MaybeUninit::zeroed().assume_init() } in default() 387 mem::swap(head, &mut new_head); in insert_front() 434 mem::swap(&mut self.head, &mut new_head); in pop() 535 mem::replace(self, Rawlink::none()) in take()
|