Done more patterns matching and got more stubs:
NSTUB(0xFFD0C558, CreateRecursiveLock) // **"CreateRecursiveLock"
NSTUB(0xFFD04B74, AcquireRecursiveLock)
NSTUB(0xFFD04C9C, ReleaseRecursiveLock) // AJ_KernelDry_KerRLock.c_p2
NSTUB(0xFFD05330, give_semaphore)
NSTUB(0xFF867778, gui_change_lcd_state_post)
NSTUB(0xFF866BEC, gui_change_mode)
NSTUB(0xFF8676B8, gui_change_shoot_type_post)
NSTUB(0xFF8645FC, gui_init_end)
NSTUB(0xFF8B6344, gui_init_event) // to be checked
NSTUB(0xff866fb8, gui_local_post)
NSTUB(0xff864aec, gui_main_task) // jump in the middle of procedure
NSTUB(0xff865808, gui_massive_event_loop) // similar to 40d
NSTUB(0xff867454, gui_other_post) // similar to 40d
NSTUB(0xff8675e8, gui_post_10000062) // to be checked
NSTUB(0xff95eb24, gui_task_create)
NSTUB(0xff95ec74, gui_task_destroy)
NSTUB(0xffd03694, gui_timer_something)
NSTUB(0xffd1cc88, AllocateMemory)
NSTUB(0xffd1cc88, _AllocateMemory)
NSTUB(0xffd1ccc8, FreeMemory)
NSTUB(0xffd1ccc8, _FreeMemory)
NSTUB(0xff97fd54, RedrawDisplay) // to be checked
NSTUB(0xffd18028, alloc_dma_memory) // takes one less parameter
NSTUB(0xffd18028, _alloc_dma_memory) // takes one less parameter
NSTUB(0xffd1ccc8, free) // not good points to FreeMemory
NSTUB(0xffd1ccc8, _free) // not good points to FreeMemory
NSTUB(0xffd56d2c, free_dma_memory)
NSTUB(0xffd56d2c, _free_dma_memory)
NSTUB(0xffd1cd98, GetMemoryInformation) // to be checked
NSTUB(0xFFD20B28, AllocateMemoryResource) // m_pfAllocMemoryCBR
NSTUB(0xFFD20B7C, AllocateContinuousMemoryResource) // m_pfContAllocMemoryCBR
NSTUB(0xFFD20BD0, FreeMemoryResource) // m_pfFreeMemoryCBR
NSTUB(0xFFD0931C, GetFirstChunkFromSuite) // AJ_PackMemory_PackMem_p3
NSTUB(0xFFD09154, GetMemoryAddressOfMemoryChunk)
NSTUB(0xFFD0C1A4, msg_queue_create) // **"CreateMessageQueue"
NSTUB(0xFFD046C0, msg_queue_post)
NSTUB(0xFFD03FDC, msg_queue_receive)
NSTUB(0xFFD0E6F8, vsnprintf) // to be checked
NSTUB(0xff8d9430, ErrForCamera_handler) // jump in the middle of procedure // ERR70 ERR80 etc (DlgErrForCamera.c AJ_DIALOG.HANDLER_DlgErrForCamera.c)
NSTUB(0xff8c4f34, LiveViewApp_handler) // used procedure entry point instead jumping in the middle like 40d (to be checked)
NSTUB(0xff8a9bb8, PlayMain_handler) // jump in the middle of procedure
NSTUB(0xffc74fac, BmpDDev_give_semaphore)
NSTUB(0xffc74f5c, BmpDDev_take_semaphore)
NSTUB(0xFFD04DA0, create_named_semaphore)
NSTUB(0xFFD05194, take_semaphore)
NSTUB(0xFFD31D8C, get_current_task)
NSTUB(0xFFD05C60, DeleteTask)
//NSTUB(0xFFD0062C, QueryTaskByName) // taken 40d pattern but jump in the middle of procedure
NSTUB(0xffd10074, create_task_cmd_shell)
NSTUB(0xffc3ecf4, _prop_cleanup) // similar, to be cheched
NSTUB(0xffc3ebd0, prop_register_slave)
I noticed that some stubs jump in the middle of a procedure and starts with a push to the stack. Is this correct?
Also some stubs form 40d like "malloc" and "free" have a comment stating "not good, points to FreeMemory/AllocateMemory" What need to be done?
Adding those stubs and this is what I currently get if I try to compile:
[ LD ] magiclantern
menu.o: In function `beta_should_warn':
menu.c:(.text+0xa3c): undefined reference to `LoadCalendarFromRTC'
menu.o: In function `handle_ml_menu_keys':
menu.c:(.text+0x7064): undefined reference to `LoadCalendarFromRTC'
gui.o: In function `ml_hijack_gui_main_task':
gui.c:(.text+0x264): undefined reference to `QueryTaskByName'
bmp.o: In function `set_ml_palette_if_dirty':
bmp.c:(.text+0x9d0): undefined reference to `PB_Palette'
config.o: In function `config_save_file':
config.c:(.text+0x7dc): undefined reference to `LoadCalendarFromRTC'
tweaks.o: In function `tweak_task':
tweaks.c:(.text+0xc): undefined reference to `LoadCalendarFromRTC'
lens.o: In function `clock_update':
lens.c:(.text+0x4f0): undefined reference to `LoadCalendarFromRTC'
bootflags.o: In function `bootflag_write_bootblock':
bootflags.c:(.text+0x238): undefined reference to `cf_device'
dialog_test.o: In function `get_current_dialog_handler':
dialog_test.c:(.text+0x14): undefined reference to `gui_task_list'
shoot.o: In function `display_idle':
shoot.c:(.text+0x368): undefined reference to `ShootOlcApp_handler'
zebra-5dc.o: In function `tic':
zebra-5dc.c:(.text+0xe08): undefined reference to `LoadCalendarFromRTC'
make: *** [magiclantern] Error 1
Solved most missing reference but "LoadCalendarFromRTC" is hard to track and I'm not sure about "QueryTaskByName"
// From 40D's stubs.s
//NSTUB(0x4AF8, gui_task_list)
//NSTUB(0x17530, gui_main_struct)
//NSTUB(0x314F8, cf_device)
//NSTUB(0x309C8, PB_Palette)
//NSTUB(0x2B24, task_max)
How can I find those RAM address?
Looking 40D "cstart" and "bzero32" are not used in stubs.s nor is warning during 1000D compilation. Does it need to be found at this stage or can get a working build to be run into qemu?
I need some time to read again M2 thread and look for something to try into emulation.