From 5bf3269c8fc705c96765bfd7eba4b833ad94050d Mon Sep 17 00:00:00 2001 From: Alwin Berger Date: Wed, 16 Feb 2022 15:18:45 +0100 Subject: [PATCH] slim down generated code --- fuzzers/wcet_qemu_sys/src/freertos.rs | 425 +------------------------- 1 file changed, 9 insertions(+), 416 deletions(-) diff --git a/fuzzers/wcet_qemu_sys/src/freertos.rs b/fuzzers/wcet_qemu_sys/src/freertos.rs index 332ef5b672..aeeb2d51ba 100644 --- a/fuzzers/wcet_qemu_sys/src/freertos.rs +++ b/fuzzers/wcet_qemu_sys/src/freertos.rs @@ -3,16 +3,14 @@ use serde::{Deserialize, Serialize}; // Manual Types use libafl_qemu::Emulator; -pub type xLIST_ITEM_ptr = ::std::os::raw::c_uint; -pub type xLIST_ptr = ::std::os::raw::c_uint; +/*========== Start of generated Code =============*/ +pub type char_ptr = ::std::os::raw::c_uint; pub type ListItem_t_ptr = ::std::os::raw::c_uint; pub type StackType_t_ptr = ::std::os::raw::c_uint; -pub type char_ptr = ::std::os::raw::c_uint; pub type void_ptr = ::std::os::raw::c_uint; -pub type TCB_t_ptr = ::std::os::raw::c_uint; - - - +pub type tskTaskControlBlock_ptr = ::std::os::raw::c_uint; +pub type xLIST_ptr = ::std::os::raw::c_uint; +pub type xLIST_ITEM_ptr = ::std::os::raw::c_uint; /* automatically generated by rust-bindgen 0.59.2 */ pub type __uint8_t = ::std::os::raw::c_uchar; @@ -30,69 +28,6 @@ pub struct xLIST_ITEM { pub pvOwner: void_ptr, pub pvContainer: xLIST_ptr, } -#[test] -fn bindgen_test_layout_xLIST_ITEM() { - assert_eq!( - ::std::mem::size_of::(), - 40usize, - concat!("Size of: ", stringify!(xLIST_ITEM)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(xLIST_ITEM)) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).xItemValue as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(xLIST_ITEM), - "::", - stringify!(xItemValue) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).pxNext as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(xLIST_ITEM), - "::", - stringify!(pxNext) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).pxPrevious as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(xLIST_ITEM), - "::", - stringify!(pxPrevious) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).pvOwner as *const _ as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(xLIST_ITEM), - "::", - stringify!(pvOwner) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).pvContainer as *const _ as usize }, - 32usize, - concat!( - "Offset of field: ", - stringify!(xLIST_ITEM), - "::", - stringify!(pvContainer) - ) - ); -} pub type ListItem_t = xLIST_ITEM; #[repr(C)] #[derive(Debug, Copy, Clone, Default, Serialize, Deserialize)] @@ -101,49 +36,6 @@ pub struct xMINI_LIST_ITEM { pub pxNext: xLIST_ITEM_ptr, pub pxPrevious: xLIST_ITEM_ptr, } -#[test] -fn bindgen_test_layout_xMINI_LIST_ITEM() { - assert_eq!( - ::std::mem::size_of::(), - 24usize, - concat!("Size of: ", stringify!(xMINI_LIST_ITEM)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(xMINI_LIST_ITEM)) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).xItemValue as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(xMINI_LIST_ITEM), - "::", - stringify!(xItemValue) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).pxNext as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(xMINI_LIST_ITEM), - "::", - stringify!(pxNext) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).pxPrevious as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(xMINI_LIST_ITEM), - "::", - stringify!(pxPrevious) - ) - ); -} pub type MiniListItem_t = xMINI_LIST_ITEM; #[repr(C)] #[derive(Debug, Copy, Clone, Default, Serialize, Deserialize)] @@ -152,51 +44,8 @@ pub struct xLIST { pub pxIndex: ListItem_t_ptr, pub xListEnd: MiniListItem_t, } -#[test] -fn bindgen_test_layout_xLIST() { - assert_eq!( - ::std::mem::size_of::(), - 40usize, - concat!("Size of: ", stringify!(xLIST)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(xLIST)) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).uxNumberOfItems as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(xLIST), - "::", - stringify!(uxNumberOfItems) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).pxIndex as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(xLIST), - "::", - stringify!(pxIndex) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).xListEnd as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(xLIST), - "::", - stringify!(xListEnd) - ) - ); -} pub type List_t = xLIST; -pub type TaskHandle_t = ::std::os::raw::c_uint; +pub type TaskHandle_t = tskTaskControlBlock_ptr; pub const eTaskState_eRunning: eTaskState = 0; pub const eTaskState_eReady: eTaskState = 1; pub const eTaskState_eBlocked: eTaskState = 2; @@ -205,7 +54,7 @@ pub const eTaskState_eDeleted: eTaskState = 4; pub const eTaskState_eInvalid: eTaskState = 5; pub type eTaskState = ::std::os::raw::c_uint; #[repr(C)] -#[derive(Debug, Copy, Clone, Serialize, Deserialize)] +#[derive(Debug, Copy, Clone, Default, Serialize, Deserialize)] pub struct xTASK_STATUS { pub xHandle: TaskHandle_t, pub pcTaskName: char_ptr, @@ -217,111 +66,6 @@ pub struct xTASK_STATUS { pub pxStackBase: StackType_t_ptr, pub usStackHighWaterMark: u16, } -#[test] -fn bindgen_test_layout_xTASK_STATUS() { - assert_eq!( - ::std::mem::size_of::(), - 72usize, - concat!("Size of: ", stringify!(xTASK_STATUS)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(xTASK_STATUS)) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).xHandle as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(xTASK_STATUS), - "::", - stringify!(xHandle) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).pcTaskName as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(xTASK_STATUS), - "::", - stringify!(pcTaskName) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).xTaskNumber as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(xTASK_STATUS), - "::", - stringify!(xTaskNumber) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).eCurrentState as *const _ as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(xTASK_STATUS), - "::", - stringify!(eCurrentState) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).uxCurrentPriority as *const _ as usize }, - 32usize, - concat!( - "Offset of field: ", - stringify!(xTASK_STATUS), - "::", - stringify!(uxCurrentPriority) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).uxBasePriority as *const _ as usize }, - 40usize, - concat!( - "Offset of field: ", - stringify!(xTASK_STATUS), - "::", - stringify!(uxBasePriority) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).ulRunTimeCounter as *const _ as usize }, - 48usize, - concat!( - "Offset of field: ", - stringify!(xTASK_STATUS), - "::", - stringify!(ulRunTimeCounter) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).pxStackBase as *const _ as usize }, - 56usize, - concat!( - "Offset of field: ", - stringify!(xTASK_STATUS), - "::", - stringify!(pxStackBase) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).usStackHighWaterMark as *const _ as usize - }, - 64usize, - concat!( - "Offset of field: ", - stringify!(xTASK_STATUS), - "::", - stringify!(usStackHighWaterMark) - ) - ); -} pub type TaskStatus_t = xTASK_STATUS; #[repr(C)] #[derive(Debug, Copy, Clone, Default, Serialize, Deserialize)] @@ -331,7 +75,7 @@ pub struct tskTaskControlBlock { pub xEventListItem: ListItem_t, pub uxPriority: UBaseType_t, pub pxStack: StackType_t_ptr, - pub pcTaskName: [::std::os::raw::c_uchar; 10usize], + pub pcTaskName: [::std::os::raw::c_char; 10usize], pub uxBasePriority: UBaseType_t, pub uxMutexesHeld: UBaseType_t, pub ulNotifiedValue: [u32; 1usize], @@ -339,160 +83,9 @@ pub struct tskTaskControlBlock { pub ucStaticallyAllocated: u8, pub ucDelayAborted: u8, } -#[test] -fn bindgen_test_layout_tskTaskControlBlock() { - assert_eq!( - ::std::mem::size_of::(), - 152usize, - concat!("Size of: ", stringify!(tskTaskControlBlock)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(tskTaskControlBlock)) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).pxTopOfStack as *const _ as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(tskTaskControlBlock), - "::", - stringify!(pxTopOfStack) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).xStateListItem as *const _ as usize - }, - 8usize, - concat!( - "Offset of field: ", - stringify!(tskTaskControlBlock), - "::", - stringify!(xStateListItem) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).xEventListItem as *const _ as usize - }, - 48usize, - concat!( - "Offset of field: ", - stringify!(tskTaskControlBlock), - "::", - stringify!(xEventListItem) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).uxPriority as *const _ as usize }, - 88usize, - concat!( - "Offset of field: ", - stringify!(tskTaskControlBlock), - "::", - stringify!(uxPriority) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).pxStack as *const _ as usize }, - 96usize, - concat!( - "Offset of field: ", - stringify!(tskTaskControlBlock), - "::", - stringify!(pxStack) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).pcTaskName as *const _ as usize }, - 104usize, - concat!( - "Offset of field: ", - stringify!(tskTaskControlBlock), - "::", - stringify!(pcTaskName) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).uxBasePriority as *const _ as usize - }, - 120usize, - concat!( - "Offset of field: ", - stringify!(tskTaskControlBlock), - "::", - stringify!(uxBasePriority) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).uxMutexesHeld as *const _ as usize - }, - 128usize, - concat!( - "Offset of field: ", - stringify!(tskTaskControlBlock), - "::", - stringify!(uxMutexesHeld) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).ulNotifiedValue as *const _ as usize - }, - 136usize, - concat!( - "Offset of field: ", - stringify!(tskTaskControlBlock), - "::", - stringify!(ulNotifiedValue) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).ucNotifyState as *const _ as usize - }, - 144usize, - concat!( - "Offset of field: ", - stringify!(tskTaskControlBlock), - "::", - stringify!(ucNotifyState) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).ucStaticallyAllocated as *const _ - as usize - }, - 145usize, - concat!( - "Offset of field: ", - stringify!(tskTaskControlBlock), - "::", - stringify!(ucStaticallyAllocated) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).ucDelayAborted as *const _ as usize - }, - 146usize, - concat!( - "Offset of field: ", - stringify!(tskTaskControlBlock), - "::", - stringify!(ucDelayAborted) - ) - ); -} pub type tskTCB = tskTaskControlBlock; pub type TCB_t = tskTCB; +/*========== End of generated Code =============*/ pub trait emu_lookup { fn lookup(emu: &Emulator, addr: ::std::os::raw::c_uint) -> Self;