Using assembler in GCC , how do how do I reference volatile variables ?
Please help with assembler in GCC.
Writing asm within a function how do how do I reference the volatile variables ?
There has to be a stack frame and offsets, I have searched the web finding no answer.
I will attempt to solve this by correlating printf ( "%p" , & variable ) ; with segment and general registers, but if this exploration works the result will be second best as it may be flawed. And I won't know.
It looks like you want to read a good GCC inline assembler tutorial - this one's got a good section for what you want:
Many thanks John.
The problem arose because of my pig headed attachment to registers.
I had earlier seen the link that you kindly gave, I been working forwards with :
So I have to engrave on the inside of my head :
Because GCC optimises, it is impossible to work with the 386 registers and volatile variables
(By the way if you're thinking that GCC is erroneously optimizing your assembler, you can stop it with __volatile__, i.e. use "__asm__ __volatile__ (...);")
My thanks to you John for your continuing interest and help.
I understand GCC optimises everything. So the stack frame pointer is not in a known place. With or without optimization of my code I will not be able to reference the volatile variables.
If this is wrong I hope it can be corrected for all readers.
I have been otherwise committed for a day, I will get down to your first suggestion. Give me a couple of days and there should be a cry of triumph here.
Success with gratitude
I think that I am there, my thanks.
My first task was a multi element shift. I am sorry that when posted here as a quote it is unreadable. I will post a link when this with other routines are on the web.
I have not expressed my thanks properly, I irritated kind and helpful JohnGraham.
My problem was that I did not understand my problem.
I knuckled down did what I wanted. Long after it was done I realized what my personal problem was. I explain.
I have worked with a number of assemblers. I acquired an understanding that they are designed to make the writing and translation of code as easy as possible for the human author. The GCC assembler with five different references for each register contradicted this. But GCC asm is defined for the benefit of the C compiler, humans have to adapt.
I am happy. If anyone with the same problem arrives here my proof is at :
If you wish to read just see within the asm folder and get bignGCC.lib . bignGCC.txt explains how to use it. If you wish to compile and run then you will need the bign.tar for explanation and bigcalc.c , which has to be modified by changing the #include "bign.lib" to #include "bignGCC.lib" .
|All times are GMT -5. The time now is 06:28 PM.|