assembly - __pv_stub(x, t, "add", __PV_BITS_31_24)... why __PV_BITS_31_24 is 0x8100_0000? -
the function
__virt_to_phys(unsigned long x)
which boils down
__pv_stub(x, t, "add", __pv_bits_31_24);
__pv_stub macro expands
add t, x, 0x8100_0000
apart inserting pointer instruction in .pv_table section, can used patch add instruction during bootup. question regarding constant __pv_bits_31_24. there reason use value 0x8100_0000 it.
as per understanding value makes 12 bit immediate encoding field of add instruction 481 hex. @ run time during bootup function __fix_pv_table changes 4c0 hex(assume start of first mem bank @ 0x8000_0000). value 0x8100_0000 common such people have decided use default value during compilation , if different anyway it'll fixed during bootup ? or there different reason unable understand ?
in short, because has bits 31 , 24 set, results in appropriate instruction encoding patching msb of offset.
remember immediate constants in arm instructions formed 8-bit value rotated 1 of 16 positions in 32-bit word. assembling initial value of 0x81000000 guarantees appropriate rotation bits 31:24 encoded, other 8-bit value can written on bottom byte of instruction without worrying rest.
it equally have been 0xff000000 (or other value had @ least bits 24 , 30 or 31 set), apparently that particular value was relatively arbitrary decision maintainer.
Comments
Post a Comment