Solved General protection fault on return from any interrupt

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
max9403
Posts: 17
Joined: Sun Feb 09, 2014 3:25 pm

Re: General protection fault on return from any interrupt

Post by max9403 »

Thanks for the reply though, it was originally written in AT&T until I couldn't figure out was wrong with it and I wanted to compare it to other code :/ it runs properly using ret instead of iret though... at least for a while

edit: bochs gives a "check_cs(0x0010): not a valid code segment" though it is changed to 0x8 when the interrupt occurs

edit2: CS is set 0x10 directly after grub2, from what I gather from this: Can somebody tell me if this ASM is ok ? is that setting CS to 0x10 is not valid if DS has that value already :/ however I do have:

Code: Select all

	mov $0x10, %ax
	mov %ax, %ds
	mov %ax, %es
	mov %ax, %fs
	mov %ax, %gs
	mov %ax, %ss
at the end of my GDT setting CS = 0x8 manually in bochs seems to fix it, going to try implement it into my build

edit3: Wow I feel stupid -_- I forgot put the jmp in at the end of the gdt_flush :oops:
Post Reply