mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-04-24 07:21:57 -04:00
Fix potential memory leak in the Win32 FreeRTOS+TCP network interface initialisation sequence.
Introduce portMEMORY_BARRIER() macro to assist with memory access ordering when suspending the scheduler if link time optimization is used.
This commit is contained in:
parent
dd9a9710c6
commit
606845492b
|
@ -389,6 +389,8 @@ uint32_t ulNetMask;
|
||||||
{
|
{
|
||||||
printf( "\nAn error occurred setting the packet filter.\n" );
|
printf( "\nAn error occurred setting the packet filter.\n" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pcap_freecode( &xFilterCode );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Create the buffers used to pass packets between the FreeRTOS simulator
|
/* Create the buffers used to pass packets between the FreeRTOS simulator
|
||||||
|
|
|
@ -241,6 +241,10 @@ extern "C" {
|
||||||
#define configASSERT_DEFINED 1
|
#define configASSERT_DEFINED 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef portMEMORY_BARRIER
|
||||||
|
#define portMEMORY_BARRIER()
|
||||||
|
#endif
|
||||||
|
|
||||||
/* The timers module relies on xTaskGetSchedulerState(). */
|
/* The timers module relies on xTaskGetSchedulerState(). */
|
||||||
#if configUSE_TIMERS == 1
|
#if configUSE_TIMERS == 1
|
||||||
|
|
||||||
|
|
|
@ -25,19 +25,6 @@
|
||||||
* 1 tab == 4 spaces!
|
* 1 tab == 4 spaces!
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if __riscv_xlen == 64
|
|
||||||
#error Not implemented yet - change lw to ld, and sw to sd.
|
|
||||||
#define portWORD_SIZE 8
|
|
||||||
#define store_x sd
|
|
||||||
#define load_x ld
|
|
||||||
#elif __riscv_xlen == 32
|
|
||||||
#define portWORD_SIZE 4
|
|
||||||
#define store_x sw
|
|
||||||
#define load_x lw
|
|
||||||
#else
|
|
||||||
#error Assembler did not define __riscv_xlen
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The FreeRTOS kernel's RISC-V port is split between the the code that is
|
* The FreeRTOS kernel's RISC-V port is split between the the code that is
|
||||||
* common across all currently supported RISC-V chips (implementations of the
|
* common across all currently supported RISC-V chips (implementations of the
|
||||||
|
@ -68,6 +55,18 @@
|
||||||
* registers.
|
* registers.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
#if __riscv_xlen == 64
|
||||||
|
#define portWORD_SIZE 8
|
||||||
|
#define store_x sd
|
||||||
|
#define load_x ld
|
||||||
|
#elif __riscv_xlen == 32
|
||||||
|
#define store_x sw
|
||||||
|
#define load_x lw
|
||||||
|
#define portWORD_SIZE 4
|
||||||
|
#else
|
||||||
|
#error Assembler did not define __riscv_xlen
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "freertos_risc_v_chip_specific_extensions.h"
|
#include "freertos_risc_v_chip_specific_extensions.h"
|
||||||
|
|
||||||
/* Check the freertos_risc_v_chip_specific_extensions.h and/or command line
|
/* Check the freertos_risc_v_chip_specific_extensions.h and/or command line
|
||||||
|
|
|
@ -44,14 +44,25 @@ extern "C" {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Type definitions. */
|
/* Type definitions. */
|
||||||
#define portSTACK_TYPE uint32_t
|
#if __riscv_xlen == 64
|
||||||
#define portBASE_TYPE long
|
#define portSTACK_TYPE uint64_t
|
||||||
|
#define portBASE_TYPE int64_t
|
||||||
|
#define portUBASE_TYPE uint64_t
|
||||||
|
#define portMAX_DELAY ( TickType_t ) 0xffffffffffffffffUL
|
||||||
|
#elif __riscv_xlen == 32
|
||||||
|
#define portSTACK_TYPE uint32_t
|
||||||
|
#define portBASE_TYPE int32_t
|
||||||
|
#define portUBASE_TYPE uint32_t
|
||||||
|
#define portMAX_DELAY ( TickType_t ) 0xffffffffUL
|
||||||
|
#else
|
||||||
|
#error Assembler did not define __riscv_xlen
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
typedef portSTACK_TYPE StackType_t;
|
typedef portSTACK_TYPE StackType_t;
|
||||||
typedef long BaseType_t;
|
typedef portBASE_TYPE BaseType_t;
|
||||||
typedef unsigned long UBaseType_t;
|
typedef portUBASE_TYPE UBaseType_t;
|
||||||
typedef uint32_t TickType_t;
|
typedef portUBASE_TYPE TickType_t;
|
||||||
#define portMAX_DELAY ( TickType_t ) 0xffffffffUL
|
|
||||||
|
|
||||||
/* 32-bit tick type on a 32-bit architecture, so reads of the tick count do
|
/* 32-bit tick type on a 32-bit architecture, so reads of the tick count do
|
||||||
not need to be guarded with a critical section. */
|
not need to be guarded with a critical section. */
|
||||||
|
|
|
@ -2104,6 +2104,7 @@ void vTaskSuspendAll( void )
|
||||||
post in the FreeRTOS support forum before reporting this as a bug! -
|
post in the FreeRTOS support forum before reporting this as a bug! -
|
||||||
http://goo.gl/wu4acr */
|
http://goo.gl/wu4acr */
|
||||||
++uxSchedulerSuspended;
|
++uxSchedulerSuspended;
|
||||||
|
portMEMORY_BARRIER();
|
||||||
}
|
}
|
||||||
/*----------------------------------------------------------*/
|
/*----------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue