I am running POK, which in turn is running RTEMS inside a partition. The system makes active use of x86 segments and I can't find out how I can tell GDB to consider this.
If I execute the following inline asm code, the EIP (see comment) will be in the right location. When I load the right SS (0x23) and check this location with gdb it will show me 0x00000000. If I load it back into EAX and check EAX with 'info reg' it will show me the right EIP address.
"movl 56(%1), %%ebx \t\n" //move user esp address to register
"movl 60(%1), %%eax \t\n"
"movl %%eax , %%gs \t\n" // move user's SS to gs register
"movl 44(%1), %%eax \t\n" //move eip to register
"movl %%eax , %%gs:(%%ebx) \t\n" // move eip to user esp
%GS is the offset into the GDT, so I tried to find the GDT and then reconstruct the base address of the memory segment myself, but GDB wasn't of help there, too.
If I omitt %%gs: and let GDB print the memory referenced by %%ebx it will show the value moved there, but the programm isn't finding it in it's memory.
Is there a way to find out the right segment (base address) with GDB? Is GDB even capable of handling segmentation?