/DragonOS/kernel/crates/rbpf/src/ |
H A D | ebpf.rs | 38 pub const BPF_LD: u8 = 0x00; 40 pub const BPF_LDX: u8 = 0x01; 42 pub const BPF_ST: u8 = 0x02; 44 pub const BPF_STX: u8 = 0x03; 46 pub const BPF_ALU: u8 = 0x04; 48 pub const BPF_JMP: u8 = 0x05; 50 pub const BPF_JMP32: u8 = 0x06; 53 pub const BPF_ALU64: u8 = 0x07; 64 pub const BPF_W: u8 = 0x00; 66 pub const BPF_H: u8 = 0x08; [all …]
|
H A D | jit.rs | 19 type MachineCode = unsafe fn(*mut u8, usize, *mut u8, usize, usize, usize) -> u64; 39 const RAX: u8 = 0; 40 const RCX: u8 = 1; 41 const RDX: u8 = 2; 42 const RBX: u8 = 3; 43 const RSP: u8 = 4; 44 const RBP: u8 = 5; 45 const RSI: u8 = 6; 46 const RDI: u8 = 7; 47 const R8: u8 = 8; [all …]
|
H A D | lib.rs | 69 pub type Verifier = fn(prog: &[u8]) -> Result<(), Error>; 81 buffer: Vec<u8>, 117 prog: Option<&'a [u8]>, 142 pub fn new(prog: Option<&'a [u8]>) -> Result<EbpfVmMbuff<'a>, Error> { in new() 177 pub fn set_program(&mut self, prog: &'a [u8]) -> Result<(), Error> { in set_program() 298 pub fn execute_program(&self, mem: &[u8], mbuff: &[u8]) -> Result<u64, Error> { in execute_program() argument 389 mem: &mut [u8], in execute_program_jit() argument 390 mbuff: &'a mut [u8], in execute_program_jit() argument 398 _ => mem.as_ptr() as *mut u8, in execute_program_jit() 405 mbuff.as_ptr() as *mut u8, in execute_program_jit() [all …]
|
/DragonOS/kernel/src/driver/disk/ahci/ |
H A D | hba.rs | 10 pub const ATA_CMD_READ_DMA_EXT: u8 = 0x25; // 读操作,并且退出 11 pub const ATA_CMD_WRITE_DMA_EXT: u8 = 0x35; // 写操作,并且退出 13 pub const ATA_CMD_IDENTIFY: u8 = 0xEC; 15 pub const ATA_CMD_IDENTIFY_PACKET: u8 = 0xA1; 17 pub const ATA_CMD_PACKET: u8 = 0xA0; 18 pub const ATA_DEV_BUSY: u8 = 0x80; 19 pub const ATA_DEV_DRQ: u8 = 0x08; 82 pub _rsv: [u8; 116], // 0x2C - 0x9F, Reserved 83 pub vendor: [u8; 96], // 0xA0 - 0xFF, Vendor specific registers 102 pub cfis: [u8; 64], // Command FIS [all …]
|
H A D | ahcidisk.rs | 43 pub ctrl_num: u8, 44 pub port_num: u8, 74 buf: &mut [u8], in read_at() argument 107 cmdheader.cfl = (size_of::<FisRegH2D>() / size_of::<u32>()) as u8; in read_at() 113 let mut buf_ptr = buf as *mut [u8] as *mut usize as usize; in read_at() 120 let x: Vec<u8> = vec![0; buf.len()]; in read_at() 170 ((&mut cmdtbl.cfis) as *mut [u8] as *mut usize as *mut FisRegH2D) in read_at() 174 volatile_write!(cmdfis.fis_type, FisType::RegH2D as u8); in read_at() 178 volatile_write!(cmdfis.lba0, (lba_id_start & 0xFF) as u8); in read_at() 179 volatile_write!(cmdfis.lba1, ((lba_id_start >> 8) & 0xFF) as u8); in read_at() [all …]
|
/DragonOS/kernel/src/bpf/map/ |
H A D | lru.rs | 11 type BpfHashMapKey = Vec<u8>; 12 type BpfHashMapValue = Vec<u8>; 40 fn lookup_elem(&mut self, key: &[u8]) -> Result<Option<&[u8]>> { in lookup_elem() argument 44 fn update_elem(&mut self, key: &[u8], value: &[u8], _flags: u64) -> Result<()> { in update_elem() argument 48 fn delete_elem(&mut self, key: &[u8]) -> Result<()> { in delete_elem() 52 fn for_each_elem(&mut self, cb: BpfCallBackFn, ctx: *const u8, flags: u64) -> Result<u32> { in for_each_elem() argument 67 fn lookup_and_delete_elem(&mut self, key: &[u8], value: &mut [u8]) -> Result<()> { in lookup_and_delete_elem() argument 77 fn get_next_key(&self, key: Option<&[u8]>, next_key: &mut [u8]) -> Result<()> { in get_next_key() argument 124 fn lookup_elem(&mut self, key: &[u8]) -> Result<Option<&[u8]>> { in lookup_elem() argument 127 fn update_elem(&mut self, key: &[u8], value: &[u8], flags: u64) -> Result<()> { in update_elem() argument [all …]
|
H A D | hash_map.rs | 10 type BpfHashMapKey = Vec<u8>; 11 type BpfHashMapValue = Vec<u8>; 41 fn lookup_elem(&mut self, key: &[u8]) -> Result<Option<&[u8]>> { in lookup_elem() argument 45 fn update_elem(&mut self, key: &[u8], value: &[u8], flags: u64) -> Result<()> { in update_elem() argument 50 fn delete_elem(&mut self, key: &[u8]) -> Result<()> { in delete_elem() 54 fn for_each_elem(&mut self, cb: BpfCallBackFn, ctx: *const u8, flags: u64) -> Result<u32> { in for_each_elem() argument 69 fn lookup_and_delete_elem(&mut self, key: &[u8], value: &mut [u8]) -> Result<()> { in lookup_and_delete_elem() argument 79 fn get_next_key(&self, key: Option<&[u8]>, next_key: &mut [u8]) -> Result<()> { in get_next_key() argument 126 fn lookup_elem(&mut self, key: &[u8]) -> Result<Option<&[u8]>> { in lookup_elem() argument 129 fn update_elem(&mut self, key: &[u8], value: &[u8], flags: u64) -> Result<()> { in update_elem() argument [all …]
|
H A D | array_map.rs | 32 data: Vec<u8>, 54 type Output = [u8]; 83 fn lookup_elem(&mut self, key: &[u8]) -> Result<Option<&[u8]>> { in lookup_elem() argument 94 fn update_elem(&mut self, key: &[u8], value: &[u8], _flags: u64) -> Result<()> { in update_elem() argument 110 fn delete_elem(&mut self, _key: &[u8]) -> Result<()> { in delete_elem() 113 fn for_each_elem(&mut self, cb: BpfCallBackFn, ctx: *const u8, flags: u64) -> Result<u32> { in for_each_elem() argument 131 fn lookup_and_delete_elem(&mut self, _key: &[u8], _value: &mut [u8]) -> Result<()> { in lookup_and_delete_elem() argument 135 fn get_next_key(&self, key: Option<&[u8]>, next_key: &mut [u8]) -> Result<()> { in get_next_key() argument 156 fn first_value_ptr(&self) -> Result<*const u8> { in first_value_ptr() argument 190 fn lookup_elem(&mut self, key: &[u8]) -> Result<Option<&[u8]>> { in lookup_elem() argument [all …]
|
H A D | mod.rs | 35 pub type BpfCallBackFn = fn(key: &[u8], value: &[u8], ctx: *const u8) -> i32; constant 41 fn lookup_elem(&mut self, _key: &[u8]) -> Result<Option<&[u8]>> { in lookup_elem() argument 47 fn update_elem(&mut self, _key: &[u8], _value: &[u8], _flags: u64) -> Result<()> { in update_elem() argument 53 fn delete_elem(&mut self, _key: &[u8]) -> Result<()> { in delete_elem() 60 fn for_each_elem(&mut self, _cb: BpfCallBackFn, _ctx: *const u8, _flags: u64) -> Result<u32> { in for_each_elem() argument 65 fn lookup_and_delete_elem(&mut self, _key: &[u8], _value: &mut [u8]) -> Result<()> { in lookup_and_delete_elem() argument 70 fn lookup_percpu_elem(&mut self, _key: &[u8], _cpu: u32) -> Result<Option<&[u8]>> { in lookup_percpu_elem() argument 76 fn get_next_key(&self, _key: Option<&[u8]>, _next_key: &mut [u8]) -> Result<()> { in get_next_key() argument 81 fn push_elem(&mut self, _value: &[u8], _flags: u64) -> Result<()> { in push_elem() argument 86 fn pop_elem(&mut self, _value: &mut [u8]) -> Result<()> { in pop_elem() [all …]
|
H A D | queue.rs | 9 type BpfQueueValue = Vec<u8>; 126 fn lookup_elem(&mut self, _key: &[u8]) -> Result<Option<&[u8]>> { in lookup_elem() argument 130 fn update_elem(&mut self, _key: &[u8], value: &[u8], flags: u64) -> Result<()> { in update_elem() argument 135 fn lookup_and_delete_elem(&mut self, _key: &[u8], value: &mut [u8]) -> Result<()> { in lookup_and_delete_elem() argument 143 fn push_elem(&mut self, value: &[u8], flags: u64) -> Result<()> { in push_elem() argument 146 fn pop_elem(&mut self, value: &mut [u8]) -> Result<()> { in pop_elem() 149 fn peek_elem(&self, value: &mut [u8]) -> Result<()> { in peek_elem()
|
/DragonOS/kernel/src/driver/pci/ |
H A D | pci.rs | 144 class_code: u8, in get_pci_device_structure_mut() argument 145 subclass: u8, in get_pci_device_structure_mut() argument 174 class_code: u8, in get_pci_device_structure() argument 175 subclass: u8, in get_pci_device_structure() argument 188 const BAR0_OFFSET: u8 = 0x10; 190 const STATUS_COMMAND_OFFSET: u8 = 0x04; 192 pub const PCI_CAP_ID_VNDR: u8 = 0x09; 193 pub const PCI_CAP_ID_MSI: u8 = 0x05; 194 pub const PCI_CAP_ID_MSIX: u8 = 0x11; 267 Unrecognised(u8), [all …]
|
H A D | attr.rs | 59 fn show(&self, _kobj: Arc<dyn KObject>, _buf: &mut [u8]) -> Result<usize, SystemError> { in show() 69 fn store(&self, _kobj: Arc<dyn KObject>, _buf: &[u8]) -> Result<usize, SystemError> { in store() 90 fn show(&self, _kobj: Arc<dyn KObject>, _buf: &mut [u8]) -> Result<usize, SystemError> { in show() 100 fn store(&self, _kobj: Arc<dyn KObject>, _buf: &[u8]) -> Result<usize, SystemError> { in store() 121 fn show(&self, _kobj: Arc<dyn KObject>, _buf: &mut [u8]) -> Result<usize, SystemError> { in show() 131 fn store(&self, _kobj: Arc<dyn KObject>, _buf: &[u8]) -> Result<usize, SystemError> { in store() 152 fn show(&self, _kobj: Arc<dyn KObject>, _buf: &mut [u8]) -> Result<usize, SystemError> { in show() 162 fn store(&self, _kobj: Arc<dyn KObject>, _buf: &[u8]) -> Result<usize, SystemError> { in store() 183 fn show(&self, _kobj: Arc<dyn KObject>, _buf: &mut [u8]) -> Result<usize, SystemError> { in show() 193 fn store(&self, _kobj: Arc<dyn KObject>, _buf: &[u8]) -> Result<usize, SystemError> { in store() [all …]
|
/DragonOS/kernel/src/arch/x86_64/driver/apic/ |
H A D | ioapic.rs | 58 pub const VECTOR_BASE: u8 = 32; 143 unsafe fn read(&mut self, reg: u8) -> u32 { in read() 155 unsafe fn write(&mut self, reg: u8, data: u32) { in write() argument 162 fn write_rte(&mut self, rte_index: u8, vector: u8, flags: RedirectionEntry, dest: u8) { in write_rte() argument 171 pub fn enable(&mut self, rte_index: u8) { in enable() argument 177 pub fn disable(&mut self, rte_index: u8) { in disable() argument 198 rte_index: u8, in install() argument 199 vector: u8, in install() argument 200 dest: u8, in install() argument 236 pub fn irq_vector(&mut self, irq: u8) -> u8 { in irq_vector() argument [all …]
|
/DragonOS/kernel/src/syscall/ |
H A D | user_access.rs | 32 let p = dest.data() as *mut u8; in clear_user() 38 pub unsafe fn copy_to_user(dest: VirtAddr, src: &[u8]) -> Result<usize, SystemError> { in copy_to_user() 41 let p = dest.data() as *mut u8; in copy_to_user() 48 pub unsafe fn copy_from_user(dst: &mut [u8], src: VirtAddr) -> Result<usize, SystemError> { in copy_from_user() argument 51 let src: &[u8] = core::slice::from_raw_parts(src.data() as *const u8, dst.len()); in copy_from_user() constant 76 user: *const u8, in check_and_clone_cstr() argument 120 pub fn check_and_clone_cstr_array(user: *const *const u8) -> Result<Vec<CString>, SystemError> { in check_and_clone_cstr_array() 128 let str_ptr: *const u8; in check_and_clone_cstr_array() constant 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() [all …]
|
H A D | mod.rs | 104 Self::put_string(args[0] as *const u8, args[1] as u32, args[2] as u32) in handle() constant 108 let path = args[0] as *const u8; in handle() constant 117 let oldname: *const u8 = args[0] as *const u8; in handle() constant 118 let newname: *const u8 = args[1] as *const u8; in handle() constant 131 let oldname: *const u8 = args[1] as *const u8; in handle() constant 133 let newname: *const u8 = args[3] as *const u8; in handle() constant 139 let oldname: *const u8 = args[1] as *const u8; in handle() constant 141 let newname: *const u8 = args[3] as *const u8; in handle() constant 148 let path = args[1] as *const u8; in handle() constant 164 UserBufferWriter::new(buf_vaddr as *mut u8, len, from_user)?; in handle() [all …]
|
/DragonOS/kernel/src/libs/ |
H A D | keyboard_parser.rs | 4 pub const NUM_SCAN_CODES: u8 = 0x80; 6 pub const TYPE1_KEYCODE_MAP_TABLE_COLS: u8 = 2; 9 pub const TYPE1_KEYCODE_FLAG_BREAK: u8 = 0x80; // 用于判断按键是否被按下 12 #[repr(u8)] 42 pub fn parse(&mut self, scancode: u8) -> TypeOneFSMState { in parse() 54 PauseBreak(u8), 60 PrtscPress(u8), 61 PrtscRelease(u8), 66 fn parse(&self, scancode: u8, scancode_status: &mut ScanCodeStatus) -> TypeOneFSMState { in parse() argument 89 fn handle_start(&self, scancode: u8, scancode_status: &mut ScanCodeStatus) -> TypeOneFSMState { in handle_start() argument [all …]
|
H A D | vec_cursor.rs | 14 data: Vec<u8>, 21 pub fn new(data: Vec<u8>) -> Self { in new() 36 pub fn get_mut(&mut self) -> &mut Vec<u8> { in get_mut() argument 41 pub fn get_ref(&self) -> &Vec<u8> { in get_ref() argument 46 pub fn read_u8(&mut self) -> Result<u8, SystemError> { in read_u8() argument 102 pub fn read_exact(&mut self, buf: &mut [u8]) -> Result<(), SystemError> { in read_exact() 151 pub fn write_u8(&mut self, value: u8) -> Result<u8, SystemError> { in write_u8() argument 168 self.data[self.pos] = (value & 0xff) as u8; in write_u16() 170 self.data[self.pos] = ((value >> 8) & 0xff) as u8; in write_u16() 183 self.data[self.pos] = ((value >> (i * 8)) & 0xff) as u8; in write_u32() [all …]
|
/DragonOS/kernel/src/mm/allocator/ |
H A D | kernel_allocator.rs | 24 unsafe fn local_alloc(&self, layout: Layout) -> *mut u8; in local_alloc() argument 25 unsafe fn local_alloc_zeroed(&self, layout: Layout) -> *mut u8; in local_alloc_zeroed() argument 26 unsafe fn local_dealloc(&self, ptr: *mut u8, layout: Layout); in local_dealloc() argument 32 unsafe fn alloc_in_buddy(&self, layout: Layout) -> Result<NonNull<[u8]>, AllocError> { in alloc_in_buddy() argument 47 virt_addr.data() as *mut u8, in alloc_in_buddy() 54 pub(super) unsafe fn free_in_buddy(&self, ptr: *mut u8, layout: Layout) { in free_in_buddy() argument 65 unsafe fn local_alloc(&self, layout: Layout) -> *mut u8 { in local_alloc() argument 79 unsafe fn local_alloc_zeroed(&self, layout: Layout) -> *mut u8 { in local_alloc_zeroed() argument 84 let ptr: *mut u8 = x.as_mut_ptr(); in local_alloc_zeroed() 97 unsafe fn local_dealloc(&self, ptr: *mut u8, layout: Layout) { in local_dealloc() argument [all …]
|
/DragonOS/kernel/src/driver/net/ |
H A D | sysfs.rs | 105 fn show(&self, kobj: Arc<dyn KObject>, buf: &mut [u8]) -> Result<usize, SystemError> { in show() 132 fn show(&self, _kobj: Arc<dyn KObject>, _buf: &mut [u8]) -> Result<usize, SystemError> { in show() 154 fn show(&self, _kobj: Arc<dyn KObject>, _buf: &mut [u8]) -> Result<usize, SystemError> { in show() 176 fn show(&self, _kobj: Arc<dyn KObject>, _buf: &mut [u8]) -> Result<usize, SystemError> { in show() 180 fn store(&self, _kobj: Arc<dyn KObject>, _buf: &[u8]) -> Result<usize, SystemError> { in store() 202 fn show(&self, _kobj: Arc<dyn KObject>, _buf: &mut [u8]) -> Result<usize, SystemError> { in show() 224 fn show(&self, _kobj: Arc<dyn KObject>, _buf: &mut [u8]) -> Result<usize, SystemError> { in show() 246 fn show(&self, _kobj: Arc<dyn KObject>, _buf: &mut [u8]) -> Result<usize, SystemError> { in show() 273 fn show(&self, kobj: Arc<dyn KObject>, buf: &mut [u8]) -> Result<usize, SystemError> { in show() 302 fn show(&self, _kobj: Arc<dyn KObject>, _buf: &mut [u8]) -> Result<usize, SystemError> { in show() [all …]
|
/DragonOS/kernel/src/bpf/helper/ |
H A D | mod.rs | 25 let key = core::slice::from_raw_parts(key as *const u8, key_size); in raw_map_lookup_elem() constant 36 pub fn map_lookup_elem(map: &Arc<BpfMap>, key: &[u8]) -> Result<Option<*const u8>> { in map_lookup_elem() argument 57 let data = core::slice::from_raw_parts(data as *const u8, size as usize); in raw_perf_event_output() constant 71 data: &[u8], in perf_event_output() argument 98 let dst = core::slice::from_raw_parts_mut(dst as *mut u8, size as usize); in raw_bpf_probe_read() 99 let src = core::slice::from_raw_parts(unsafe_ptr as *const u8, size as usize); in raw_bpf_probe_read() constant 112 pub fn bpf_probe_read(dst: &mut [u8], src: &[u8]) -> Result<()> { in bpf_probe_read() argument 128 let key = core::slice::from_raw_parts(key as *const u8, key_size); in raw_map_update_elem() constant 129 let value = core::slice::from_raw_parts(value as *const u8, value_size); in raw_map_update_elem() constant 138 pub fn map_update_elem(map: &Arc<BpfMap>, key: &[u8], value: &[u8], flags: u64) -> Result<()> { in map_update_elem() argument [all …]
|
/DragonOS/kernel/src/driver/video/fbdev/base/ |
H A D | fbsysfs.rs | 64 fn show(&self, kobj: Arc<dyn KObject>, buf: &mut [u8]) -> Result<usize, SystemError> { in show() 88 fn store(&self, _kobj: Arc<dyn KObject>, _buf: &[u8]) -> Result<usize, SystemError> { in store() 93 fn show(&self, kobj: Arc<dyn KObject>, buf: &mut [u8]) -> Result<usize, SystemError> { in show() 119 fn store(&self, _kobj: Arc<dyn KObject>, _buf: &[u8]) -> Result<usize, SystemError> { in store() 142 fn show(&self, _kobj: Arc<dyn KObject>, _buf: &mut [u8]) -> Result<usize, SystemError> { in show() 147 fn store(&self, _kobj: Arc<dyn KObject>, _buf: &[u8]) -> Result<usize, SystemError> { in store() 169 fn show(&self, _kobj: Arc<dyn KObject>, _buf: &mut [u8]) -> Result<usize, SystemError> { in show() 174 fn store(&self, _kobj: Arc<dyn KObject>, _buf: &[u8]) -> Result<usize, SystemError> { in store() 195 fn show(&self, kobj: Arc<dyn KObject>, buf: &mut [u8]) -> Result<usize, SystemError> { in show() 203 fn store(&self, _kobj: Arc<dyn KObject>, _buf: &[u8]) -> Result<usize, SystemError> { in store() [all …]
|
/DragonOS/kernel/crates/rbpf/tests/ |
H A D | common.rs | 56 pub const TCP_SACK_BIN: [u8; 352] = [ 82 pub const TCP_SACK_MATCH: [u8; 78] = [ 91 pub const TCP_SACK_NOMATCH: [u8; 66] = [
|
/DragonOS/kernel/src/driver/virtio/ |
H A D | virtio_impl.rs | 24 ) -> (virtio_drivers::PhysAddr, NonNull<u8>) { in dma_alloc() argument 35 core::ptr::write_bytes(virt.data() as *mut u8, 0, count.data() * MMArch::PAGE_SIZE); in dma_alloc() 56 vaddr: NonNull<u8>, in dma_dealloc() argument 86 unsafe fn mmio_phys_to_virt(paddr: virtio_drivers::PhysAddr, _size: usize) -> NonNull<u8> { in mmio_phys_to_virt() argument 93 buffer: NonNull<[u8]>, in share() argument 96 let vaddr = VirtAddr::new(buffer.as_ptr() as *mut u8 as usize); in share() 104 _buffer: NonNull<[u8]>, in unshare() argument
|
/DragonOS/kernel/src/filesystem/fat/ |
H A D | bpb.rs | 17 pub jmp_boot: [u8; 3], 20 pub oem_name: [u8; 8], 26 pub sector_per_cluster: u8, 32 pub num_fats: u8, 41 pub media: u8, 76 pub drive_num: u8, 78 pub reserved1: u8, 80 pub boot_sig: u8, 123 pub reserved0: [u8; 12], 127 pub drive_num: u8, [all …]
|
/DragonOS/kernel/src/process/ |
H A D | pid.rs | 3 #[repr(u8)] 16 *self as u8 == *other as u8 in eq()
|