1st: movedata works (copied from an older version of this project)
2nd: i dont link against the libc:
ld -o loader.oos -e start --oformat binary -Ttext 0x0 $(OFILES)
where ofiles are the objectcodefiles produced by gcc -c ...
the problem is:
this works:
Code:
int main()
{
movedata(DATA_SEL, (unsigned)"H A L L O ", SCREEN_DATA_SEL, 0, 10);
while(1);
}
this dont:
Code:
char *message = "H A L L O ";
int main()
{
movedata(DATA_SEL, message, SCREEN_DATA_SEL, 0, 10);
while(1);
}
movedata looks like this (altough it cant be the problem):
Code:
/*
ssel...sourcesegment selector
s.......sourceoffset
dsel...destinationsegment selector
d.......destination offset
len.....how many bytes to copy
void movedata(unsigned ssel, unsigned s, unsigned dsel, unsigned d, unsigned len)
{
asm(
"pushw %%ds\n"
"pushw %%ax\n"
"popw %%ds\n"
"pushw %%es\n"
"pushw %%bx\n"
"popw %%es\n"
"moveloop: \n"
"lodsb \n"
"stosb \n"
"loop moveloop\n"
"popw %%es\n"
"popw %%ds"
::"a" (ssel), "b" (dsel), "D" (d), "S" (s), "c" (len));
}
gdt looks like this (descriptor is a makro, that copies all the values into the gdt
1st one: nil
2nd one: kernel codeseg (yet not used)
3rd: kernel data (not used)
then stack, codeseg (for this program), dataseg(for this program (the loader)) and then the screensegment
descriptor 0,0,0,0,0,0,0
;codeseg base 0 limit FFFFF, gran
descriptor 8, 0FFFFh, 0, 0, 9Ah, 0CFh, 0
;dataseg base 0 limit FFFFF, gran
descriptor 16, 0FFFFh, 0, 0, 092h, 0CFh, 0
;stackseg, base 70800h
descriptor 24, 0F800h, 0800h, 07h, 092h, 040h, 0
;codeseg base 0x80000 limit FFFFF, gran
descriptor 32, 0FFFFh, 0, 08h, 09Ah, 0CFh, 0
;dataseg base 0x80000 limit FFFFF, gran
descriptor 40, 0FFFFh, 0, 08h, 092h, 0CFh, 0
;videoseg base 0xB8000 limit 4000
descriptor 48, 0FA0h, 08000h, 0Bh, 092h, 040h, 0
you see the problem is: why doesnt it work when message is declared globally?