lorvig@gsg.UUCP (Don Lorvig) (06/07/89)
I have the following problem: I would like to make C function calls from a device driver written in assembler. I tried gleaning information regarding crt0 via the codeview debugger, but without much success. ANY SUGGESTIONS??? I am aware that function calls to C from assembler are possible if the assembler was first called by a C program. This method is of no help. I want to know how to call C functions from assembler where the assembler is the 'start-up' program. Please respond with all possible speed. Desparate times call for measures of kind. Please heed this genuine electronic genuflection. -- Don Lorvig -- Dataman Services uucp: decvax!gsg!lorvig
kjeld@iesd.dk (Kjeld Flarup) (06/09/89)
In article <297@gsg.UUCP> lorvig@gsg.UUCP (Don Lorvig) writes: >I would like to make C function calls from a device driver written >in assembler. I tried gleaning information regarding crt0 via the >codeview debugger, but without much success. ANY SUGGESTIONS??? >I am aware that function calls to C from assembler are possible >if the assembler was first called by a C program. This method >is of no help. I want to know how to call C functions from >assembler where the assembler is the 'start-up' program. It seems to me that all you need to do is to disable the C runtime. If you look in the compiler manual you will find the switch to set for not using the default libraries. Next when you have done that. You will find that you need to rewrite certain parts of the runtime system or not use them. Again you can use the manuals to find out how to move .obj codes out of the libraries. Thus you can build your own library. But remember that stack checking causes a call to a routine fopr stack check. Either turn stack check off or write your own routine. Then there also is some routines you must write, I can't remember how many but one off them is _actrused. I only wrote an enpty procedure, which seems to work. If anyone knows what _actrused should have done I would like to know. Remember when choosing model that: Small model uses 2 byte pointers and near calls. Medium model uses 2 byte pointers and far calls. Large model uses 4 byte pointers and far calls. I hope this helps and that you dont get too many late night programmings hours. -- Kjeld Flarup Christensen | "I'am now thirty-seven times older than the universe kjeld@iesd.dk | itself." Marvin the depressed Robot.