Problem with code running in Bochs

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.
Slasher

Re:Problem with code running in Bochs

Post by Slasher »

The error is in you BOOT CODE!! ;D
you are using boot_drv without assigning it a value!
try this, add this as the first line after BOOT:

Boot:
mov [boot_drv], byte dl
....
....
beyondsociety

Re:Problem with code running in Bochs

Post by beyondsociety »

That wasn't the problem.

I fixed the problem though, but now I'm getting this

Code: Select all

00000556577p[CPU  ] >>PANIC<< exception(): 3rd (13) exception with no resolution
00000556577i[SYS  ] Last time is 1043044870
00000556577i[CPU  ] protected mode
00000556577i[CPU  ] CS.d_b = 32 bit
00000556577i[CPU  ] SS.d_b = 32 bit
00000556577i[CPU  ] | EAX=00000010  EBX=00009000  ECX=f017ff55  EDX=00000000
00000556577i[CPU  ] | ESP=00100000  EBP=00000000  ESI=00000000  EDI=0000ffe4
00000556577i[CPU  ] | IOPL=0 NV UP DI PL NZ NA PO NC
00000556577i[CPU  ] | SEG selector     base    limit G D
00000556577i[CPU  ] | SEG sltr(index|ti|rpl)     base    limit G D
00000556577i[CPU  ] |  DS:0010( 0002| 0|  0) 00000000 000fffff 1 1
00000556577i[CPU  ] |  ES:0010( 0002| 0|  0) 00000000 000fffff 1 1
00000556577i[CPU  ] |  FS:0010( 0002| 0|  0) 00000000 000fffff 1 1
00000556577i[CPU  ] |  GS:0010( 0002| 0|  0) 00000000 000fffff 1 1
00000556577i[CPU  ] |  SS:0010( 0002| 0|  0) 00000000 000fffff 1 1
00000556577i[CPU  ] |  CS:0008( 0001| 0|  0) 00000000 000fffff 1 1
00000556577i[CPU  ] | EIP=0000fdae (0000fdae)
00000556577i[CPU  ] | CR0=0x60000011 CR1=0x00000000 CR2=0x00000000
00000556577i[CPU  ] | CR3=0x00000000 CR4=0x00000000
Whatever5k

Re:Problem with code running in Bochs

Post by Whatever5k »

Instead of writing:

Code: Select all

char *test_ptr;
test_ptr = "Pride";
you should write:

Code: Select all

char test_ptr[] = "Pride";
Remember that your test_ptr is a pointer, it must point to an address (variable)...
beyondsociety

Re:Problem with code running in Bochs

Post by beyondsociety »

I looked up my error [3rd exception (13) with no resolution] in the intel manuals and this is what it says:

Code: Select all

General Protection exception
13. Loading CR0 with PG=1 and PE=0.
What does this mean and how change I fix this?
Whatever5k

Re:Problem with code running in Bochs

Post by Whatever5k »

This means that you would have messed up something in register CR0 (needed for enabling Paging)...
I don't think that's the case since you don't use paging, do you?
beyondsociety

Re:Problem with code running in Bochs

Post by beyondsociety »

No, I don't. What could be the problem. Code is attached below.
jrfritz

Re:Problem with code running in Bochs

Post by jrfritz »

What code did you change to make your bootloader crash?
beyondsociety

Re:Problem with code running in Bochs

Post by beyondsociety »

Read function and pmode stack.

If I keep my read function the same, I get a bogus memory error, but if I change it I get a 3rd excep[tion with no resolution.

Weird huh?
Post Reply