Author Topic: 5D3.134 Stubs API test errors  (Read 689 times)

dfort

  • Hero Member
  • *****
  • Posts: 1552
5D3.134 Stubs API test errors
« on: February 14, 2017, 08:15:35 PM »
Hope I'm not overstaying my welcome here but this seems like this is so close. I've been running the Stubs API test and consistently getting 200 errors, but they are all the same error.

Code: [Select]
[FAIL] ABS((m0-m1) - 50*1024) => 0xc800
It seems to be happening in this selftest function:

Code: [Select]
static void stub_test_malloc_n_allocmem()
{
    // mallocs
    // bypass the memory backend and use low-level calls only for these tests
    // run this test 200 times to check for memory leaks

It maybe pointing to a problem with the memory allocation stubs but I triple checked them against the 123 and the 113 disassemblies and they seem fine, they also pass the check-stubs.py test.

Any idea where the problem might be at?
EOSM.202 EOSM.203 700D.115 5D3.*

a1ex

  • Administrator
  • Hero Member
  • *****
  • Posts: 9730
  • 5D Mark Free
Re: 5D3.134 Stubs API test errors
« Reply #1 on: February 14, 2017, 08:29:55 PM »
That section of the test allocates 50K, then frees it, then repeats 200 times. During this process, it checks the amount of available memory, as reported by Canon code.

The error message indicates that m0 = m1 (before and after _malloc). Therefore, either _malloc is not working properly (unlikely, since it passes the previous tests, so it probably returned a valid value) or the amount of free memory is not reported correctly (GetFreeMemForMalloc -> MALLOC_FREE_MEMORY in consts.h).

dfort

  • Hero Member
  • *****
  • Posts: 1552
Re: 5D3.134 Stubs API test errors
« Reply #2 on: February 14, 2017, 09:08:46 PM »
Well at least I've been searching in the right area though not really knowing what I'm searching for.

Code: [Select]
// see "Malloc Information"
#define MALLOC_STRUCT 0x3c268
#define MALLOC_FREE_MEMORY (MEM(MALLOC_STRUCT + 8) - MEM(MALLOC_STRUCT + 0x1C)) // "Total Size" - "Allocated Size"

Changing MALLOC_STRUCT from the 123 to the 113 values solved an issue with "Failed to allocate BVRAM mirror" errors so I guess that was a lucky guess though it didn't do anything for the fail errors in the Stubs API test. I've been looking at the "Malloc Information" in all three firmware versions and it seems that 134 is more like 113 than 123 in that area. However, MALLOC_FREE_MEMORY is the same in both 113 and 123 in consts.h and not knowing how to find the values for MALLOC_STRUCT I am once again lost in the woods.

So the constants have moved? Reminds me of that old joke, "The only thing constant is change."

I'm running some of the other tests in the selftest module and the camera seems to be doing quite nicely with 1.3.4.
EOSM.202 EOSM.203 700D.115 5D3.*

dfort

  • Hero Member
  • *****
  • Posts: 1552
Re: 5D3.134 Stubs API test errors
« Reply #3 on: February 14, 2017, 10:44:18 PM »
Problem solved. @chris_overseas pointed me to his 5D3-133 branch so I tried his MALLOC_STRUCT address and the Stubs API test passed without any fails. Now I know this isn't the "right" way to do it but it is working. I need to make another pass, especially on consts.h before posting the pull request.
EOSM.202 EOSM.203 700D.115 5D3.*

RenatoPhoto

  • Moderators
  • Hero Member
  • *****
  • Posts: 1509
  • 5DM3 / 7D
Re: 5D3.134 Stubs API test errors
« Reply #4 on: February 15, 2017, 03:06:03 AM »
Bravo!!!

http://www.pululahuahostal.com  |  EF 300 f/4, EF 100-400 L, EF 180 L, EF-S 10-22, Samyang 14mm, Sigma 28mm EX DG, Sigma 8mm 1:3.5 EX DG, EF 50mm 1:1.8 II, EF 1.4X II, Kenko C-AF 2X

DeafEyeJedi

  • Hero Member
  • *****
  • Posts: 2851
  • 5D3 / M1 / 7D / 70D / SL1
Re: 5D3.134 Stubs API test errors
« Reply #5 on: February 15, 2017, 03:28:11 AM »
5D3.113 • 5D3.123 • EOSM.203 • 7D.203 • 70D.112 • 100D.101

 

courtesy