[PATCH H8300] Add function_vector attribute

Ajinkya Dhobale Ajinkya.Dhobale@kpitcummins.com
Thu Apr 5 06:04:00 GMT 2012


Hello Jeff,

>> So the fundamental difference is your version of function_vector is 
>> programmer directed.

Yes, programmer will need to assign function vector number manually 
during declaration of the attribute.

>> I think you need to investigate further since functions marked with 
>> the attribute should be called through the function vector.
>>
>> When the linker assigns the slot, the proper syntax is jsr <name>:8

Even I was looking for same. However, when I checked the object dump of
the generated binary it had 'jsr' instruction in absolute addressing format.

Generated assembly was like:
mov.w   r7,r6  
jsr     @_foo  
mov.w   @r7+,r6

And object dump of output file was like:
0d 76           mov.w   r7,r6
5e 00 02 30     jsr     @0x230:24
6d 76           mov.w   @r7+,r6

Do I need to pass any additional command line options during compilation 
to generate 'jsr' in format 'jsr <name>:8'?

>> ISTM that you either need to use a different attribute name or find a 
>> way to make the argument optional.

Because of the 'jsr' generated in absolute addressing format, 
I thought current implementation might be broken and hence I modified it.
However, if current implementation is to be kept as is then I will prefer
making argument passing optional. In that case, I will repost the modified 
patch.

Meanwhile, I have modified the previous patch for following two things:
1. Initially I was generating 'jsr' as 'jsr @@vect-number:8'.
However, I found it was not working on hardware. 

H8 programming manuals mention, 'jsr' instruction in memory indirect 
format expects 8-bit absolute address to be encoded in instruction code. 
Hence I modified the patch to generate it as: 
'jsr @@<vect-number x pointer size>:8'.

Now it is working appropriately on hardware.

2. In H8, pointer size is 2 bytes in 'normal' CPU mode and 4 bytes in 
other modes. I modified the patch to vary 'jsr' destination generation 
accordingly.

Thanks and Regards,
Ajinkya

-------------- next part --------------
A non-text attachment was scrubbed...
Name: modified-h8300-func-vect.patch
Type: application/octet-stream
Size: 8034 bytes
Desc: modified-h8300-func-vect.patch
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20120405/2d4f9b3d/attachment.obj>


More information about the Gcc-patches mailing list