/** * memory_contains - checks if an object is contained within a memory region * @begin: virtual address of the beginning of the memory region * @end: virtual address of the end of the memory region * @virt: virtual address of the memory object * @size: size of the memory object * * Returns: true if the object specified by @virt and @size is entirely * contained within the memory region defined by @begin and @end, false * otherwise.
*/ staticinlinebool memory_contains(void *begin, void *end, void *virt,
size_t size)
{ return virt >= begin && virt + size <= end;
}
/** * memory_intersects - checks if the region occupied by an object intersects * with another memory region * @begin: virtual address of the beginning of the memory region * @end: virtual address of the end of the memory region * @virt: virtual address of the memory object * @size: size of the memory object * * Returns: true if an object's memory region, specified by @virt and @size, * intersects with the region specified by @begin and @end, false otherwise.
*/ staticinlinebool memory_intersects(void *begin, void *end, void *virt,
size_t size)
{ void *vend = virt + size;
if (virt < end && vend > begin) returntrue;
returnfalse;
}
/** * init_section_contains - checks if an object is contained within the init * section * @virt: virtual address of the memory object * @size: size of the memory object * * Returns: true if the object specified by @virt and @size is entirely * contained within the init section, false otherwise.
*/ staticinlinebool init_section_contains(void *virt, size_t size)
{ return memory_contains(__init_begin, __init_end, virt, size);
}
/** * init_section_intersects - checks if the region occupied by an object * intersects with the init section * @virt: virtual address of the memory object * @size: size of the memory object * * Returns: true if an object's memory region, specified by @virt and @size, * intersects with the init section, false otherwise.
*/ staticinlinebool init_section_intersects(void *virt, size_t size)
{ return memory_intersects(__init_begin, __init_end, virt, size);
}
/** * is_kernel_core_data - checks if the pointer address is located in the * .data or .bss section * * @addr: address to check * * Returns: true if the address is located in .data or .bss, false otherwise. * Note: On some archs it may return true for core RODATA, and false * for others. But will always be true for core RW data.
*/ staticinlinebool is_kernel_core_data(unsignedlong addr)
{ if (addr >= (unsignedlong)_sdata && addr < (unsignedlong)_edata) returntrue;
if (addr >= (unsignedlong)__bss_start &&
addr < (unsignedlong)__bss_stop) returntrue;
returnfalse;
}
/** * is_kernel_rodata - checks if the pointer address is located in the * .rodata section * * @addr: address to check * * Returns: true if the address is located in .rodata, false otherwise.
*/ staticinlinebool is_kernel_rodata(unsignedlong addr)
{ return addr >= (unsignedlong)__start_rodata &&
addr < (unsignedlong)__end_rodata;
}
staticinlinebool is_kernel_ro_after_init(unsignedlong addr)
{ return addr >= (unsignedlong)__start_ro_after_init &&
addr < (unsignedlong)__end_ro_after_init;
} /** * is_kernel_inittext - checks if the pointer address is located in the * .init.text section * * @addr: address to check * * Returns: true if the address is located in .init.text, false otherwise.
*/ staticinlinebool is_kernel_inittext(unsignedlong addr)
{ return addr >= (unsignedlong)_sinittext &&
addr < (unsignedlong)_einittext;
}
/** * __is_kernel_text - checks if the pointer address is located in the * .text section * * @addr: address to check * * Returns: true if the address is located in .text, false otherwise. * Note: an internal helper, only check the range of _stext to _etext.
*/ staticinlinebool __is_kernel_text(unsignedlong addr)
{ return addr >= (unsignedlong)_stext &&
addr < (unsignedlong)_etext;
}
/** * __is_kernel - checks if the pointer address is located in the kernel range * * @addr: address to check * * Returns: true if the address is located in the kernel range, false otherwise. * Note: an internal helper, check the range of _stext to _end, * and range from __init_begin to __init_end, which can be outside * of the _stext to _end range.
*/ staticinlinebool __is_kernel(unsignedlong addr)
{ return ((addr >= (unsignedlong)_stext &&
addr < (unsignedlong)_end) ||
(addr >= (unsignedlong)__init_begin &&
addr < (unsignedlong)__init_end));
}
#endif/* _ASM_GENERIC_SECTIONS_H_ */
Messung V0.5
¤ Dauer der Verarbeitung: 0.11 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.