On Tue, Oct 19, 2010 at 12:34 PM, Scott Duplichan <[email protected]> wrote: > -----Original Message----- > From: [email protected] [mailto:[email protected]] On > Behalf Of Carl-Daniel Hailfinger > Sent: Tuesday, October 19, 2010 01:25 PM > To: Scott Duplichan > Cc: 'Arne Georg Gleditsch'; 'Coreboot' > Subject: Re: [coreboot] [PATCH] AMD F10h: set MMCONF bus count according > toconfigured value > > ]Hi Scott, > ] > ]On 19.10.2010 19:47, Scott Duplichan wrote: > ]> Last night, I thought I would just learn about gas macros and do it > ]> that way. It was more difficult than I thought. I cannot even find > ]> examples of gas macros that use arguments. > ] > ]Take a look at src/cpu/amd/car/cache_as_ram.inc, specifically > ]extractmask and simplemask. > ] > ]Regards, > ]Carl-Daniel > ] > ]-- > ]http://www.hailfinger.org/ > > > > Thanks Carl-Daniel. > > Hello Myles, > > I am not so happy with the new one either. What I really wanted was a > macro called highestSetBit. That way, the reader can guess what macro > invocation highestSetBit (CONFIG_MMCONF_BUS_NUMBER) does without > actually digging it out. But I could not find a way to make that work. > Another idea was to find highestSetBit at runtime, if it could be done > a short and readable code sequence. This would be possible with family > 15h, where instructions such as lzcnt are supported. But family 10h > does not have this instruction. > > Now that Carl-Daniel has showed how to do gas macros, how about I add a > highestSetBit macro to amd/mtrr.h? Then everything else can be inlined?
I would say it isn't worth the effort, but it's up to you. The problem with macros in assembly is that it's unclear which registers they clobber. That was why I suggested a pre-processor macro, but it's not that important. Thanks, Myles -- coreboot mailing list: [email protected] http://www.coreboot.org/mailman/listinfo/coreboot

