Changeset 963a26c in rtems


Ignore:
Timestamp:
01/11/22 10:45:47 (6 months ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
cbc9232
Parents:
b982b8d4
git-author:
Sebastian Huber <sebastian.huber@…> (01/11/22 10:45:47)
git-committer:
Sebastian Huber <sebastian.huber@…> (01/11/22 15:18:11)
Message:

libtests/ofw01: Fix wrapped in bsp_fdt_get()

Use the stack pointer to check if we have to return the real device tree
since bsp_fdt_get() may get called before the BSS is cleared to zero.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • testsuites/libtests/ofw01/init.c

    rb982b8d4 r963a26c  
    3838#include <ofw/ofw.h>
    3939#include <ofw/ofw_test.h>
     40#include <rtems/score/isr.h>
    4041
    4142#include "some.h"
     
    5152const void *__wrap_bsp_fdt_get(void)
    5253{
    53   if (test_bin != NULL) {
     54  uintptr_t sp;
     55
     56  sp = (uintptr_t) __builtin_frame_address(0);
     57  RTEMS_OBFUSCATE_VARIABLE(sp);
     58
     59  /*
     60   * Use the stack pointer to check if we have to return the real device tree
     61   * since bsp_fdt_get() may get called before the BSS is cleared to zero.
     62   */
     63  if (
     64    (sp < (uintptr_t) _ISR_Stack_area_begin ||
     65    sp >= (uintptr_t) _ISR_Stack_area_end) &&
     66    test_bin != NULL
     67  ) {
    5468    return test_bin;
    5569  }
Note: See TracChangeset for help on using the changeset viewer.