/DragonOS/kernel/src/bpf/helper/ |
H A D | consts.rs | 1 pub const HELPER_MAP_LOOKUP_ELEM: u32 = 1; 2 pub const HELPER_MAP_UPDATE_ELEM: u32 = 2; 3 pub const HELPER_MAP_DELETE_ELEM: u32 = 3; 4 pub const HELPER_MAP_FOR_EACH_ELEM: u32 = 164; 5 pub const HELPER_MAP_LOOKUP_PERCPU_ELEM: u32 = 195; 6 pub const HELPER_PERF_EVENT_OUTPUT: u32 = 25; 7 pub const HELPER_BPF_PROBE_READ: u32 = 4; 8 pub const HELPER_TRACE_PRINTF: u32 = 6; 9 pub const HELPER_MAP_PUSH_ELEM: u32 = 87; 10 pub const HELPER_MAP_POP_ELEM: u32 = 88; [all …]
|
/DragonOS/kernel/src/driver/disk/ahci/ |
H A D | hba.rs | 21 pub const HBA_PORT_CMD_CR: u32 = 1 << 15; 22 pub const HBA_PORT_CMD_FR: u32 = 1 << 14; 23 pub const HBA_PORT_CMD_FRE: u32 = 1 << 4; 24 pub const HBA_PORT_CMD_ST: u32 = 1; 26 pub const HBA_PORT_IS_ERR: u32 = 1 << 30 | 1 << 29 | 1 << 28 | 1 << 27; 27 pub const HBA_SSTS_PRESENT: u32 = 0x3; 28 pub const HBA_SIG_ATA: u32 = 0x00000101; 29 pub const HBA_SIG_ATAPI: u32 = 0xEB140101; 30 pub const HBA_SIG_PM: u32 = 0x96690101; 31 pub const HBA_SIG_SEMB: u32 = 0xC33C0101; [all …]
|
/DragonOS/kernel/src/arch/x86_64/kvm/vmx/ |
H A D | vcpu.rs | 35 pub revision_id: u32, 80 pub vcpu_id: u32, 137 let revision_id = unsafe { (msr::rdmsr(msr::IA32_VMX_BASIC) as u32) & 0x7FFF_FFFF }; in init_region() 155 pub fn new(vcpu_id: u32, parent_vm: Vm) -> Result<Self, SystemError> { in new() argument 176 vmx_vmwrite(VmcsFields::GUEST_CR0 as u32, cr0.bits() as u64)?; in vmx_set_cr0() 184 vmx_vmwrite(VmcsFields::GUEST_CS_SELECTOR as u32, 0xf000)?; in vmcs_init_guest() 185 vmx_vmwrite(VmcsFields::GUEST_CS_BASE as u32, 0xffff0000)?; in vmcs_init_guest() 193 vmx_vmwrite(VmcsFields::GUEST_TR_SELECTOR as u32, 0)?; in vmcs_init_guest() 194 vmx_vmwrite(VmcsFields::GUEST_TR_BASE as u32, 0)?; in vmcs_init_guest() 195 vmx_vmwrite(VmcsFields::GUEST_TR_LIMIT as u32, 0xffff)?; in vmcs_init_guest() [all …]
|
H A D | vmexit.rs | 61 let valid: u32 = 1; in vmexit_vmx_instruction_executed() 62 let vector: u32 = APICExceptionVectors::EXCEPTION_UNDEFINED_OPCODE as u32; in vmexit_vmx_instruction_executed() 63 let interrupt_type = InterruptType::INTERRUPT_TYPE_HARDWARE_EXCEPTION as u32; in vmexit_vmx_instruction_executed() 64 let deliver_code: u32 = 0; in vmexit_vmx_instruction_executed() 67 VmcsFields::CTRL_VM_ENTRY_INTR_INFO_FIELD as u32, in vmexit_vmx_instruction_executed() 70 vmx_vmwrite(VmcsFields::CTRL_VM_ENTRY_INSTR_LEN as u32, 0)?; 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() 72 vmx_vmwrite(VmcsFields::GUEST_RFLAGS as u32, rflags)?; in vmexit_vmx_instruction_executed() 188 let exit_reason = vmx_vmread(VmcsFields::VMEXIT_EXIT_REASON as u32).unwrap() as u32; in vmexit_handler() 190 let guest_rip = vmx_vmread(VmcsFields::GUEST_RIP as u32).unwrap(); in vmexit_handler() [all …]
|
/DragonOS/kernel/src/arch/x86_64/interrupt/ |
H A D | msi.rs | 10 #[bitfield(u32)] 31 pub dmar_subhandle: u32, 36 pub const fn new(dmar_subhandle: u32) -> Self { in new() 41 pub const X86_MSI_BASE_ADDRESS_LOW: u32 = 0xfee00000 >> 20; 50 #[bitfield(u32)] 53 reserved_0: u32, 61 pub virt_destid_8_14: u32, 63 pub destid_0_7: u32, 65 pub base_address: u32, 68 #[bitfield(u32)] [all …]
|
/DragonOS/kernel/src/driver/net/e1000e/ |
H A D | e1000e.rs | 49 const E1000E_BAR_REG_SIZE: u32 = 128 * 1024; 347 volwrite!(receive_regs, rdbal0, (recv_ring_pa) as u32); in new() 348 volwrite!(receive_regs, rdbah0, (recv_ring_pa >> 32) as u32); in new() 351 volwrite!(receive_regs, rdlen0, PAGE_SIZE as u32); in new() 355 volwrite!(receive_regs, rdt0, (recv_ring_length - 1) as u32); in new() 378 volwrite!(transimit_regs, tdbal0, trans_ring_pa as u32); in new() 379 volwrite!(transimit_regs, tdbah0, (trans_ring_pa >> 32) as u32); in new() 381 volwrite!(transimit_regs, tdlen0, PAGE_SIZE as u32); in new() 442 unsafe { volwrite!(self.receive_regs, rdt0, rdt as u32) }; in e1000e_receive() 471 unsafe { volwrite!(self.transimit_regs, tdt0, tdt as u32) }; in e1000e_transmit() [all …]
|
/DragonOS/kernel/src/libs/font/ |
H A D | mod.rs | 9 pub width: u32, 10 pub height: u32, 11 pub char_count: u32, 16 pub fn get_default_font(_xres: u32, _yres: u32, _font_w: u32, _font_h: u32) -> &'static Self { in get_default_font() argument 21 pub const DOUBLE_WIDTH_RANGE: &'static [(u32, u32)] = &[ 35 pub fn is_double_width(ch: u32) -> bool { in is_double_width()
|
/DragonOS/user/apps/test_statx/src/ |
H A D | main.rs | 8 pub stx_mask: u32, 9 pub stx_blksize: u32, 11 pub stx_nlink: u32, 12 pub stx_uid: u32, 13 pub stx_gid: u32, 24 pub stx_rdev_major: u32, 25 pub stx_rdev_minor: u32, 26 pub stx_dev_major: u32, 27 pub stx_dev_minor: u32, 29 pub stx_dio_mem_align: u32, [all …]
|
/DragonOS/kernel/src/driver/base/device/ |
H A D | device_number.rs | 2 pub struct Major(u32); 27 pub const fn new(x: u32) -> Self { in new() 30 pub const fn data(&self) -> u32 { in data() argument 37 data: u32, 41 pub const MINOR_BITS: u32 = 20; 42 pub const MINOR_MASK: u32 = (1 << Self::MINOR_BITS) - 1; 44 pub const fn new(major: Major, minor: u32) -> Self { in new() 54 pub const fn minor(&self) -> u32 { in minor() argument 58 pub const fn data(&self) -> u32 { in data() argument 69 impl From<u32> for DeviceNumber { [all …]
|
/DragonOS/kernel/src/driver/video/fbdev/base/ |
H A D | render_helper.rs | 8 fgcolor: u32, 9 bkcolor: u32, 14 byte_per_pixel: u32, 15 buffer: u32, 17 left_byte: u32, 19 consumed_bit: u32, 20 image_width: u32, 25 fgcolor: u32, in new() argument 26 bkcolor: u32, in new() argument 29 byte_per_pixel: u32, in new() argument [all …]
|
H A D | mod.rs | 17 const COLOR_TABLE_8: &[u32] = &[ 22 const COLOR_TABLE_16: &[u32] = &[0x00000000, 0xffff0000, 0x0000ffff, 0xffffffff]; 24 const COLOR_TABLE_32: &[u32] = &[0x00000000, 0xffffffff]; 32 int_like!(FbId, u32); 44 pub const INIT: Self = Self::new(u32::MAX); 49 if self.0 == Self::INIT.0 || self.0 >= FrameBufferManager::FB_MAX as u32 { in is_valid() 69 let byte_per_pixel = core::mem::size_of::<u32>() as u32; in generic_imageblit() 124 unsafe fn fast_imageblit(&self, image: &FbImage, dst1: &mut FrameP, fg: u32, bg: u32) { in fast_imageblit() argument 130 let mut color_tab: [u32; 16] = [0; 16]; in fast_imageblit() 132 let tab: &[u32] = match bpp { in fast_imageblit() [all …]
|
/DragonOS/kernel/src/arch/x86_64/mm/ |
H A D | pkru.rs | 27 const PKRU_BITS_PER_PKEY: u32 = 2; 42 pub fn pkru_allows_read(pkru: u32, pkey: u16) -> bool { in pkru_allows_read() argument 43 let pkru_pkey_bits: u32 = pkey as u32 * PKRU_BITS_PER_PKEY; in pkru_allows_read() 44 pkru & ((PKRU_AD_BIT as u32) << pkru_pkey_bits) > 0 in pkru_allows_read() 47 pub fn pkru_allows_write(pkru: u32, pkey: u16) -> bool { in pkru_allows_write() argument 48 let pkru_pkey_bits: u32 = pkey as u32 * PKRU_BITS_PER_PKEY; in pkru_allows_write() 49 pkru & (((PKRU_AD_BIT | PKRU_WD_BIT) as u32) << pkru_pkey_bits) > 0 in pkru_allows_write() 52 pub fn read_pkru() -> u32 { in read_pkru()
|
/DragonOS/kernel/src/driver/pci/ |
H A D | dev_id.rs | 4 const PCI_ANY_ID: u32 = 0xffff_ffff; 11 vendor: u32, 12 device_id: u32, 13 subvendor: u32, 14 subdevice: u32, 15 class: u32, 16 class_mask: u32, 18 _override_only: u32, 73 pub fn vendor(&self) -> u32 { in vendor() argument 77 pub fn device_id(&self) -> u32 { in device_id() argument [all …]
|
/DragonOS/user/apps/test_ebpf/syscall_ebpf/syscall_ebpf-ebpf/src/ |
H A D | main.rs | 10 pub fn syscall_ebpf(ctx: ProbeContext) -> u32 { in syscall_ebpf() argument 14 fn try_syscall_ebpf(ctx: ProbeContext) -> Result<u32, u32> { in try_syscall_ebpf() argument 25 if let Some(v) = SYSCALL_LIST.get(&(syscall_num as u32)){ in try_syscall_ebpf() 27 SYSCALL_LIST.insert(&(syscall_num as u32), &new_v,0).unwrap(); in try_syscall_ebpf() 29 SYSCALL_LIST.insert(&(syscall_num as u32), &1,0).unwrap(); in try_syscall_ebpf() 38 static SYSCALL_LIST: HashMap<u32, u32> = 39 HashMap::<u32, u32>::with_max_entries(1024, 0);
|
/DragonOS/kernel/src/cgroup/ |
H A D | mod.rs | 13 level: u32, 15 max_depth: u32, 17 nr_descendants: u32, 19 nr_dying_descendants: u32, 21 max_descendants: u32, 23 nr_populated_csets: u32, 25 nr_populated_domain_children: u32, 27 nr_populated_threaded_children: u32, 29 nr_threaded_children: u32,
|
/DragonOS/kernel/src/libs/futex/ |
H A D | constant.rs | 2 pub struct FutexArg: u32 { 19 pub struct FutexFlag: u32 { 29 pub struct FutexOP: u32 { 38 pub struct FutexOpCMP: u32 { 49 pub const FUTEX_WAITERS: u32 = 0x80000000; 51 pub const FUTEX_OWNER_DIED: u32 = 0x40000000; 53 pub const FUTEX_TID_MASK: u32 = 0x3fffffff; 54 pub const FUTEX_BITSET_MATCH_ANY: u32 = 0xffffffff;
|
/DragonOS/kernel/src/arch/x86_64/pci/ |
H A D | pci.rs | 28 | ((bus as u32) << 16) in read_config_early() 29 | ((slot as u32) << 11) in read_config_early() 30 | ((func as u32) << 8) in read_config_early() 31 | offset as u32, in read_config_early() 40 fn read_config(bus_device_function: &BusDeviceFunction, offset: u8) -> u32 { in read_config() argument 42 let address = ((bus_device_function.bus as u32) << 16) in read_config() 43 | ((bus_device_function.device as u32) << 11) in read_config() 44 | ((bus_device_function.function as u32 & 7) << 8) in read_config() 45 | (offset & 0xfc) as u32 in read_config() 55 fn write_config(bus_device_function: &BusDeviceFunction, offset: u8, data: u32) { in write_config() argument [all …]
|
/DragonOS/kernel/src/exception/ |
H A D | msi.rs | 15 pub address_lo: u32, 16 pub address_hi: u32, 17 pub data: u32, 33 pub const fn new(address: u64, data: u32) -> Self { in new() 35 address_lo: address as u32, in new() 36 address_hi: (address >> 32) as u32, in new() 42 pub const fn new_lo_hi(address_lo: u32, address_hi: u32, data: u32) -> Self { in new_lo_hi() argument 76 nvec_used: u32, 86 index: u32, 95 nvec_used: u32, in new() argument [all …]
|
/DragonOS/kernel/src/sched/ |
H A D | pelt.rs | 12 const RUNNABLE_AVG_Y_N_INV: [u32; 32] = [ 34 pub period_contrib: u32, 50 load: u32, in update_load_sum() argument 51 mut runnable: u32, in update_load_sum() argument 52 mut running: u32, in update_load_sum() argument 79 load: u32, in accumulate_sum() argument 80 runnable: u32, in accumulate_sum() argument 81 running: u32, in accumulate_sum() argument 83 let mut contrib = delta as u32; in accumulate_sum() 99 delta as u32, in accumulate_sum() [all …]
|
/DragonOS/kernel/src/arch/x86_64/ |
H A D | msi.rs | 5 pub fn arch_msi_message_address(processor: u16) -> u32 { in arch_msi_message_address() argument 6 0xfee00000 | ((processor as u32) << 12) in arch_msi_message_address() 13 pub fn arch_msi_message_data(vector: u16, _processor: u16, trigger: TriggerMode) -> u32 { in arch_msi_message_data() argument 15 TriggerMode::EdgeTrigger => vector as u32, in arch_msi_message_data() 16 TriggerMode::AssertHigh => vector as u32 | 1 << 15 | 1 << 14, in arch_msi_message_data() 17 TriggerMode::AssertLow => vector as u32 | 1 << 15, in arch_msi_message_data()
|
/DragonOS/kernel/src/process/ |
H A D | c_adapter.rs | 12 unsafe extern "C" fn rs_get_idle_stack_top(cpu_id: u32) -> usize { in rs_get_idle_stack_top() 20 unsafe extern "C" fn rs_current_pcb_cpuid() -> u32 { in rs_current_pcb_cpuid() 25 unsafe extern "C" fn rs_current_pcb_pid() -> u32 { in rs_current_pcb_pid() 27 return ProcessManager::current_pcb().pid().0 as u32; in rs_current_pcb_pid() 33 unsafe extern "C" fn rs_current_pcb_preempt_count() -> u32 { in rs_current_pcb_preempt_count() 37 return ProcessManager::current_pcb().preempt_count() as u32; in rs_current_pcb_preempt_count() 41 unsafe extern "C" fn rs_current_pcb_flags() -> u32 { in rs_current_pcb_flags() 45 return ProcessManager::current_pcb().flags().bits() as u32; in rs_current_pcb_flags()
|
/DragonOS/kernel/crates/rbpf/src/ |
H A D | interpreter.rs | 87 helpers: &HashMap<u32, ebpf::Helper>, in execute_program() argument 89 const U32MAX: u64 = u32::MAX as u64; in execute_program() 145 let x = (mem.as_ptr() as u64 + (insn.imm as u32) as u64) as *const u8; in execute_program() 152 let x = (mem.as_ptr() as u64 + (insn.imm as u32) as u64) as *const u16; in execute_program() 159 let x = (mem.as_ptr() as u64 + (insn.imm as u32) as u64) as *const u32; in execute_program() constant 167 let x = (mem.as_ptr() as u64 + (insn.imm as u32) as u64) as *const u64; in execute_program() 175 (mem.as_ptr() as u64 + reg[_src] + (insn.imm as u32) as u64) as *const u8; in execute_program() 183 (mem.as_ptr() as u64 + reg[_src] + (insn.imm as u32) as u64) as *const u16; in execute_program() 191 (mem.as_ptr() as u64 + reg[_src] + (insn.imm as u32) as u64) as *const u32; in execute_program() constant 199 (mem.as_ptr() as u64 + reg[_src] + (insn.imm as u32) as u64) as *const u64; in execute_program() [all …]
|
/DragonOS/kernel/src/time/ |
H A D | jiffies.rs | 19 pub const JIFFIES_SHIFT: u32 = 8; 20 pub const LATCH: u32 = (CLOCK_TICK_RATE + (HZ as u32) / 2) / HZ as u32; 21 pub const ACTHZ: u32 = sh_div(CLOCK_TICK_RATE, LATCH, 8); 22 pub const TICK_NESC: u32 = (NSEC_PER_SEC + (HZ as u32) / 2) / HZ as u32; 24 pub const NSEC_PER_JIFFY: u32 = (((NSEC_PER_SEC as u64) << 8) / ACTHZ as u64) as u32; 25 pub const fn sh_div(nom: u32, den: u32, lsh: u32) -> u32 { in sh_div() argument
|
/DragonOS/kernel/src/arch/x86_64/driver/apic/ |
H A D | xapic.rs | 34 #[repr(u32)] 95 impl From<XApicOffset> for u32 { implementation 97 val as u32 in from() 131 pub unsafe fn read(&self, reg: XApicOffset) -> u32 { in read() argument 132 read_volatile((self.apic_vaddr.data() + reg as usize) as *const u32) in read() constant 137 pub unsafe fn write(&self, reg: XApicOffset, value: u32) { in write() argument 139 (self.apic_vaddr.data() + (reg as u32) as usize) as *mut u32, in write() 179 const X1: u32 = 0x0000000B; // 将除数设置为1,即不除频率 181 const PERIODIC: u32 = 0x00020000; // 周期性模式 183 const ENABLE: u32 = 0x00000100; // 单元使能 [all …]
|
/DragonOS/kernel/src/driver/tty/ |
H A D | tty_core.rs | 170 pub fn tty_mode_ioctl(tty: Arc<TtyCore>, cmd: u32, arg: usize) -> Result<usize, SystemError> { in tty_mode_ioctl() argument 505 let mut ch: u32 = 0; in do_write() 514 ch = buf[offset] as u32; in do_write() 591 fn ioctl(&self, tty: Arc<TtyCore>, cmd: u32, arg: usize) -> Result<(), SystemError> { in ioctl() argument 619 pub struct TtyFlag: u32 { 701 pub const TCGETS: u32 = 0x5401; 703 pub const TCSETS: u32 = 0x5402; 705 pub const TCSETSW: u32 = 0x5403; 707 pub const TCSETSF: u32 = 0x5404; 709 pub const TCGETA: u32 = 0x5405; [all …]
|