For begin, this is my code FreeBasic/GAS (AT&T)
INIT_INTERRUPT()
Code: Select all
jmp saut_1%f
DS_SEL: .short 0
INT1C_OFF: .int 0
INT1C_SEL: .short 0
saut_1:
push ds
pop DS_SEL
push cs
pop WORD PTR [cs_]
push ds
pop WORD PTR [ds_]
push es
pop WORD PTR [es_]
push ss
pop WORD PTR [ss_]
mov ax, 0x204
mov bl, 0x1c
int 0x31
jc saut_2%f
mov INT1C_SEL, cx
mov INT1C_OFF, edx
saut_2:
Code: Select all
mov ax, 0x205
mov bl, 0x1c
push cs
pop cx
mov edx, OFFSET _MY_INTERRUPT_FUNCTION
int 0x31
jc saut_3%f
saut_3:
And this is my problem :
MY_INTERRUPT_FUNCTION()
Code: Select all
sti
' Save registers
push ds
push es
push fs
push gs
' Entry point of DS
mov dx, ds
' Load data section in DS
mov ax, cs:DS_SEL
mov ds, ax
' Restaure seg values
mov ax, cs
mov cs_, ax
mov ds_, dx
mov ax, es
mov es_, ax
mov ax, ss
mov ss_, ax
mov fs_, fs
mov gs_, gs
' Push all registers on stack
pushad
' ===== SWITCH STACK =====
push esp
CALL SWITCH_TASK
mov esp, eax
pop esp
' ===== SWITCH STACK =====
' Restaure registers
popad
pop gs
pop fs
pop es
pop ds
sti
iret
About iret instruction, if i want modify the "Return EIP register" on my current interrupt i must write my new EIP on it ? Yes ? So after my CALL, i push like this _mytask1 for test :
Code: Select all
push eax
mov eax, _mytask1
mov ss:[esp]+0, eax
pop eax
I've seeing the content of "ss:[ESP]+0", the famous "Return EIP" before modifications, and i've every "0x16F".. what??
I've already executed on ring0, with cwsdpr0.exe on FreeDOS..
I'm lost, if someone can help me?
Thank you a lot,