Hi guys, I am developing bootloader and met with a need to force C compiler to output the calling function in a specific way.
Due to program requirement, I am passing function parameter to function called ProcName function from code segment like following:
I am also declaring all functions far.
jmp skipData
param1 db 00h, 001h
skipData:
push cs
push offset word ptr cs:param1 ; pushed seg:ofs address of param1
push cs
push offset word ptr cs:retAddr ; pushed return address.
dw eah
dw ProcName
dw CS_SEG ; far jump to CS_SEG:ProcName
retAddr:
ProcName PROC FAR
Now the problem is I declare ProcName in C file and calling ProcName function from C like following way:
extern void far ProcName(char far *);
.....
ProcName("12345");
Problem is it is not working because, C compiler compiles it as follows:
push ds
push offset word ptr ds:paramInC
because string '12345' is created in data segment. But upon program entry I am using ds for something else not for DATA segment.
Finally the question is is there way to force C compiler to create 12345 string in code segment and pass CS and OFFSET CS:12345 to ProcName. Thanks!