I need a sugestion
Posted: Thu May 07, 2009 11:00 pm
This function is invoked by the machine/IDT to dispatch the event (interrupt)...
...and the according with intel manuals, this step occurs first:
Here starts my problem...
..it enters to my procedure with this values:
then come the IRET (to finish the interrupt live)
And... the system crash
This the result:
We are in the same location (in terms of stack) when the system call this function and the next instruction is iRET (as end of interrupt)
and it is suposed to pick up the pushed values from the stack and resume the task...
But... it crash!!!
But was realy the IP and CS on the stack??? Yes...
before the iret, and to see the real values of stack, I perform some pops and the IP and CS was realy there
If this values are on the stack, why the system crash? Any ideia????
...and the according with intel manuals, this step occurs first:
Code: Select all
push the eflags of currently task
push the CS
push the EIP
(all informations needed to resume the suspended task)
..it enters to my procedure with this values:
Code: Select all
RSP=00000000000007e8 RBP=00000000000007f0 on entry
At this stage the stack is already have the return point (see above)
I prepare all I need to dispatch the actual interrupt
RSP=00000000000007e0 RBP=00000000000007f0 push 0 and push 32
RSP=00000000000007c0 RBP=00000000000007f0 pusha
RSP=00000000000007bc RBP=00000000000007f0 push ds
RSP=00000000000007b8 RBP=00000000000007f0 push es
RSP=00000000000007b4 RBP=00000000000007f0 push fs
RSP=00000000000007b0 RBP=00000000000007f0 push gs
RSP=00000000000007ac RBP=00000000000007f0 push eax
RSP=00000000000007a0 RBP=00000000000007a4 ->enter to high level irq dispatcher
RSP=00000000000007ac RBP=00000000000007f0 <-on return
RSP=00000000000007b0 RBP=00000000000007f0 pop eax
RSP=00000000000007b4 RBP=00000000000007f0 pop gs
RSP=00000000000007b8 RBP=00000000000007f0 pop fs
RSP=00000000000007bc RBP=00000000000007f0 pop es
RSP=00000000000007c0 RBP=00000000000007f0 pop ds
RSP=00000000000007e0 RBP=00000000000007f0 pusha
RSP=00000000000007e8 RBP=00000000000007f0 add esp, 8
Code: Select all
IRET
This the result:
Code: Select all
next instruction (IRET) make my system crash!!!
(0) [0x0010066b] 0008:000000000010066b (unk. ctxt): iret ; 66cf
00009339262e[CPU0 ] check_cs(0x0010): not a valid code segment !
00009339262i[CPU0 ] CPU is in protected mode (active)
00009339262i[CPU0 ] CS.d_b = 32 bit
00009339262i[CPU0 ] SS.d_b = 32 bit
00009339262i[CPU0 ] EFER = 0x00000000
00009339262i[CPU0 ] | RAX=0000000000000010 RBX=0000000000000000
00009339262i[CPU0 ] | RCX=00000000000007fb RDX=0000000007880000
00009339262i[CPU0 ] | RSP=00000000000007e8 RBP=00000000000007f0
00009339262i[CPU0 ] | RSI=0000000000092400 RDI=00000000001023d8
00009339262i[CPU0 ] | R8=0000000000000000 R9=0000000000000000
00009339262i[CPU0 ] | R10=0000000000000000 R11=0000000000000000
00009339262i[CPU0 ] | R12=0000000000000000 R13=0000000000000000
00009339262i[CPU0 ] | R14=0000000000000000 R15=0000000000000000
00009339262i[CPU0 ] | IOPL=0 id vip vif ac vm RF nt of df if tf sf zf af PF cf
00009339262i[CPU0 ] | SEG selector base limit G D
00009339262i[CPU0 ] | SEG sltr(index|ti|rpl) base limit G D
00009339262i[CPU0 ] | CS:0008( 0001| 0| 0) 00000000 000fffff 1 1
00009339262i[CPU0 ] | DS:0010( 0002| 0| 0) 00000000 000fffff 1 1
00009339262i[CPU0 ] | SS:0010( 0002| 0| 0) 00000000 000fffff 1 1
00009339262i[CPU0 ] | ES:0010( 0002| 0| 0) 00000000 000fffff 1 1
00009339262i[CPU0 ] | FS:0010( 0002| 0| 0) 00000000 000fffff 1 1
00009339262i[CPU0 ] | GS:0010( 0002| 0| 0) 00000000 000fffff 1 1
00009339262i[CPU0 ] | MSR_FS_BASE:0000000000000000
00009339262i[CPU0 ] | MSR_GS_BASE:0000000000000000
00009339262i[CPU0 ] | RIP=000000000010066b (000000000010066b)
00009339262i[CPU0 ] | CR0=0x60000011 CR1=0x0 CR2=0x0000000000000000
00009339262i[CPU0 ] | CR3=0x00000000 CR4=0x00000000
(0).[9339262] [0x0010066b] 0008:000000000010066b (unk. ctxt): iret ; 66cf
00009339262e[CPU0 ] exception(): 3rd (13) exception with no resolution, shutdown status is 00h, resetting
00009339262i[SYS ] bx_pc_system_c::Reset(SOFTWARE) called
00009339262i[CPU0 ] cpu software reset
00009339262i[APIC0] local apic in CPU 0 initializing
and it is suposed to pick up the pushed values from the stack and resume the task...
But... it crash!!!
But was realy the IP and CS on the stack??? Yes...
before the iret, and to see the real values of stack, I perform some pops and the IP and CS was realy there
Code: Select all
RAX=0000000000000020 int nr my pushes
RAX=0000000000000000 00000 my pushes
RAX=0000000000100c03 ip system pushed
RAX=0000000000000008 cs system pushed