Subversion Repositories Kolibri OS

Rev

Rev 6 | Rev 9 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2. ;;                                                               ;;
  3. ;;  MenuetOS process management, protected ring3                 ;;
  4. ;;                                                               ;;
  5. ;;  Distributed under GPL. See file COPYING for details.         ;;
  6. ;;  Copyright 2003 Ville Turjanmaa                               ;;
  7. ;;                                                               ;;
  8. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  9.  
  10. align 32
  11.  
  12. ; GDT TABLE
  13.  
  14. gdts:
  15.  
  16.         dw     gdte-$-1
  17.         dd     gdts
  18.         dw     0
  19.  
  20. int_code_l:
  21. os_code_l:
  22.  
  23.         dw     0xffff
  24.         dw     0x0000
  25.         db     0x00
  26.         dw     11011111b *256 +10011010b
  27.         db     0x00
  28.  
  29. int_data_l:
  30. os_data_l:
  31.  
  32.         dw     0xffff
  33.         dw     0x0000
  34.         db     0x00
  35.         dw     11011111b *256 +10010010b
  36.         db     0x00
  37.  
  38. app_code_l:
  39.       dw ((0x80000000-std_application_base_address) shr 12) and 0xffff
  40.       dw 0
  41.       db 0
  42.       dw 11010000b*256+11111010b+256*((0x80000000-std_application_base_address) shr 28)
  43.       db std_application_base_address shr 24
  44.  
  45. app_data_l:
  46.       dw (0x80000000-std_application_base_address) shr 12 and 0xffff
  47.       dw 0
  48.       db 0
  49.       dw 11010000b*256+11110010b+256*((0x80000000-std_application_base_address) shr 28)
  50.       db std_application_base_address shr 24
  51.  
  52. graph_data_l:
  53.  
  54.         dw     0x3ff
  55.         dw     0x0000
  56.         db     0x00
  57.         dw     11010000b *256 +11110010b
  58.         db     0x00
  59.  
  60. tss0_l:
  61.       times (max_processes+10) dd 0,0
  62.  
  63. gdte:
  64.  
  65.  
  66.  
  67. idtreg:
  68.      dw   8*0x41-1
  69.      dd   idts+8
  70. label idts at 0xB100-8
  71.  
  72.  
  73.  
  74. uglobal
  75.  tss_sceleton:
  76.   l.back   dw 0,0
  77.   l.esp0   dd 0
  78.   l.ss0    dw 0,0
  79.   l.esp1   dd 0
  80.   l.ss1    dw 0,0
  81.   l.esp2   dd 0
  82.   l.ss2    dw 0,0
  83.   l.cr3    dd 0
  84.   l.eip    dd 0
  85.   l.eflags dd 0
  86.   l.eax    dd 0
  87.   l.ecx    dd 0
  88.   l.edx    dd 0
  89.   l.ebx    dd 0
  90.   l.esp    dd 0
  91.   l.ebp    dd 0
  92.   l.esi    dd 0
  93.   l.edi    dd 0
  94.   l.es     dw 0,0
  95.   l.cs     dw 0,0
  96.   l.ss     dw 0,0
  97.   l.ds     dw 0,0
  98.   l.fs     dw 0,0
  99.   l.gs     dw 0,0
  100.   l.ldt    dw 0,0
  101.   l.trap   dw 0
  102.   l.io     dw 0
  103. endg
  104.  
  105.  
  106. build_process_gdt_tss_pointer:
  107.  
  108.         mov    ecx,tss_data
  109.         mov    edi,0
  110.       setgdtl2:
  111.         mov    [edi+gdts+ tss0 +0], word tss_step
  112.         mov    [edi+gdts+ tss0 +2], cx
  113.         mov    eax,ecx
  114.         shr    eax,16
  115.         mov    [edi+gdts+ tss0 +4], al
  116.         mov    [edi+gdts+ tss0 +7], ah
  117.         mov    [edi+gdts+ tss0 +5], word 01010000b *256 +11101001b
  118.         add    ecx,tss_step
  119.         add    edi,8
  120.         cmp    edi,8*(max_processes+5)
  121.         jbe    setgdtl2
  122.  
  123.         ret
  124.  
  125.  
  126. build_interrupt_table:
  127.  
  128.         mov    edi, idts+8
  129.         mov    esi, sys_int
  130.         mov    ecx, 0x40
  131.      @@:
  132.         mov    eax, [esi]
  133.         mov    [edi],   ax           ; lower part of offset
  134.         mov    [edi+2], word os_code ; segment selector
  135.         shr    eax, 16
  136.         mov    [edi+4], word 10001110b shl 8 ; interrupt descriptor
  137.         mov    [edi+6], ax
  138.         add    esi, 4
  139.         add    edi, 8
  140.         dec    ecx
  141.         jnz    @b
  142.        
  143.         ;mov    edi,8*0x40+idts+8
  144.         mov    [edi + 0], word (i40 and ((1 shl 16)-1))
  145.         mov    [edi + 2], word os_code
  146.         mov    [edi + 4], word 11101110b*256
  147.         mov    [edi + 6], word (i40 shr 16)        
  148.  
  149.         ret
  150.  
  151.  
  152.  
  153. iglobal
  154.   sys_int:
  155.     dd   e0,e1,e2,e3,e4,e5,e6,e7,e8,e9,e10,e11,e12,e13,e14,e15
  156.     dd   e16,e17
  157.     times 14 dd unknown_interrupt
  158.  
  159.     dd   irq0  ,irq1  ,p_irq2 ,p_irq3 ,p_irq4 ,p_irq5,p_irq6 ,p_irq7
  160.     dd   p_irq8,p_irq9,p_irq10,p_irq11,p_irq12,irqD  ,p_irq14,p_irq15
  161.  
  162.     times 16 dd unknown_interrupt
  163.  
  164.     dd   i40
  165. endg
  166.  
  167. ; simply return control to interrupted process
  168. unknown_interrupt:
  169.      iret
  170.  
  171. macro exceptions [num]
  172. {
  173.   forward
  174.   e#num :
  175.         mov bl, num
  176.         jmp exc_c
  177. }
  178.  
  179. exceptions 0, 1, 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17
  180. exc_c:
  181.         mov   ax, os_data
  182.         mov   ds, ax
  183.         mov   es, ax
  184.  
  185.         movzx eax, bl        
  186.         mov   [error_interrupt], eax
  187.         call  show_error_parameters
  188.        
  189.         mov   edx, [0x3010]
  190.         mov   [edx + 0xA], byte 4
  191.        
  192.         jmp   change_task
  193.  
  194.  
  195. ;;;;;;;;;;;;;;;;;;;;;;;
  196. ;; FPU ERROR HANDLER ;;
  197. ;;;;;;;;;;;;;;;;;;;;;;;
  198.  
  199. align 4
  200. e7:
  201.         clts
  202.          
  203.         push  eax
  204.         push  ds es
  205.        
  206.         mov   ax, os_data
  207.         mov   ds, ax
  208.         mov   es, ax
  209.        
  210.         mov   eax, [prev_user_of_fpu]
  211.         shl   eax, 8
  212.         add   eax, 0x80000 + 0x10
  213.         fsave [eax]
  214.        
  215.         mov   eax, [0x3000]
  216.         mov   [prev_user_of_fpu], eax
  217.         shl   eax, 8
  218.         add   eax, 0x80000
  219.         cmp   [eax + 0x7f], byte 0
  220.         je    @f
  221.         frstor [eax+0x10]
  222.      @@:
  223.         mov   [eax + 0x7f], byte 1
  224.        
  225.         pop   es ds
  226.         pop   eax
  227.        
  228.         iret
  229.        
  230. iglobal
  231.   prev_user_of_fpu dd 1
  232. endg
  233.  
  234.  
  235.  
  236.  
  237.  
  238. writehex:
  239.       pusha
  240.      
  241.       mov  edi, [write_error_to]
  242.       mov  esi, 8
  243.     @@:
  244.       mov  ecx, eax
  245.       and  ecx, 0xf
  246.  
  247.       mov  cl,[ecx+hexletters]
  248.       mov  [edi],cl
  249.       dec  edi
  250.  
  251.       shr  eax,4
  252.       dec  esi
  253.       jnz  @b
  254.  
  255.       popa
  256.       ret
  257.  
  258. iglobal
  259.   hexletters  db '0123456789ABCDEF'
  260.  
  261.   error_interrupt         dd  -1
  262.  
  263.   process_error  db 'K : Process - forced terminate INT: 00000000',13,10,0
  264.   process_pid    db 'K : Process - forced terminate PID: 00000000',13,10,0
  265.   process_eip    db 'K : Process - forced terminate EIP: 00000000',13,10,0
  266.   system_error   db 'K : Kernel error',13,10,0
  267. endg
  268.  
  269. uglobal
  270.   write_error_to  dd  0x0
  271. endg
  272.  
  273. show_error_parameters:
  274.        
  275.         mov    [write_error_to],process_pid+43
  276.         mov    eax,[0x3000]
  277.         shl    eax, 5
  278.         mov    eax,[0x3000+4+eax]
  279.         call   writehex
  280.        
  281.         mov    [write_error_to],process_error+43
  282.         mov    eax,[error_interrupt]
  283.         call   writehex
  284.        
  285.         mov    eax,[0x3000]
  286.         shl    eax,8
  287.         cmp    [0x80000+eax+0xB0],byte 0
  288.         jnz    .system_error
  289.  
  290.         mov    eax,[0x3000]
  291.         imul   eax,tss_step
  292.         mov    eax,[eax+tss_data+l.eip-tss_sceleton]
  293. .out_eip:        
  294.         mov    [write_error_to],process_eip+43
  295.         call   writehex
  296.  
  297.         mov    esi,process_error
  298.         call   sys_msg_board_str
  299.  
  300.         mov    esi,process_pid
  301.         call   sys_msg_board_str
  302.  
  303.         mov    esi,process_eip
  304.         call   sys_msg_board_str
  305.  
  306.         ret
  307.        
  308. .system_error:
  309.         mov    esi,system_error
  310.         call   sys_msg_board_str
  311.         mov    eax,[0x3000]
  312.         shl    eax,7
  313.         mov    eax,[eax+0x298000+l.eip-tss_sceleton]
  314.         jmp    .out_eip        
  315.  
  316.  
  317.  
  318.  
  319. ; irq1  ->  hid/keyboard.inc
  320.  
  321.  
  322. macro irqhh [num]
  323. {
  324.   forward
  325.   p_irq#num :
  326.      pushad
  327.      mov   edi, num
  328.      jmp   irq_c
  329. }
  330.  
  331. irqhh 2,3,4,5,6,7,8,9,10,11,12,14,15
  332.  
  333.  irq_c:
  334.      push  ds es
  335.      mov   ax, os_data
  336.      mov   ds, ax
  337.      mov   es, ax
  338.      call  irqhandler
  339.      pop   es ds
  340.      popad
  341.      iret
  342.        
  343. irqD:
  344.      pushad
  345.      push  ds es
  346.      mov   ax, os_data
  347.      mov   ds, ax
  348.      mov   es, ax
  349.      
  350.      mov   dx,0xf0
  351.      mov   al,0
  352.      out   dx,al
  353.  
  354.      mov   dx,0xa0
  355.      mov   al,0x20
  356.      out   dx,al
  357.      mov   dx,0x20
  358.      out   dx,al    
  359.      
  360.      pop   es ds
  361.      popad
  362.      iret
  363.  
  364.  
  365.  
  366. uglobal
  367.   irqh dd 0x0
  368. endg
  369.  
  370. irqhandler:
  371.  
  372.      push   edi
  373.  
  374.      mov    esi,edi          ; 1
  375.      shl    esi,6            ; 1
  376.      add    esi,irq00read    ; 1
  377.      shl    edi,12           ; 1
  378.      add    edi,0x2E0000
  379.  
  380.      mov    [check_idle_semaphore],5
  381.  
  382.    irqnewread:
  383.  
  384.      mov    dx,[esi]         ; 2+
  385.  
  386.      cmp    dx,0             ; 1
  387.      jz     irqover
  388.      cmp    [esi+3],byte 1   ; 2     ; byte read
  389.      jne    noirqbyte        ; 4-11
  390.  
  391.      in     al,dx
  392.  
  393.      mov    edx,[edi]
  394.      cmp    edx,4000
  395.      je     irqfull
  396.      mov    ebx,edi
  397.      add    ebx,0x10
  398.      add    ebx,edx
  399.      mov    [ebx],al
  400.      inc    edx
  401.      mov    [edi],edx
  402.  
  403.      add    esi,4
  404.      jmp    irqnewread
  405.  
  406.    noirqbyte:
  407.  
  408.  
  409.      cmp    [esi+3],byte 2     ; word read
  410.      jne    noirqword
  411.  
  412.      in     ax,dx
  413.  
  414.      mov    edx,[edi]
  415.      cmp    edx,4000
  416.      je     irqfull
  417.      mov    ebx,edi
  418.      add    ebx,0x10
  419.      add    ebx,edx
  420.      mov    [ebx],ax
  421.      add    edx,2
  422.      mov    [edi],edx
  423.      add    esi,4
  424.      jmp    irqnewread
  425.  
  426.    noirqword:
  427.    irqfull:
  428.    irqover:
  429.  
  430.      mov    al,0x20            ; ready for next irq
  431.      out    0x20,al
  432.  
  433.      pop    ebx
  434.      cmp    ebx,7
  435.      jbe    noa0
  436.      out    0xa0,al
  437.    noa0:
  438.  
  439.      ret
  440.  
  441.  
  442.  
  443. set_application_table_status:
  444.         push eax
  445.  
  446.         mov  eax,[0x3000]
  447.         shl  eax, 5
  448.         add  eax,0x3000+4
  449.         mov  eax,[eax]
  450.  
  451.         mov  [application_table_status],eax
  452.  
  453.         pop  eax
  454.  
  455.         ret
  456.  
  457.  
  458. clear_application_table_status:
  459.         push eax
  460.  
  461.         mov  eax,[0x3000]
  462.         shl  eax, 5
  463.         add  eax,0x3000+4
  464.         mov  eax,[eax]
  465.  
  466.         cmp  eax,[application_table_status]
  467.         jne  apptsl1
  468.         mov  [application_table_status],0
  469.       apptsl1:
  470.  
  471.         pop  eax
  472.  
  473.         ret
  474.  
  475.  
  476.  
  477. sys_resize_app_memory:
  478.         ; eax = 1 - resize
  479.         ;     ebx = new amount of memory
  480.  
  481.         cmp    eax,1
  482.         jne    .no_application_mem_resize
  483.        
  484.         jmp    new_mem_resize ;resize for new type of processes
  485.  
  486.  
  487.      .no_application_mem_resize:
  488.  
  489.         ret
  490.  
  491.  
  492.  
  493. get_app_params:
  494.  
  495.     push eax
  496.  
  497.     cmp  [0x90000+6],word '00'
  498.     jne  no_00_header
  499.  
  500.     mov  eax,[0x90000+12]
  501.     mov  [app_start],eax
  502.     mov  eax,[0x90000+16]
  503.     mov  [app_i_end],eax
  504.     mov  eax,[0x90000+20]
  505.     mov  [app_mem],eax
  506.     shr  eax,1
  507.     sub  eax,0x10
  508.     mov  [app_esp],eax
  509.     mov  eax,[0x90000+24]
  510.     mov  [app_i_param],eax
  511.     mov  [app_i_icon],dword 0
  512.  
  513.     pop  eax
  514.     mov  esi,1
  515.     ret
  516.  
  517.   no_00_header:
  518.  
  519.  
  520.     cmp  [0x90000+6],word '01'
  521.     jne  no_01_header
  522.  
  523.     mov  eax,[0x90000+12]
  524.     mov  [app_start],eax
  525.     mov  eax,[0x90000+16]
  526.     mov  [app_i_end],eax
  527.     mov  eax,[0x90000+20]
  528.     mov  [app_mem],eax
  529.     mov  eax,[0x90000+24]
  530.     mov  [app_esp],eax
  531.     mov  eax,[0x90000+28]
  532.     mov  [app_i_param],eax
  533.     mov  eax,[0x90000+32]
  534.     mov  [app_i_icon],eax
  535.  
  536.     pop  eax
  537.     mov  esi,1
  538.     ret
  539.  
  540.    no_01_header:
  541.  
  542.     pop  eax
  543.     mov  esi,0
  544.     ret
  545.  
  546.  
  547. start_application_fl:
  548.     jmp new_start_application_fl
  549.  
  550. ;************************************************************************
  551.  
  552. start_application_floppy:
  553.     jmp  new_start_application_floppy
  554.  
  555. ;********************************************************************
  556.  
  557. start_application_hd:
  558.     jmp   new_start_application_hd
  559.  
  560. uglobal
  561.   new_process_place  dd  0x0
  562.   app_start    dd  0x0
  563.   app_i_end    dd  0x0
  564.   app_mem      dd  0x0
  565.   app_esp      dd  0x0
  566.   app_i_param  dd  0x0
  567.   app_i_icon   dd  0x0
  568.   app_mem_pos  dd  0x0
  569.   appl_path        dd 0x0
  570.   appl_path_size   dd 0x0        
  571. endg
  572.  
  573. iglobal
  574.   hd_app_string      db  'HDAPP       '
  575.   process_loading    db 'K : Process - loading ',13,10,0
  576.   process_running    db 'K : Process - done',13,10,0
  577.   first_gdt_search   dd 0x2
  578. endg
  579.  
  580.  
  581. sys_threads:
  582.  
  583. ; eax=1 create thread
  584. ;
  585. ;   ebx=thread start
  586. ;   ecx=thread stack value
  587. ;
  588. ; on return : eax = pid
  589. jmp new_sys_threads
  590.  
  591. iglobal
  592.   process_terminating   db 'K : Process - terminating',13,10,0
  593.   process_terminated    db 'K : Process - done',13,10,0
  594. endg
  595.  
  596.  
  597. terminate: ; terminate application
  598.     push   esi
  599.     mov    esi,process_terminating
  600.     call   sys_msg_board_str
  601.     pop    esi
  602. ;start memory manager code    
  603. ;    mov    eax,esi
  604. ;    call   MEM_Heap_Clean
  605. ;end memory manager code
  606.    
  607.  
  608.     cli
  609.     cmp   [application_table_status],0
  610.     je    term9
  611.     sti
  612.     call  change_task
  613.     jmp   terminate
  614.   term9:
  615.  
  616.     call  set_application_table_status
  617.    
  618.     mov    eax,esi
  619.     call   dispose_app_cr3_table
  620.  
  621.     cmp   [prev_user_of_fpu],esi   ; if user fpu last -> fpu user = 1
  622.     jne   fpu_ok_1
  623.     mov   [prev_user_of_fpu],1
  624.   fpu_ok_1:
  625.  
  626.     mov   [0xf400],byte 0           ; empty keyboard buffer
  627.     mov   [0xf500],byte 0           ; empty button buffer
  628.  
  629.  
  630.     mov   ecx,esi                 ; remove buttons
  631.   bnewba2:
  632.     mov   edi,[0xfe88]
  633.     mov   eax,edi
  634.     cld
  635.     movzx ebx,word [edi]
  636.     inc   bx
  637.   bnewba:
  638.     dec   bx
  639.     jz    bnmba
  640.     add   eax,0x10
  641.     cmp   cx,[eax]
  642.     jnz   bnewba
  643.     pusha
  644.     mov   ecx,ebx
  645.     inc   ecx
  646.     shl   ecx,4
  647.     mov   ebx,eax
  648.     add   eax,0x10
  649.     call  memmove
  650.     dec   dword [edi]
  651.     popa
  652.     jmp   bnewba2
  653.   bnmba:
  654.  
  655.     pusha     ; save window coordinates for window restoring
  656.     cld
  657.     shl   esi,5
  658.     add   esi,window_data
  659.     mov   ax,[esi+0]
  660.     mov   word [dlx],ax
  661.     mov   bx,[esi+8]
  662.     add   ax,bx
  663.     mov   word [dlxe],ax
  664.     mov   ax,[esi+4]
  665.     mov   word [dly],ax
  666.     mov   bx,[esi+12]
  667.     add   ax,bx
  668.     mov   word [dlye],ax
  669.     mov   [esi+0],word 0
  670.     mov   [esi+8],word 5
  671.     mov   ax,[0xFE04]
  672.     mov   [esi+4],ax
  673.     mov   [esi+12],word 5
  674.     xor   eax, eax
  675.     mov   [esi+16],eax;dword 0
  676.     mov   [esi+20],eax;dword 0
  677.     mov   [esi+24],eax;dword 0
  678.     mov   [esi+28],eax;dword 0
  679.     popa
  680.  
  681.     pusha
  682.     mov   edi,esi
  683.     shl   edi,5
  684.     add   edi,window_data
  685.     mov   ecx,32/4
  686.     xor   eax, eax
  687.   ;  cld
  688.     rep   stosd
  689.  
  690.     mov   eax,[0xFE04]      ; set window to start from maxy+1
  691.     add   eax,2
  692.  
  693.     mov   edi,esi
  694.     shl   edi,5
  695.     add   edi,window_data
  696.     mov   [edi+4],eax
  697.  
  698.     popa
  699.  
  700.     pusha
  701.     mov   edi,esi
  702.     shl   edi,5
  703.     add   edi,draw_data
  704.     mov   ecx,32/4
  705.     xor   eax, eax
  706.   ;  cld
  707.     rep   stosd
  708.     popa
  709.  
  710.     pusha         ; at 0x80000+
  711.     mov   edi,esi
  712.     shl   edi,8
  713.     add   edi,0x80000
  714.     mov   ecx,256/4
  715.     xor   eax, eax
  716.   ;  cld
  717.     rep   stosd
  718.     popa
  719.  
  720.     pusha          ; name to spaces
  721.     mov   edi,esi
  722.     shl   edi,8
  723.     add   edi,0x80000
  724.     mov   ecx,11
  725.     mov   eax,' '
  726.   ;  cld
  727.     rep   stosb
  728.     popa
  729.  
  730.     pusha                ; C000 --> C400
  731.     mov   eax, 0xc000
  732.     mov   esi, 0
  733.   nlc40:
  734.     add   eax, 2
  735.     inc   esi
  736.     cmp   esi, [0x3004]
  737.     jae   nlc41
  738.     movzx ecx, word [eax]
  739.     mov   [0xC400 + ecx*2], si
  740.     jmp   nlc40
  741.   nlc41:
  742.     popa
  743.  
  744.     pusha ; remove hd1 reservation
  745.     mov   edx,esi
  746.     shl   edx, 5 ;imul  edx,0x20
  747.     add   edx,0x3000
  748.     mov   edx,[edx+4]
  749.     cmp   [hd1_status],edx
  750.     jne   no_hd1_s_remove
  751.     mov   [hd1_status],0
  752.   no_hd1_s_remove:
  753.     popa
  754.  
  755.     pusha ; remove all irq reservations
  756.     mov   edx,esi
  757.     shl   edx, 5 ;imul  edx,0x20
  758.     add   edx,0x3000
  759.     mov   edx,[edx+4]
  760.     mov   edi,irq_owner
  761.     mov   ecx,16
  762.   newirqfree:
  763.     cmp   [edi],edx
  764.     jne   nofreeirq
  765.     mov   [edi],dword 0
  766.   nofreeirq:
  767.     add    edi,4
  768.     loop   newirqfree
  769.     popa
  770.  
  771.  
  772.     pusha                     ; remove all port reservations
  773.  
  774.     mov   edx,esi
  775.     shl   edx, 5 ;imul  edx,0x20
  776.     add   edx,0x3000
  777.     mov   edx,[edx+4]
  778.  
  779.   rmpr0:
  780.  
  781.     mov   esi,[0x2d0000]
  782.  
  783.     cmp   esi,0
  784.     je    rmpr9
  785.  
  786.   rmpr3:
  787.  
  788.     mov   edi,esi
  789.     shl   edi,4
  790.     add   edi,0x2d0000
  791.  
  792.     cmp   edx,[edi]
  793.     je    rmpr4
  794.  
  795.     dec   esi
  796.     jnz   rmpr3
  797.  
  798.     jmp   rmpr9
  799.  
  800.   rmpr4:
  801.  
  802.     mov   ecx,256
  803.     sub   ecx,esi
  804.     shl   ecx,4
  805.  
  806.     mov   esi,edi
  807.     add   esi,16
  808.     cld
  809.     rep   movsb
  810.  
  811.     dec   dword [0x2d0000]
  812.  
  813.     jmp   rmpr0
  814.  
  815.   rmpr9:
  816.  
  817.     popa
  818.     mov  edi,esi         ; do not run this process slot
  819.     shl  edi, 5
  820.     mov  [edi+0x300A],byte 9
  821. ;    call  systest
  822.     sti  ; .. and life goes on
  823.  
  824. ;    movzx eax,word [dlx]
  825. ;    movzx ebx,word [dly]
  826. ;    movzx ecx,word [dlxe]
  827. ;    movzx edx,word [dlye]
  828.     call  calculatescreen
  829.  
  830.     xor   eax, eax
  831.     xor   esi, esi
  832.     call  redrawscreen
  833.  
  834.     mov   [0xfff4],byte 0  ; no mouse background
  835.     mov   [0xfff5],byte 0  ; draw mouse
  836.  
  837.     mov   [application_table_status],0
  838.  
  839.     mov   esi,process_terminated
  840.     call  sys_msg_board_str
  841.  
  842. ;* start code - fix error redraw for terminate (2) - Mario79
  843. ;     cmp  [draw_present],1
  844. ;     je  no_draw_background_temp
  845. ;     mov   [0xfff0],byte 1
  846. ;no_draw_background_temp:
  847. ;    mov   [draw_present],0
  848.     ret
  849. ;draw_present db 0
  850. ;* end code - fix error redraw for terminate (2) - Mario79
  851.  
  852. iglobal
  853.   boot_sched_1    db   'Building gdt tss pointer',0
  854.   boot_sched_2    db   'Building IDT table',0
  855. endg
  856.  
  857.  
  858. build_scheduler:
  859.  
  860.         mov    esi,boot_sched_1
  861.         call   boot_log
  862.         call   build_process_gdt_tss_pointer
  863.  
  864.         mov    esi,boot_sched_2
  865.         call   boot_log
  866.         call   build_interrupt_table
  867.  
  868.         ret
  869.  
  870.