diff --git a/arch/x86/core/crt0.S b/arch/x86/core/crt0.S index e0ac89457d9..c1f30588680 100644 --- a/arch/x86/core/crt0.S +++ b/arch/x86/core/crt0.S @@ -322,6 +322,14 @@ __csSet: call _x86_data_copy #endif /* CONFIG_APPLICATION_MEMORY */ +#ifdef CONFIG_APP_SHARED_MEM + movl $_app_smem_start, %edi /* DATA in RAM (dest) */ + movl $_app_smem_rom_start, %esi /* DATA in ROM (src) */ + movl $_app_smem_num_words, %ecx /* Size of DATA in quad bytes */ + + call _x86_data_copy +#endif /* CONFIG_APP_SHARED_MEM */ + #endif /* CONFIG_XIP */ /* diff --git a/include/arch/x86/linker.ld b/include/arch/x86/linker.ld index 4984f05b115..f40435f95fa 100644 --- a/include/arch/x86/linker.ld +++ b/include/arch/x86/linker.ld @@ -214,6 +214,7 @@ SECTIONS } GROUP_DATA_LINK_IN(RAMABLE_REGION, RAMABLE_REGION) _app_smem_size = _app_smem_end - _app_smem_start; + _app_smem_num_words = _app_smem_size >> 2; _app_smem_rom_start = LOADADDR(_APP_SMEM_SECTION_NAME); diff --git a/include/linker/linker-defs.h b/include/linker/linker-defs.h index 1dbb3ccb826..f56f0fa64cf 100644 --- a/include/linker/linker-defs.h +++ b/include/linker/linker-defs.h @@ -167,6 +167,7 @@ extern char _app_smem_start[]; extern char _app_smem_end[]; extern char _app_smem_size[]; extern char _app_smem_rom_start[]; +extern char _app_smem_num_words[]; #ifdef CONFIG_APPLICATION_MEMORY /* Memory owned by the application. Start and end will be aligned for memory