Im trying to run my boot image with bochs and i get this error over and over again.
I did not attach the log file because it ended up being 3 megs with this error repeating over and over
LOCK prefix unallowed (op1=0x53, attr=0x0, mod=0x0, nnn=0)
bochs error
-
- Member
- Posts: 524
- Joined: Sun Nov 09, 2008 2:55 am
- Location: Pennsylvania, USA
Re: bochs error
You are attempting to run corrupted code or are using the LOCK prefix incorrectly. The LOCK prefix is used to lock the bus so other processors in an SMP system don't access the memory at the same time as another processor. Most likely, you are executing a jump to a unintened memory location.
I remember seeing bochs initialize memory as 0xf0530000 (or something like that). Since the lock prefix is 0xf0 and the opcode from the error message is 0x53, that's probably your issue.
Please post some code (and in the future please post some code in your first post, or someone will just ask for it later).
I remember seeing bochs initialize memory as 0xf0530000 (or something like that). Since the lock prefix is 0xf0 and the opcode from the error message is 0x53, that's probably your issue.
Please post some code (and in the future please post some code in your first post, or someone will just ask for it later).
- Combuster
- 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:
Re: bochs error
You can also snip out the lock errors from the dump. Interesting is what happened just before the error (few lines before the first unallowed lock prefix), and what the state is during the error (the dump afterwards). The reason you are flooded with the message is because of the BIOS just IRETing every exception, going back to the bad opcode getting you stuck in an endless loop.
You can also use bochs to singlestep through your code and see where your code goes where it should not.
You can also use bochs to singlestep through your code and see where your code goes where it should not.
Re: bochs error
Yes you were right, I was jumping to a bad location. I fixed it, but now I have a new problem. I tried loading a small test kernel to ffff:0000 and then jumping to that location, but the kernel code wont execute and the screen just flashes, however, when I change the location to ffff:0500, the kernel code executes, so Im guessing that A20 is not really enabled and its wrapping around and overwriting ISR code at 0000. This is just a guess, because I took to enable A20 from http://www.osdever.net/tutorials/a20.php and it checks to make sure the A20 was enabled. Also, I know bochs has a debugger, but I use open suse and it downloaded the bochs rpm for me, so I tried to download and install it myself with the debugger options, but the configure script tells me it cant find the x11 libraries. Maybe this is the wrong forum for this, but maybe its common?
- Firestryke31
- Member
- Posts: 550
- Joined: Sat Nov 29, 2008 1:07 pm
- Location: Throw a dart at central Texas
- Contact:
Re: bochs error
Isn't FFFF:0000 the very tail end of the BIOS ROM (i.e. there's still another 16 bytes left)? And in fact isn't it where the CPU goes when it first starts?
That would explain the 'reset,' because you're not actually writing to that area, and just doing a 'soft' reset. That is, if I happen to be right...
That would explain the 'reset,' because you're not actually writing to that area, and just doing a 'soft' reset. That is, if I happen to be right...
Owner of Fawkes Software.
Wierd Al wrote: You think your Commodore 64 is really neato,
What kind of chip you got in there, a Dorito?
Re: bochs error
Oh, I thought that was the start of the 1MB mark? but yes I changed it to ffff:001f and it worked. thank you
- Firestryke31
- Member
- Posts: 550
- Joined: Sat Nov 29, 2008 1:07 pm
- Location: Throw a dart at central Texas
- Contact:
Re: bochs error
It actually resolves to the physical address 0x000FFFF0 + 0x0000 = 0x000FFFF0 (Segment * 16 + offset), so your revised address resolves to 0x000FFFF0 + 0x001F = 0x0010000F.
IMHO the 16-bit segment:offset scheme is annoying, but it was invented before I was born, so not much I can do about it.
IMHO the 16-bit segment:offset scheme is annoying, but it was invented before I was born, so not much I can do about it.
Owner of Fawkes Software.
Wierd Al wrote: You think your Commodore 64 is really neato,
What kind of chip you got in there, a Dorito?
Re: bochs error
ok, now if i want to load the kernel at just above the 1MB mark, and then jump to it and be in protected mode, I have to setup gdt entries whose base is the address i jump to, which in this case is ffff:001f, and then do
jmp 0x08:0000 right after I set the bit in cr0, and I should be in pmode? I dont know how to comfirm if im there or not
jmp 0x08:0000 right after I set the bit in cr0, and I should be in pmode? I dont know how to comfirm if im there or not