admin管理员组

文章数量:1190403

I am trying to write a FIQ handler that writes to a memory mapped register. The challenge is that I need virtual address, corresponding to the physical address of that register (because if I am not wrong, I cannot write directly to the physical addresses in FIQ mode, just like normal mode).

I was skimming through the kernel source code for some reference implementation and I came across this : .6.67/source/arch/arm/mach-omap1/ams-delta-fiq-handler.S#L258.

omap_ih1_base:
    .word OMAP1_IO_ADDRESS(OMAP_IH1_BASE)
deferred_fiq_ih_base:
    .word OMAP1_IO_ADDRESS(DEFERRED_FIQ_IH_BASE)
omap1510_gpio_base:
    .word OMAP1_IO_ADDRESS(OMAP1510_GPIO_BASE)
qwerty_fiqin_end:

where macros are defined like this :

#define OMAP1_IO_OFFSET     0x00f00000  /* Virtual IO = 0xff0b0000 */
#define OMAP1_IO_ADDRESS(pa)    IOMEM((pa) - OMAP1_IO_OFFSET)

They are doing exactly same as what I may require. But this confused me how they are able to generate virtual addresses at compile time? And won't this go for a toss if KASLR (address space randomization) is enabled?

本文标签: Generating virtual addresses for iomem at compile time in linux kernelStack Overflow