IRET instructon generating general protection fault

Discussion created by jas_dit on Jan 4, 2010

I am trying to develop a 32 bit linux kernel which will be capable of running 64 bit applications. For this I am running proessor in long mode.

When I am trying to return from 64-bit kernel mode to compatibility user mode via IRET instruction it is givng GP#0. The values it is trying to restore is valid one and EFLAGS.NT is also clear. I am trying to restore the following contents.

00000000 0000002B       - SS

00000000 BFB088B0       - SP

00000000 00000200       - EFLAGS

00000000 00000023       - CS

00000000 08048074        - IP

Current CFLAGS is 00000000 00000002

The error code I am getting is 0.

From programmers guide I am not able to get any reason for which it can generate a general potection fault with error code 0.

can somebody please help.