zephyr/include/linker/common-ram.ld

167 lines
4.7 KiB
Text
Raw Normal View History

/* SPDX-License-Identifier: Apache-2.0 */
#if defined(CONFIG_GEN_SW_ISR_TABLE) && defined(CONFIG_DYNAMIC_INTERRUPTS)
SECTION_DATA_PROLOGUE(sw_isr_table,,)
{
/*
* Some arch requires an entry to be aligned to arch
* specific boundary for using double word load
* instruction. See include/sw_isr_table.h.
*/
. = ALIGN(CONFIG_ARCH_SW_ISR_TABLE_ALIGN);
*(_SW_ISR_TABLE_SECTION_NAME)
} GROUP_DATA_LINK_IN(RAMABLE_REGION, ROMABLE_REGION)
#endif
/*
* Space for storing per device busy bitmap. Since we do not know beforehand
* the number of devices, we go through the below mechanism to allocate the
* required space.
*/
#ifdef CONFIG_DEVICE_POWER_MANAGEMENT
#define DEVICE_COUNT \
((__device_end - __device_start) / _DEVICE_STRUCT_SIZEOF)
#define DEV_BUSY_SZ (((DEVICE_COUNT + 31) / 32) * 4)
#define DEVICE_BUSY_BITFIELD() \
FILL(0x00) ; \
__device_busy_start = .; \
. = . + DEV_BUSY_SZ; \
__device_busy_end = .;
#else
#define DEVICE_BUSY_BITFIELD()
#endif
SECTION_DATA_PROLOGUE(devices,,)
{
/* link in devices objects, which are tied to the init ones;
* the objects are thus sorted the same way as their init
* object parent see include/device.h
*/
__device_start = .;
CREATE_OBJ_LEVEL(device, PRE_KERNEL_1)
CREATE_OBJ_LEVEL(device, PRE_KERNEL_2)
CREATE_OBJ_LEVEL(device, POST_KERNEL)
CREATE_OBJ_LEVEL(device, APPLICATION)
CREATE_OBJ_LEVEL(device, SMP)
__device_end = .;
DEVICE_BUSY_BITFIELD()
} GROUP_DATA_LINK_IN(RAMABLE_REGION, ROMABLE_REGION)
SECTION_DATA_PROLOGUE(initshell,,)
{
/* link in shell initialization objects for all modules that
* use shell and their shell commands are automatically
* initialized by the kernel.
*/
__shell_module_start = .;
KEEP(*(".shell_module_*"));
__shell_module_end = .;
__shell_cmd_start = .;
KEEP(*(".shell_cmd_*"));
__shell_cmd_end = .;
} GROUP_DATA_LINK_IN(RAMABLE_REGION, ROMABLE_REGION)
SECTION_DATA_PROLOGUE(log_dynamic_sections,,)
{
__log_dynamic_start = .;
KEEP(*(SORT(.log_dynamic_*)));
__log_dynamic_end = .;
} GROUP_DATA_LINK_IN(RAMABLE_REGION, ROMABLE_REGION)
Z_ITERABLE_SECTION_RAM(_static_thread_data, 4)
kernel: introduce object validation mechanism All system calls made from userspace which involve pointers to kernel objects (including device drivers) will need to have those pointers validated; userspace should never be able to crash the kernel by passing it garbage. The actual validation with _k_object_validate() will be in the system call receiver code, which doesn't exist yet. - CONFIG_USERSPACE introduced. We are somewhat far away from having an end-to-end implementation, but at least need a Kconfig symbol to guard the incoming code with. Formal documentation doesn't exist yet either, but will appear later down the road once the implementation is mostly finalized. - In the memory region for RAM, the data section has been moved last, past bss and noinit. This ensures that inserting generated tables with addresses of kernel objects does not change the addresses of those objects (which would make the table invalid) - The DWARF debug information in the generated ELF binary is parsed to fetch the locations of all kernel objects and pass this to gperf to create a perfect hash table of their memory addresses. - The generated gperf code doesn't know that we are exclusively working with memory addresses and uses memory inefficently. A post-processing script process_gperf.py adjusts the generated code before it is compiled to work with pointer values directly and not strings containing them. - _k_object_init() calls inserted into the init functions for the set of kernel object types we are going to support so far Issue: ZEP-2187 Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-08-22 13:15:23 -07:00
#ifdef CONFIG_USERSPACE
/* All kernel objects within are assumed to be either completely
* initialized at build time, or initialized automatically at runtime
* via iteration before the POST_KERNEL phase.
*
* These two symbols only used by gen_kobject_list.py
*/
_static_kernel_objects_begin = .;
#endif /* CONFIG_USERSPACE */
Z_ITERABLE_SECTION_RAM(k_timer, 4)
Z_ITERABLE_SECTION_RAM(k_mem_slab, 4)
Z_ITERABLE_SECTION_RAM(k_mem_pool, 4)
Z_ITERABLE_SECTION_RAM(k_heap, 4)
Z_ITERABLE_SECTION_RAM(k_mutex, 4)
Z_ITERABLE_SECTION_RAM(k_stack, 4)
Z_ITERABLE_SECTION_RAM(k_msgq, 4)
Z_ITERABLE_SECTION_RAM(k_mbox, 4)
Z_ITERABLE_SECTION_RAM(k_pipe, 4)
Z_ITERABLE_SECTION_RAM(k_sem, 4)
Z_ITERABLE_SECTION_RAM(k_queue, 4)
SECTION_DATA_PROLOGUE(_net_buf_pool_area,,SUBALIGN(4))
{
_net_buf_pool_list = .;
KEEP(*(SORT_BY_NAME("._net_buf_pool.static.*")))
} GROUP_DATA_LINK_IN(RAMABLE_REGION, ROMABLE_REGION)
SECTION_DATA_PROLOGUE(net_if,,SUBALIGN(4))
{
__net_if_start = .;
*(".net_if.*")
KEEP(*(SORT_BY_NAME(".net_if.*")))
__net_if_end = .;
} GROUP_DATA_LINK_IN(RAMABLE_REGION, ROMABLE_REGION)
SECTION_DATA_PROLOGUE(net_if_dev,,SUBALIGN(4))
{
__net_if_dev_start = .;
*(".net_if_dev.*")
KEEP(*(SORT_BY_NAME(".net_if_dev.*")))
__net_if_dev_end = .;
} GROUP_DATA_LINK_IN(RAMABLE_REGION, ROMABLE_REGION)
SECTION_DATA_PROLOGUE(net_l2_data,,SUBALIGN(4))
{
__net_l2_data_start = .;
*(".net_l2.data")
KEEP(*(SORT_BY_NAME(".net_l2.data*")))
__net_l2_data_end = .;
} GROUP_DATA_LINK_IN(RAMABLE_REGION, ROMABLE_REGION)
kernel: introduce object validation mechanism All system calls made from userspace which involve pointers to kernel objects (including device drivers) will need to have those pointers validated; userspace should never be able to crash the kernel by passing it garbage. The actual validation with _k_object_validate() will be in the system call receiver code, which doesn't exist yet. - CONFIG_USERSPACE introduced. We are somewhat far away from having an end-to-end implementation, but at least need a Kconfig symbol to guard the incoming code with. Formal documentation doesn't exist yet either, but will appear later down the road once the implementation is mostly finalized. - In the memory region for RAM, the data section has been moved last, past bss and noinit. This ensures that inserting generated tables with addresses of kernel objects does not change the addresses of those objects (which would make the table invalid) - The DWARF debug information in the generated ELF binary is parsed to fetch the locations of all kernel objects and pass this to gperf to create a perfect hash table of their memory addresses. - The generated gperf code doesn't know that we are exclusively working with memory addresses and uses memory inefficently. A post-processing script process_gperf.py adjusts the generated code before it is compiled to work with pointer values directly and not strings containing them. - _k_object_init() calls inserted into the init functions for the set of kernel object types we are going to support so far Issue: ZEP-2187 Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-08-22 13:15:23 -07:00
#if defined(CONFIG_UART_MUX)
SECTION_DATA_PROLOGUE(uart_mux,,SUBALIGN(4))
{
__uart_mux_start = .;
*(".uart_mux.*")
KEEP(*(SORT_BY_NAME(".uart_mux.*")))
__uart_mux_end = .;
} GROUP_DATA_LINK_IN(RAMABLE_REGION, ROMABLE_REGION)
#endif
#if defined(CONFIG_USB_DEVICE_STACK)
SECTION_DATA_PROLOGUE(usb_descriptor,,SUBALIGN(1))
{
__usb_descriptor_start = .;
*(".usb.descriptor")
KEEP(*(SORT_BY_NAME(".usb.descriptor*")))
__usb_descriptor_end = .;
} GROUP_DATA_LINK_IN(RAMABLE_REGION, ROMABLE_REGION)
SECTION_DATA_PROLOGUE(usb_data,,SUBALIGN(1))
{
__usb_data_start = .;
*(".usb.data")
KEEP(*(SORT_BY_NAME(".usb.data*")))
__usb_data_end = .;
} GROUP_DATA_LINK_IN(RAMABLE_REGION, ROMABLE_REGION)
#endif /* CONFIG_USB_DEVICE_STACK */
#if defined(CONFIG_USB_DEVICE_BOS)
SECTION_DATA_PROLOGUE(usb_bos_desc,,SUBALIGN(1))
{
__usb_bos_desc_start = .;
*(".usb.bos_desc")
KEEP(*(SORT_BY_NAME(".usb.bos_desc*")))
__usb_bos_desc_end = .;
} GROUP_DATA_LINK_IN(RAMABLE_REGION, ROMABLE_REGION)
#endif /* CONFIG_USB_DEVICE_BOS */
kernel: introduce object validation mechanism All system calls made from userspace which involve pointers to kernel objects (including device drivers) will need to have those pointers validated; userspace should never be able to crash the kernel by passing it garbage. The actual validation with _k_object_validate() will be in the system call receiver code, which doesn't exist yet. - CONFIG_USERSPACE introduced. We are somewhat far away from having an end-to-end implementation, but at least need a Kconfig symbol to guard the incoming code with. Formal documentation doesn't exist yet either, but will appear later down the road once the implementation is mostly finalized. - In the memory region for RAM, the data section has been moved last, past bss and noinit. This ensures that inserting generated tables with addresses of kernel objects does not change the addresses of those objects (which would make the table invalid) - The DWARF debug information in the generated ELF binary is parsed to fetch the locations of all kernel objects and pass this to gperf to create a perfect hash table of their memory addresses. - The generated gperf code doesn't know that we are exclusively working with memory addresses and uses memory inefficently. A post-processing script process_gperf.py adjusts the generated code before it is compiled to work with pointer values directly and not strings containing them. - _k_object_init() calls inserted into the init functions for the set of kernel object types we are going to support so far Issue: ZEP-2187 Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-08-22 13:15:23 -07:00
#ifdef CONFIG_USERSPACE
_static_kernel_objects_end = .;
#endif