Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
( should clear bss ) crashes my kernel, when "rep stosd" is run my kernel breaks, with out it it boots but i don't think the bss is cleared. this above code works on qemu but not on bochs or a real pc, anyone know why?
did you print the values of bss and bsslength this to verify the correctness of the values. I had a similar problem that the divide didn't work so i manuallly did the divide in code and worked perfectly. also make sure that the direction is ok cld statement and the ds or es is properly setup.
could be be because length is in bytes and your are storing dwords...thus you are clearing 4 times the amount of data as needed.
just add a "shr ecx, 2" before the rep movsd (effectively divides by 4) and i think you will be fine.
**EDIT: scratch that, your length is in dwords, dunno what's wrong
**EDIT2: perhaps you need a "cld" to make sure addresses are incrementing and not decrementing?
proxy
Last edited by proxy on Mon Dec 15, 2014 8:39 am, edited 1 time in total.
Do you have paging setup properly and enabled? otherwise you'll be clearing miles beyond end of memory at 0xC01xxxxx ...
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
CLD:Clear the direction flag(DF) in the (E)FLAG.(i.e. Set Bit 10 to 0.)
If this flag is set,the SI and DI will be decremented when executing most of the string instructions(e.g. MOVS family,CMPS family,STOS and LODS family etc.).When the operands are 8-bit ones,they will be decremented by 1 at every loop,and 16-bit for 2,and 32-bit for 4,etc.,respectively.If the DF is cleared,they will be incremented with an appropriate value.