In intel manuals, it is written that code selectors can be read, but not written to. My problem is that DJGPP (i.e. GCC) requires CS=DS=ES=FS=GS=SS. Therefore, my global variable which is defined in the c code selector segment (since CS should equal DS) will be read-only. What should i do to change its value from an asm source ? :-\ ??? Here is a snippet to make things clear ...
Code: Select all
# kernel.c
int MyGlobalVar = 0;
int main() {
......
}
# loader.asm
...
mov ax,CProgramSelector
mov es,ax
mov eax,[MyNewValueRightHere]
mov [es:MYGLOBALVAR_ADDR],eax
...
Thank you in advance ..
-devr