Home
last modified time | relevance | path

Searched refs:usize (Results 1 – 25 of 163) sorted by relevance

1234567

/packages/modules/Virtualization/vmbase/src/memory/
Dutil.rs24 pub const SIZE_4KB: usize = 4 << 10;
26 pub const SIZE_16KB: usize = 16 << 10;
28 pub const SIZE_64KB: usize = 64 << 10;
30 pub const SIZE_128KB: usize = 128 << 10;
32 pub const SIZE_2MB: usize = 2 << 20;
34 pub const SIZE_4MB: usize = 4 << 20;
37 pub const PAGE_SIZE: usize = SIZE_4KB;
41 pub fn min_dcache_line_size() -> usize { in min_dcache_line_size()
42 const DMINLINE_SHIFT: usize = 16; in min_dcache_line_size()
43 const DMINLINE_MASK: usize = 0xf; in min_dcache_line_size()
[all …]
Dpage_table.rs54 const TCR_EL1_TG0_MASK: usize = 0x3; in default()
56 const TCR_EL1_TG0_SIZE_4KB: usize = 0b00; in default()
58 const TCR_EL1_T0SZ_MASK: usize = 0x3f; in default()
60 const TCR_EL1_T0SZ_39_VA_BITS: usize = 64 - 39; in default()
73 pub const ASID: usize = 1;
76 const ROOT_LEVEL: usize = 1;
139 F: Fn(&MemoryRegion, &mut Descriptor, usize) -> result::Result<(), ()>, in modify_range()
148 F: Fn(&MemoryRegion, &Descriptor, usize) -> result::Result<(), ()>, in walk_range()
150 let mut callback = |mr: &MemoryRegion, d: &Descriptor, l: usize| f(mr, d, l); in walk_range()
Dshared.rs54 pub type MemoryRange = Range<usize>;
87 const CAPACITY: usize = 5;
88 const MMIO_CAPACITY: usize = 5;
184 pub fn alloc(&mut self, base: usize, size: NonZeroUsize) -> Result<MemoryRange> { in alloc() argument
189 pub fn alloc_mut(&mut self, base: usize, size: NonZeroUsize) -> Result<MemoryRange> { in alloc_mut() argument
264 pub fn init_dynamic_shared_pool(&mut self, granule: usize) -> Result<()> { in init_dynamic_shared_pool()
265 const INIT_CAP: usize = 10; in init_dynamic_shared_pool()
286 pub fn init_static_shared_pool(&mut self, range: Range<usize>) -> Result<()> { in init_static_shared_pool()
335 .modify_range(page_range, &|_: &VaRange, desc: &mut Descriptor, _: usize| { in map_lazy_mmio_as_valid()
383 granule: usize,
[all …]
/packages/modules/Virtualization/vmbase/src/
Dutil.rs21 pub fn flatten<T, const N: usize>(original: &[[T; N]]) -> &[T] { in flatten()
31 pub const fn unchecked_align_down(addr: usize, alignment: usize) -> usize { in unchecked_align_down() argument
38 pub const fn unchecked_align_up(addr: usize, alignment: usize) -> usize { in unchecked_align_up() argument
43 pub const fn align_up(addr: usize, alignment: usize) -> Option<usize> { in align_up() argument
57 const fn align_down(addr: usize, alignment: usize) -> Option<usize> { in align_down() argument
68 pub const fn ceiling_div(num: usize, den: usize) -> Option<usize> { in ceiling_div() argument
Dheap.rs57 let (start, size) = unsafe { (HEAP.as_mut_ptr() as usize, HEAP.len()) }; in init()
65 pub fn aligned_boxed_slice(size: usize, align: usize) -> Option<Box<[u8]>> { in aligned_boxed_slice() argument
78 unsafe extern "C" fn malloc(size: usize) -> *mut c_void { in malloc()
83 unsafe extern "C" fn calloc(nmemb: usize, size: usize) -> *mut c_void { in calloc() argument
92 len: usize, in __memset_chk() argument
93 destlen: usize, in __memset_chk() argument
119 let ptr = ptr.cast::<usize>().as_ptr().offset(-1); in free()
132 fn allocate(size: usize, zeroed: bool) -> Option<NonNull<usize>> { in allocate() argument
133 let size = NonZeroUsize::new(size)?.checked_add(mem::size_of::<usize>())?; in allocate()
143 let ptr = NonNull::new(ptr)?.cast::<usize>().as_ptr(); in allocate()
[all …]
Dexceptions.rs25 const UART_PAGE: usize = page_4kb_of(console::BASE_ADDRESS);
67 Unknown(usize),
71 const EXT_DABT_32BIT: usize = 0x96000010;
72 const TRANSL_FAULT_BASE_32BIT: usize = 0x96000004;
73 const TRANSL_FAULT_ISS_MASK_32BIT: usize = !0x143;
74 const PERM_FAULT_BASE_32BIT: usize = 0x9600004C;
75 const PERM_FAULT_ISS_MASK_32BIT: usize = !0x103;
78 impl From<usize> for Esr {
79 fn from(esr: usize) -> Self { in from()
Dbionic.rs92 extern "C" fn getentropy(buffer: *mut c_void, length: usize) -> c_int { in getentropy()
126 #[repr(usize)]
133 impl TryFrom<usize> for File {
136 fn try_from(value: usize) -> Result<Self, Self::Error> { in try_from()
151 extern "C" fn fputs(c_str: *const c_char, stream: usize) -> c_int { in fputs()
165 extern "C" fn fwrite(ptr: *const c_void, size: usize, nmemb: usize, stream: usize) -> usize { in fwrite() argument
/packages/modules/Virtualization/libs/dice/open_dice/src/
Ddice.rs32 pub const HASH_SIZE: usize = DICE_HASH_SIZE as usize;
34 pub const HIDDEN_SIZE: usize = DICE_HIDDEN_SIZE as usize;
36 const INLINE_CONFIG_SIZE: usize = DICE_INLINE_CONFIG_SIZE as usize;
38 pub const CDI_SIZE: usize = DICE_CDI_SIZE as usize;
40 pub const PRIVATE_KEY_SEED_SIZE: usize = DICE_PRIVATE_KEY_SEED_SIZE as usize;
42 pub const PRIVATE_KEY_SIZE: usize = DICE_PRIVATE_KEY_SIZE as usize;
44 pub const PUBLIC_KEY_SIZE: usize = DICE_PUBLIC_KEY_SIZE as usize;
46 pub const SIGNATURE_SIZE: usize = DICE_SIGNATURE_SIZE as usize;
48 pub const ID_SIZE: usize = DICE_ID_SIZE as usize;
169 fn descriptor_size(&self) -> usize { in descriptor_size() argument
[all …]
/packages/modules/Virtualization/authfs/src/fsverity/
Deditor.rs68 debug_assert!(usize::MAX as u64 == u64::MAX, "Only 64-bit arch is supported"); in debug_assert_usize_is_u64()
85 pub fn get_fsverity_digest_size(&self) -> usize { in get_fsverity_digest_size() argument
99 ) -> io::Result<usize> { in read_backing_chunk_unverified() argument
108 ) -> io::Result<usize> { in read_backing_chunk_verified() argument
111 if merkle_tree_locked.is_index_valid(chunk_index as usize) { in read_backing_chunk_verified()
116 if !merkle_tree_locked.is_consistent(chunk_index as usize, &hash) { in read_backing_chunk_verified()
128 offset_from_alignment: usize, in new_hash_for_incomplete_write() argument
129 output_chunk_index: usize, in new_hash_for_incomplete_write() argument
135 let mut orig_data = [0u8; CHUNK_SIZE as usize]; in new_hash_for_incomplete_write()
159 offset_from_alignment: usize, in new_chunk_hash() argument
[all …]
Dbuilder.rs23 const HASH_SIZE: usize = SHA256_HASH_SIZE;
24 const HASH_PER_PAGE: usize = CHUNK_SIZE as usize / HASH_SIZE;
76 pub fn resize(&mut self, new_file_size: usize) { in resize() argument
79 self.leaves.resize(leaves_size as usize, HASH_OF_4096_ZEROS); in resize()
85 pub fn update_hash(&mut self, index: usize, hash: &Sha256Hash, size_at_least: u64) { in update_hash() argument
100 pub fn is_index_valid(&self, index: usize) -> bool { in is_index_valid()
105 pub fn is_consistent(&self, index: usize, hash: &Sha256Hash) -> bool { in is_consistent() argument
209 let hash = sha256(&vec![1u8; CHUNK_SIZE as usize]); in merkle_tree_non_sequential()
248 tree.resize(CHUNK_SIZE as usize * 2 - 100); in merkle_tree_shrink_leaves()
261 for (index, chunk) in test_data.chunks(CHUNK_SIZE as usize).enumerate() { in generate_fsverity_digest_sequentially()
[all …]
Dverifier.rs25 const ZEROS: [u8; CHUNK_SIZE as usize] = [0u8; CHUNK_SIZE as usize];
29 fn hash_with_padding(chunk: &[u8], pad_to: usize) -> HashBuffer { in hash_with_padding()
48 let chunk_hash = hash_with_padding(chunk, CHUNK_SIZE as usize); in verity_check()
65 Ok(hash_with_padding(&merkle_chunk, CHUNK_SIZE as usize)) in verity_check()
79 ) -> Result<impl Iterator<Item = Result<([u8; 4096], usize), FsverityError>> + '_, FsverityError> { in fsverity_walk() argument
102 let hash_offset_in_chunk = (global_hash_offset % CHUNK_SIZE) as usize;
131 let mut buf = [0u8; CHUNK_SIZE as usize]; in new()
152 fn read_chunk(&self, chunk_index: u64, buf: &mut ChunkBuffer) -> io::Result<usize> { in read_chunk() argument
191 fn read_chunk(&self, chunk_index: u64, buf: &mut ChunkBuffer) -> io::Result<usize> { in read_chunk() argument
197 let read_size = (end - start) as usize; in read_chunk()
[all …]
/packages/modules/Virtualization/vm_payload/src/
Dlib.rs43 const MAX_ECDSA_P256_SIGNATURE_SIZE: usize = 72;
181 identifier_size: usize, in AVmPayload_getVmInstanceSecret() argument
183 size: usize, in AVmPayload_getVmInstanceSecret() argument
198 fn try_get_vm_instance_secret(identifier: &[u8], size: usize) -> Result<Vec<u8>> { in try_get_vm_instance_secret()
222 pub unsafe extern "C" fn AVmPayload_getDiceAttestationChain(data: *mut u8, size: usize) -> usize { in AVmPayload_getDiceAttestationChain() argument
251 pub unsafe extern "C" fn AVmPayload_getDiceAttestationCdi(data: *mut u8, size: usize) -> usize { in AVmPayload_getDiceAttestationCdi() argument
284 challenge_size: usize, in AVmPayload_requestAttestation() argument
311 challenge_size: usize, in AVmPayload_requestAttestationForTesting() argument
337 challenge_size: usize, in request_attestation() argument
342 const MAX_CHALLENGE_SIZE: usize = 64; in request_attestation()
[all …]
/packages/modules/Virtualization/pvmfw/src/
Dconfig.rs52 InvalidSize(usize),
56 EntryOutOfBounds(Entry, Range<usize>, Range<usize>),
89 pub fn total_size(&self) -> usize { in total_size() argument
90 self.total_size as usize in total_size()
93 pub fn body_lowest_bound(&self) -> Result<usize> { in body_lowest_bound() argument
105 pub fn entry_count(&self) -> Result<usize> { in entry_count() argument
118 Ok(last_entry as usize + 1) in entry_count()
133 const COUNT: usize = Self::_VARIANT_COUNT as usize;
172 start: usize,
177 pub fn new(start: usize, size: usize) -> Option<Self> { in new() argument
[all …]
Dgpt.rs41 BlockOutsidePartition(usize),
59 indices: RangeInclusive<usize>,
74 pub fn indices(&self) -> RangeInclusive<usize> { in indices() argument
78 pub fn read_block(&mut self, index: usize, blk: &mut [u8]) -> Result<()> { in read_block() argument
83 pub fn write_block(&mut self, index: usize, blk: &[u8]) -> Result<()> { in write_block() argument
88 fn block_index(&self, index: usize) -> Option<usize> { in block_index() argument
99 entries_count: usize,
103 pub const LBA_SIZE: usize = SECTOR_SIZE;
112 let entries_count = usize::try_from(header.entries_count()).unwrap(); in new()
148 fn read_block(&mut self, index: usize, blk: &mut [u8]) -> Result<()> { in read_block() argument
[all …]
Dentry.rs71 match main_wrapper(fdt_address as usize, payload_start as usize, payload_size as usize) { in start()
87 fdt: usize, in new() argument
88 kernel: usize, in new() argument
89 kernel_size: usize, in new() argument
190 fdt: usize, in main_wrapper() argument
191 payload: usize, in main_wrapper() argument
192 payload_size: usize, in main_wrapper() argument
193 ) -> Result<(usize, Range<usize>), RebootReason> { in main_wrapper() argument
268 Ok((slices.kernel.as_ptr() as usize, next_bcc)) in main_wrapper()
271 fn jump_to_payload(fdt_address: u64, payload_start: u64, bcc: Range<usize>) -> ! { in jump_to_payload() argument
[all …]
Dfdt.rs60 InvalidCpuCount(usize),
83 fn read_kernel_range_from(fdt: &Fdt) -> libfdt::Result<Option<Range<usize>>> { in read_kernel_range_from() argument
89 let addr = addr as usize; in read_kernel_range_from()
90 let size = size as usize; in read_kernel_range_from()
101 fn read_initrd_range_from(fdt: &Fdt) -> libfdt::Result<Option<Range<usize>>> { in read_initrd_range_from() argument
107 return Ok(Some((start as usize)..(end as usize))); in read_initrd_range_from()
114 fn patch_initrd_range(fdt: &mut Fdt, initrd_range: &Range<usize>) -> libfdt::Result<()> { in patch_initrd_range()
147 fn read_and_validate_memory_range(fdt: &Fdt) -> Result<Range<usize>, RebootReason> { in read_and_validate_memory_range() argument
181 fn patch_memory_range(fdt: &mut Fdt, memory_range: &Range<usize>) -> libfdt::Result<()> { in patch_memory_range()
196 const MAX_OPPTABLES: usize = 20;
[all …]
/packages/modules/Virtualization/microdroid/initrd/src/
Dmain.rs24 const FOOTER_ALIGNMENT: usize = 4;
28 const INITRD_FOOTER_LEN: usize = 2 * std::mem::size_of::<u32>() + BOOTCONFIG_MAGIC.len();
61 fn copyfile2file(file_in: &mut File, file_out: &mut File, n: usize) -> Result<()> { in copyfile2file()
63 let mut copied: usize = 0; in copyfile2file()
78 let initrd_bc_size: usize = initrd_bc.metadata()?.len().try_into()?; in detach_bootconfig()
89 let bc_size: usize = u32::from_le_bytes(size_buf) as usize; in detach_bootconfig()
91 let initrd_size: usize = initrd_bc_size - bc_size - INITRD_FOOTER_LEN; in detach_bootconfig()
104 let initrd_size: usize = initrd_file.metadata()?.len().try_into()?; in attach_bootconfig()
105 let mut bootconfig_size: usize = 0; in attach_bootconfig()
112 bootconfig_size += bootconfig_file.metadata()?.len() as usize; in attach_bootconfig()
[all …]
/packages/modules/Virtualization/authfs/src/
Dcommon.rs27 remaining: usize,
29 alignment: usize,
33 pub fn new(remaining: usize, offset: u64, alignment: usize) -> Self { in new() argument
39 type Item = (u64, usize);
47 self.alignment - (self.offset % self.alignment as u64) as usize, in next()
60 fn collect_chunk_read_iter(remaining: usize, offset: u64) -> Vec<(u64, usize)> { in collect_chunk_read_iter() argument
Dfile.rs20 pub type ChunkBuffer = [u8; CHUNK_SIZE as usize];
42 fn read_chunk(&self, chunk_index: u64, buf: &mut ChunkBuffer) -> io::Result<usize>; in read_chunk() argument
53 fn write_at(&self, buf: &[u8], offset: u64) -> io::Result<usize>; in write_at() argument
87 let file_size = usize::try_from(file_size).unwrap(); in new()
89 let mut chunk_buffer = [0; CHUNK_SIZE as usize]; in new()
106 fn read_chunk(&self, chunk_index: u64, buf: &mut ChunkBuffer) -> io::Result<usize> { in read_chunk() argument
107 if let Some(chunk) = &self.buffer.chunks(CHUNK_SIZE as usize).nth(chunk_index as usize) { in read_chunk()
/packages/modules/Virtualization/libs/apkverify/src/
Dhashtree.rs33 input_size: usize, in from() argument
35 block_size: usize, in from() argument
67 input_size: usize, in generate_hash_tree() argument
69 block_size: usize, in generate_hash_tree() argument
117 block_size: usize, in hash_one_block() argument
128 type Range = std::ops::Range<usize>;
131 fn calc_hash_levels(input_size: usize, block_size: usize, digest_size: usize) -> Vec<Range> { in calc_hash_levels() argument
170 fn round_to_multiple(n: usize, unit: usize) -> usize { in round_to_multiple() argument
209 let size = std::fs::metadata(&input_name)?.len() as usize; in compare_with_golden_output()
/packages/modules/Bluetooth/system/rust/src/gatt/
Dmtu.rs21 IncomingResponse(usize),
23 IncomingRequest(usize),
30 previous_mtu: Cell<usize>,
33 stable_mtu: SharedMutex<usize>,
35 pending_exchange: Cell<Option<OwnedMutexGuard<usize>>>,
39 const DEFAULT_ATT_MTU: usize = 23;
53 pub fn snapshot_or_default(&self) -> usize { in snapshot_or_default() argument
59 pub fn snapshot(&self) -> impl Future<Output = Option<usize>> { in snapshot()
85 fn on_incoming_response(&self, mtu: usize) -> Result<()> { in on_incoming_response()
97 fn on_incoming_request(&self, mtu: usize) { in on_incoming_request() argument
[all …]
/packages/modules/Virtualization/vmbase/src/layout/
Dcrosvm.rs22 pub const MMIO_START: usize = 0x0;
24 pub const MMIO_END: usize = 0x4000_0000;
26 pub const MMIO_RANGE: Range<usize> = MMIO_START..MMIO_END;
29 pub const MEM_START: usize = 0x8000_0000;
32 pub const FDT_MAX_SIZE: usize = 2 << 20;
/packages/modules/Virtualization/vmbase/example/src/
Dpci.rs33 const SECTOR_SIZE_BYTES: usize = 512;
36 const EXPECTED_SECTOR_COUNT: usize = 4;
73 fn check_virtio_block_device(transport: PciTransport, index: usize) { in check_virtio_block_device() argument
118 MemoryRegion::new(pci_info.bar_range.start as usize, pci_info.bar_range.end as usize) in get_bar_region()
132 fn dma_alloc(pages: usize, _direction: BufferDirection) -> (PhysAddr, NonNull<u8>) { in dma_alloc() argument
145 unsafe fn dma_dealloc(paddr: PhysAddr, vaddr: NonNull<u8>, pages: usize) -> i32 { in dma_dealloc()
161 unsafe fn mmio_phys_to_virt(paddr: PhysAddr, _size: usize) -> NonNull<u8> { in mmio_phys_to_virt()
/packages/modules/Virtualization/libs/libfdt/src/
Diterators.rs63 const CHUNK_SIZE: usize = size_of::<<CellIterator as Iterator>::Item>(); in new()
96 impl<T: TryInto<usize>> TryFrom<Reg<T>> for Range<usize> {
107 fn to_usize<T: TryInto<usize>>(num: T) -> Result<usize, FdtError> { in to_usize() argument
138 const NUM_CELLS: usize = 2;
165 type Item = Range<usize>;
169 let addr = usize::try_from(next.addr).ok()?; in next()
170 let size = usize::try_from(next.size?).ok()?; in next()
271 const SIZE_CELLS: usize = 7;
317 node: Option<(FdtNode<'a>, usize)>,
327 type Item = (FdtNode<'a>, usize);
Dlib.rs48 impl TryFrom<usize> for AddrCells {
51 fn try_from(value: usize) -> Result<Self> { in try_from()
69 impl TryFrom<usize> for SizeCells {
72 fn try_from(value: usize) -> Result<Self> { in try_from()
104 fn data_len(&self) -> usize { in data_len() argument
162 pub fn supernode_at_depth(&self, depth: usize) -> Result<Self> { in supernode_at_depth()
299 fn next_node(&self, depth: usize) -> Result<Option<(Self, usize)>> { in next_node() argument
415 pub fn trimprop(&mut self, name: &CStr, new_size: usize) -> Result<()> { in trimprop()
453 pub fn add_subnode_with_namelen(self, name: &CStr, namelen: usize) -> Result<Self> { in add_subnode_with_namelen()
487 pub fn next_node(self, depth: usize) -> Result<Option<(Self, usize)>> { in next_node() argument
[all …]

1234567