Task switch runs into GPF or PF

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
User avatar
ehenkes
Member
Member
Posts: 124
Joined: Mon Mar 23, 2009 3:15 am
Location: Germany
Contact:

Task switch runs into GPF or PF

Post by ehenkes »

With task switching (JM, chap. 9) from timer handler I get into GPF or PF:

Code: Select all

printf("task_switch before asm: eip: %x esp: %x ebp: %x cur_dir->phys: %x\n",eip,esp,ebp,current_directory->physicalAddr);

    asm volatile("         \
      cli;                 \
      mov %0, %%ecx;       \
      mov %1, %%esp;       \
      mov %2, %%ebp;       \
      mov %3, %%cr3;       \
      mov $0x12345, %%eax; \
      sti;                 \
      jmp *%%ecx;           "
      : : "r"(eip), "r"(esp), "r"(ebp), "r"(current_directory->physicalAddr) : "ebx","edx" );
task_switch before asm: eip: 0000D4C2h esp: 0018FFD8h ebp: 0018FFF0h cur_dir->phys: 0041E000h
Page Fault (page not present) at 0040FCA0h - EIP: 0040FCA0h
w/o clobbering ebx and edx I run into a GPF. Any advice?
Post Reply