mirror of
https://github.com/espressif/esp-idf.git
synced 2024-09-19 14:26:01 -04:00
espcoredump: fix unsigned arithmetic
This commit is contained in:
parent
57785e5eca
commit
45f267390b
@ -1,16 +1,8 @@
|
|||||||
// Copyright 2015-2019 Espressif Systems (Shanghai) PTE LTD
|
/*
|
||||||
//
|
* SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
*
|
||||||
// you may not use this file except in compliance with the License.
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
// You may obtain a copy of the License at
|
*/
|
||||||
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
// See the License for the specific language governing permissions and
|
|
||||||
// limitations under the License.
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @file
|
* @file
|
||||||
@ -40,6 +32,7 @@ const static DRAM_ATTR char TAG[] __attribute__((unused)) = "esp_core_dump_port"
|
|||||||
#if CONFIG_ESP_COREDUMP_ENABLE
|
#if CONFIG_ESP_COREDUMP_ENABLE
|
||||||
|
|
||||||
#define min(a,b) ((a) < (b) ? (a) : (b))
|
#define min(a,b) ((a) < (b) ? (a) : (b))
|
||||||
|
#define max(a,b) ((a) < (b) ? (b) : (a))
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Union representing the registers of the CPU as they will be written
|
* Union representing the registers of the CPU as they will be written
|
||||||
@ -259,8 +252,9 @@ bool esp_core_dump_check_stack(core_dump_task_header_t *task)
|
|||||||
uint32_t esp_core_dump_get_stack(core_dump_task_header_t *task,
|
uint32_t esp_core_dump_get_stack(core_dump_task_header_t *task,
|
||||||
uint32_t* stk_vaddr, uint32_t* stk_paddr)
|
uint32_t* stk_vaddr, uint32_t* stk_paddr)
|
||||||
{
|
{
|
||||||
const uint32_t stack_len = abs(task->stack_start - task->stack_end);
|
|
||||||
const uint32_t stack_addr = min(task->stack_start, task->stack_end);
|
const uint32_t stack_addr = min(task->stack_start, task->stack_end);
|
||||||
|
const uint32_t stack_addr2 = max(task->stack_start, task->stack_end);
|
||||||
|
const uint32_t stack_len = stack_addr2 - stack_addr;
|
||||||
|
|
||||||
ESP_COREDUMP_DEBUG_ASSERT(stk_paddr != NULL && stk_vaddr != NULL);
|
ESP_COREDUMP_DEBUG_ASSERT(stk_paddr != NULL && stk_vaddr != NULL);
|
||||||
|
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
const static DRAM_ATTR char TAG[] __attribute__((unused)) = "esp_core_dump_port";
|
const static DRAM_ATTR char TAG[] __attribute__((unused)) = "esp_core_dump_port";
|
||||||
|
|
||||||
#define min(a,b) ((a) < (b) ? (a) : (b))
|
#define min(a,b) ((a) < (b) ? (a) : (b))
|
||||||
|
#define max(a,b) ((a) < (b) ? (b) : (a))
|
||||||
|
|
||||||
#define COREDUMP_EM_XTENSA 0x5E
|
#define COREDUMP_EM_XTENSA 0x5E
|
||||||
#define COREDUMP_INVALID_CAUSE_VALUE 0xFFFF
|
#define COREDUMP_INVALID_CAUSE_VALUE 0xFFFF
|
||||||
@ -349,8 +350,9 @@ bool esp_core_dump_mem_seg_is_sane(uint32_t addr, uint32_t sz)
|
|||||||
uint32_t esp_core_dump_get_stack(core_dump_task_header_t *task,
|
uint32_t esp_core_dump_get_stack(core_dump_task_header_t *task,
|
||||||
uint32_t* stk_vaddr, uint32_t* stk_paddr)
|
uint32_t* stk_vaddr, uint32_t* stk_paddr)
|
||||||
{
|
{
|
||||||
const uint32_t stack_len = abs(task->stack_start - task->stack_end);
|
|
||||||
const uint32_t stack_addr = min(task->stack_start, task->stack_end);
|
const uint32_t stack_addr = min(task->stack_start, task->stack_end);
|
||||||
|
const uint32_t stack_addr2 = max(task->stack_start, task->stack_end);
|
||||||
|
const uint32_t stack_len = stack_addr2 - stack_addr;
|
||||||
|
|
||||||
ESP_COREDUMP_DEBUG_ASSERT(stk_paddr != NULL && stk_vaddr != NULL);
|
ESP_COREDUMP_DEBUG_ASSERT(stk_paddr != NULL && stk_vaddr != NULL);
|
||||||
|
|
||||||
|
@ -728,7 +728,6 @@ components/espcoredump/include_core_dump/port/xtensa/esp_core_dump_port_impl.h
|
|||||||
components/espcoredump/src/core_dump_binary.c
|
components/espcoredump/src/core_dump_binary.c
|
||||||
components/espcoredump/src/core_dump_flash.c
|
components/espcoredump/src/core_dump_flash.c
|
||||||
components/espcoredump/src/core_dump_uart.c
|
components/espcoredump/src/core_dump_uart.c
|
||||||
components/espcoredump/src/port/riscv/core_dump_port.c
|
|
||||||
components/espcoredump/test_apps/main/test_core_dump.c
|
components/espcoredump/test_apps/main/test_core_dump.c
|
||||||
components/fatfs/diskio/diskio.c
|
components/fatfs/diskio/diskio.c
|
||||||
components/fatfs/diskio/diskio_impl.h
|
components/fatfs/diskio/diskio_impl.h
|
||||||
|
Loading…
Reference in New Issue
Block a user