Back to home page

DOS ain't dead

Forum index page

Log in | Register

Back to the forum
Board view  Mix view

iret from dpmi interrupt handler (Developers)

posted by cpcdos(R) E-mail, FRANCE [Lyon], 17.03.2018, 18:41
(edited by cpcdos on 18.03.2018, 11:49)

Hello everyone,

I've a strange problem with my ISR runtime under djgpp/G++.

My code for create interrupt handler
---------------------------- main.cpp -----------------------------------
extern "C" void end_Routine_ISR();
extern "C" void Routine_ISR();
_go32_dpmi_seginfo old_handle, new_handle;

/****** My "ISR handler" function in asm inline *******/
asm (".global _Routine_ISR n _Routine_ISR:n"

// "call _my_context_switching_function"

asm (".global _end_Routine_ISR n _end_Routine_ISR:n"

void Create_ISR() {
int Vecteur_initialisation = 0x08;

if(_go32_dpmi_get_protected_mode_interrupt_vector(Vecteur_initialisation, &old_handle)!=0)
printf(" ERROR P1n");

nouveau_handle.pm_offset = (long unsigned int) (void*) Routine_ISR;
nouveau_handle.pm_selector = _go32_my_cs();

if(_go32_dpmi_chain_protected_mode_interrupt_vector(Vecteur_initialisation, &new_handle)!=0)
printf(" ERROR P2n");

_go32_dpmi_lock_code((void*) Routine_ISR, (unsigned long) ((unsigned long) &end_Routine_ISR - (unsigned long) &Routine_ISR));
_go32_dpmi_lock_data((void*) Routine_ISR, (unsigned long) ((unsigned long) &end_Routine_ISR - (unsigned long) &Routine_ISR));


I compile this,
gpp main.cpp -O0 -m32 -S

And this is my problem
---------------------------- main.s-----------------------------------
... generated code ...

.global _Routine_ISR

call _my_context_switching_function().

.global _end_Routine_ISR

... generated code ...

During my _Routine_ISR interruption if i use this "iret" my program crash with SIGSEGV signal (with or without my "call function"). But if i use "ret" interrupt works.:-|

I want use "iret" in my context switching function , but i can't

According to my Google friend, NT bit flag must set from EFLAG in my context structure, but it's an interrupt created by _go32_dpmi_chain_protected_mode_interrupt_vector() ... WTF :confused:

Someone can help me?

Best regards,

Sébastien FAVIER

ps: Excuse me for my English level, I'm a French student


Complete thread:

Back to the forum
Board view  Mix view
15318 Postings in 1384 Threads, 254 registered users, 14 users online (0 registered, 14 guests)
DOS ain't dead | Admin contact
RSS Feed
powered by my little forum