Копирую оригинал доков, чтобы не быть голословным.
Each fix-mapped linear address is represented by an integer index defined in the enum
fixed_addresses data structure:
enum fixed_addresses {
FIX_APIC_BASE,
FIX_IO_APIC_BASE_0,
[...]
__end_of_fixed_addresses
};
Fix-mapped linear addresses are placed at the end of the fourth gigabyte of linear
addresses. The fix_to_virt( ) function computes the constant linear address starting
from the index:
inline unsigned long fix_to_virt(const unsigned int idx)
{
if (idx >= _ _end_of_fixed_addresses)
__this_fixmap_does_not_exist( );
return (0xffffe000UL - (idx << PAGE_SHIFT));
}
Let's assume that some kernel function invokes fix_to_virt(FIX_IOAPIC_BASE_0).
Since the function is declared as "inline," the C compiler does not invoke fix_to_virt( ),
but just inserts its code in the calling function. Moreover, the check on the index value is
never performed at runtime. In fact, FIX_IOAPIC_BASE_0 is a constant, so the compiler
can cut away the if statement because its condition is false at compile time. Conversely, if
the condition is true or the argument of fix_to_virt( ) is not a constant, the compiler
issues an error during the linking phase because the symbol __this_fixmap_does_not_exist is not defined elsewhere. Eventually, the compiler
computes 0xffffe000-(1<<PAGE_SHIFT) and replaces the fix_to_virt( ) function
call with the constant linear address 0xffffd000.
Т.е., коротко говоря, компилер отрежет вызов __this_fixmap_does_not_exist().
А вот не получается у меня мой тестовый пример. См. ниже.
Ответ на:
комментарий
от RomanU
Ответ на:
комментарий
от RomanU
Ответ на:
комментарий
от RomanU
Ответ на:
комментарий
от anonymous
Вы не можете добавлять комментарии в эту тему. Тема перемещена в архив.
Похожие темы
- Форум Исследование CryEngine 2 SDK 1.4.0 (2012)
- Форум gcc (не знаю как собрать) (2012)
- Форум C99 inline-функции (2010)
- Форум Slime (2019)
- Форум postgresql-base-9.0.3 (2011)
- Форум libjpeg-turbo-1.2.0 (2012)
- Форум Инициализировать union константу в классе (2015)
- Форум Переносимость, Inline-функция fstat (2002)
- Форум static переменные в inline функциях (2015)
- Форум inline-функции и проблемы компоновки (2004)