about BTFIXUPSET_.. macros..
Chan Kim
ckim at etri.re.kr
Mon Apr 14 22:48:19 EDT 2014
<br /> Hi,<br /><br /> in the linux initialization, inside setup_arch, I see ld_mmu_srmmu() (I'm working on SPARC architecture, SRMMU is Sparc Reference MMU)<br /><br /> and it comprises many macro calls starting with BTFIXUP... The first two lines look like this.<br /><br /> <br /><br /> BTFIXUPSET_SIMM13(pgdir_shift, SRMMU_PGDIR_SHIFT); // ___ss_pgdir_shift <-- "first line"<br /><br /> BTFIXUPSET_SETHI(pgdir_size, SRMMU_PGDIR_SIZE); // ___hs_pgdir_size<br /><br /> ...<br /><br /> <br /><br /> The macro in the first line BTFIXUPSET_SIMM13 is expanded to <br /><br /> #define BTFIXUPSET_SIMM13(__name, __val) \<br /><br /> do { \<br /><br /> ___ss_##__name[0] |= 1; \<br /><br /> ___ss_##__name[1] = (unsigned)__val; \<br /><br /> } while (0)<br /><br /> <br /><br /> So the first line just becomes<br /><br /> ___ss_pgdir_shift[0] |= 1;<br /><br /> ___ss_pgdir_shift[1] = (unsigned)SRMMU_PGDIR_SHIFT;<br /><br /> <br /><br /> <br /><br /> If I look up __ss_pgdir_shift, it is found in arch/sparc/boot/btfix.S,<br /><br /> <br /><br /> <br /> ___ss_pgdir_shift:<br /> <br /> .word 0x73000000,0,68<br /> <br /> .word _stext+0x000148c8,0,_stext+0x00014c94,0,_stext+0x00015348,0,_stext+0x00016310,0,_stext+0x000163c8,0,_stext+0x00016fb4,0,_stext+0x00017508,0,_stext+0x0007c31c,0,_stext+0x0007c9b0,0,_stext+0x0007da94,0,_stext+0x0007e310,0,_stext+0x0007edbc,0,_stext+0x0007f058,0,_stext+0x0007f234,0,_stext+0x0007f950,0,_stext+0x0007fbb4,0,_stext+0x00080408,0,_stext+0x00084540,0,_stext+0x00084c30,0,_stext+0x00085a60,0,_stext+0x00086598,0,_stext+0x00087b40,0,_stext+0x00087ce4,0,_stext+0x00088c54,0,_stext+0x00089f58,0,_stext+0x0008d748,0,_stext+0x003d08f4,0,__init_begin+0x0000659c,0,__init_begin+0x00007ac8,0,__init_begin+0x00008088,0,__init_begin+0x00008360,0,__init_begin+0x00008720,0,__init_begin+0x00008908,0,__init_begin+0x00008bf8,0<br /> <br /> <br /><br /><br /> I think this assembly code was built before the compilation of ld_mmu_srmmu. (this BTFIXUP thing sounds like related to what is called pre-link, I saw it on the web) and This ld_mmu_srmmu function seems like to setup functions and values into specific sparc sub-architectures. <br /><br /> (replacing genearal things with more specific things)<br /><br /> <br /><br /> So the first line is setting bit 0 of 0x73000000 and writing SRMMU_PGIDR_SHIFT (=2^24) to the next word. and there is a number 68 and it is followed by 68 words. I can see it looks like setting up a page directory table with certain length. But how has this assembly been built during pre-link? Is there any good reference? How are this values and functions used? I mean in what manner? Could somebody give me and idea how it's used later?<br /><br /> Sorry for hasty questions.<br /><br /> Best regards,<br /><br /> Chan<br /><br /> <br />
More information about the Kernelnewbies
mailing list