calling asm function from c

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.
User avatar
suthers
Member
Member
Posts: 672
Joined: Tue Feb 20, 2007 3:00 pm
Location: London UK
Contact:

Post by suthers »

Ok I'll look around and figure out how to use it then...
Thanks,

Jules
User avatar
suthers
Member
Member
Posts: 672
Joined: Tue Feb 20, 2007 3:00 pm
Location: London UK
Contact:

Post by suthers »

Ok so i've downloaded a nwere version of Bochs that actually has a debugger, but it gives an error: ROM image size must be multiple of 512 (size = 32769)
This as a reference to the ROM VGABIOS-elpin-2.40, which came with the packages and i can't therefore explain why this is happening, can anybody explain this? (searches on google have have yielded nothing).
Thanks in advance,

Jules
User avatar
suthers
Member
Member
Posts: 672
Joined: Tue Feb 20, 2007 3:00 pm
Location: London UK
Contact:

Post by suthers »

Ok that was fixed, I used an old bochsrc file so it was still fetching the old BIOS :oops:.
So I run it, but all it does is it goes through my image, but then it breaks at the moment that i should have my error and nothing happens and i i type 'cont' into the prompt, it just restarts, what am I doing wrong?
Thanks in advance,

Jules
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Post by Combuster »

some basic (bochs) debugger lessons:

1) locate and trap at the instruction causing the error
2) dump the CPU registers, if applicable
3) dump the stack, if applicable
4) If you are dealing with segments, dump the requested items in the GDT
5) If a paging error occurs, manually probe memory to get the page tables' contents.

6) Next, go to your code, and make a note of what the state should be exactly according to what you want

7) Compare the results.

8a) If the state is not what you expect, find the source and fix it
8b) If the state is what you expect, read the manuals to see why bochs can't agree with you on the next step
"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 ]
User avatar
suthers
Member
Member
Posts: 672
Joined: Tue Feb 20, 2007 3:00 pm
Location: London UK
Contact:

Post by suthers »

Thanks combuster, I'll do that as soon as I figure out how to use the debugger, I just got back from a short 'holiday', so I wasn't able to work on it during the week.
Jules
Post Reply