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.
im certainly no bochs expert, but that output looks like you tried to load a segment into one of the segment registers... but the segment number was higher than your current GDT.limit (which if i read it correctly is 17?)
it looks to me like your trying to execute invalid memory (perhaps data or just random memory addresses...) -- make sure all your asm jumps and branches are going to the correct place, and that your code is being linked and/or relocated at the correct addresses
Because I can't do it. I just can't figure it out using VC++. I finally got it to far jump but it is to the wrong location. I am using inline asm for everything.
I don't know if that is the problem but it is all I can think. the error actually shows up when I execute the outportb(0x21, 0x20). Here is the code from my outportb() function, might help but I doubt it.
With all segment registers except the CS, you can just load a new value in. You cannot do this with the CS. To change it, you must 'far jump' or 'far call', that is, jump or call to a different segment.
In this code snippet a far jump is being done to 'flush2', which is just after the current instruction. The side effect of this is the CS gets changed to 0x08, which is what you want.
Your code will not work without this functionality.
okay, I was thinking something along those lines. My next question is how do I do a far jump using VC++ inline asm I tried what I could find on MS Sites and google searches but I am either not doing it right or couldn't find the right procedure. If anyone knows I would appreciate knowing very much
JamesM wrote:What syntax does VC++ use? If it's AT&T syntax you want the 'ljmp <addr>, <segment>' pseudoinstruction.
VC++ uses MASM -- that is intel syntax (or something like it -- iirc MASM is a little more complicated than NASM/FASM, but the same code should work essentially the same)