Subversion Repositories Kolibri OS

Rev

Rev 22 | Rev 33 | 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 exc_wo_code [num]
  172. {
  173.   forward
  174.   e#num :
  175.       mov bl, num
  176.       jmp exc_c
  177. }
  178.  
  179. macro exc_w_code [num]
  180. {
  181.   forward
  182.   e#num :
  183.       add esp, 4
  184.       mov bl, num
  185.       jmp exc_c
  186. }
  187.  
  188. exc_wo_code 0, 1, 2, 3, 4, 5, 6, 9, 15, 16 ; 18, 19
  189. exc_w_code 8, 10, 11, 12, 13, 14, 17
  190.  
  191. exc_c:
  192.         mov   ax, os_data
  193.         mov   ds, ax
  194.         mov   es, ax
  195.  
  196.         movzx eax, bl        
  197.         mov   [error_interrupt], eax
  198.         call  show_error_parameters
  199.        
  200.         mov   edx, [0x3010]
  201.         mov   [edx + 0xA], byte 4
  202.        
  203.         jmp   change_task
  204.  
  205.  
  206. ;;;;;;;;;;;;;;;;;;;;;;;
  207. ;; FPU ERROR HANDLER ;;
  208. ;;;;;;;;;;;;;;;;;;;;;;;
  209.  
  210. align 4
  211. e7:
  212.         clts
  213.          
  214.         push  eax
  215.         push  ds es
  216.        
  217.         mov   ax, os_data
  218.         mov   ds, ax
  219.         mov   es, ax
  220.        
  221.         mov   eax, [prev_user_of_fpu]
  222.         shl   eax, 8
  223.         add   eax, 0x80000 + 0x10
  224.         fsave [eax]
  225.        
  226.         mov   eax, [0x3000]
  227.         mov   [prev_user_of_fpu], eax
  228.         shl   eax, 8
  229.         add   eax, 0x80000
  230.         cmp   [eax + 0x7f], byte 0
  231.         je    @f
  232.         frstor [eax+0x10]
  233.      @@:
  234.         mov   [eax + 0x7f], byte 1
  235.        
  236.         pop   es ds
  237.         pop   eax
  238.        
  239.         iret
  240.        
  241. iglobal
  242.   prev_user_of_fpu dd 1
  243. endg
  244.  
  245.  
  246. writehex:
  247.       pusha
  248.      
  249.       mov  edi, [write_error_to]
  250.       mov  esi, 8
  251.     @@:
  252.       mov  ecx, eax
  253.       and  ecx, 0xf
  254.  
  255.       mov  cl,[ecx+hexletters]
  256.       mov  [edi],cl
  257.       dec  edi
  258.  
  259.       shr  eax,4
  260.       dec  esi
  261.       jnz  @b
  262.  
  263.       popa
  264.       ret
  265.  
  266. iglobal
  267.   hexletters  db '0123456789ABCDEF'
  268.  
  269.   error_interrupt         dd  -1
  270.  
  271.   process_error  db 'K : Process - forced terminate INT: 00000000',13,10,0
  272.   process_pid    db 'K : Process - forced terminate PID: 00000000',13,10,0
  273.   process_eip    db 'K : Process - forced terminate EIP: 00000000',13,10,0
  274.   system_error   db 'K : Kernel error',13,10,0
  275. endg
  276.  
  277. uglobal
  278.   write_error_to  dd  0x0
  279. endg
  280.  
  281. show_error_parameters:
  282.        
  283.         mov    [write_error_to],process_pid+43
  284.         mov    eax,[0x3000]
  285.         shl    eax, 5
  286.         mov    eax,[0x3000+4+eax]
  287.         call   writehex
  288.        
  289.         mov    [write_error_to],process_error+43
  290.         mov    eax,[error_interrupt]
  291.         call   writehex
  292.  
  293.         cmp    dword [esp+4+4], os_code ; CS
  294.         jnz    @f
  295.         mov    esi,system_error
  296.         call   sys_msg_board_str
  297.       @@:
  298.         mov    eax, [esp+4] ; EIP
  299.  
  300.         mov    [write_error_to],process_eip+43
  301.         call   writehex
  302.  
  303.         mov    esi,process_error
  304.         call   sys_msg_board_str
  305.  
  306.         mov    esi,process_pid
  307.         call   sys_msg_board_str
  308.  
  309.         mov    esi,process_eip
  310.         call   sys_msg_board_str
  311.  
  312.         ret
  313.  
  314.  
  315.  
  316. ; irq1  ->  hid/keyboard.inc
  317.  
  318.  
  319. macro irqh [num]
  320. {
  321.   forward
  322.   p_irq#num :
  323.      pushad
  324.      mov   edi, num
  325.      jmp   irq_c
  326. }
  327.  
  328. irqh 2,3,4,5,7,8,9,10,11,12,14,15
  329.  
  330.  irq_c:
  331.      push  ds es
  332.      mov   ax, os_data
  333.      mov   ds, ax
  334.      mov   es, ax
  335.      call  irqhandler
  336.      pop   es ds
  337.      popad
  338.      iret
  339.  
  340. p_irq6:
  341.      pushad
  342.      push  ds es
  343.      mov   ax, os_data
  344.      mov   ds, ax
  345.      mov   es, ax
  346.      call  fdc_irq
  347.  
  348.      mov    [check_idle_semaphore],5
  349.      mov   al, 0x20
  350.      out   0x20, al
  351.  
  352.      pop   es ds
  353.      popad
  354.      iret
  355.  
  356. irqD:
  357.      pushad
  358.      push  ds es
  359.      mov   ax, os_data
  360.      mov   ds, ax
  361.      mov   es, ax
  362.      
  363.      mov   dx,0xf0
  364.      mov   al,0
  365.      out   dx,al
  366.  
  367.      mov   dx,0xa0
  368.      mov   al,0x20
  369.      out   dx,al
  370.      mov   dx,0x20
  371.      out   dx,al    
  372.      
  373.      pop   es ds
  374.      popad
  375.      iret
  376.  
  377.  
  378. irqhandler:
  379.  
  380.      push   edi
  381.  
  382.      mov    esi,edi          ; 1
  383.      shl    esi,6            ; 1
  384.      add    esi,irq00read    ; 1
  385.      shl    edi,12           ; 1
  386.      add    edi,0x2E0000
  387.  
  388.      mov    [check_idle_semaphore],5
  389.  
  390.    irqnewread:
  391.  
  392.      mov    dx,[esi]         ; 2+
  393.  
  394.      cmp    dx,0             ; 1
  395.      jz     irqover
  396.      cmp    [esi+3],byte 1   ; 2     ; byte read
  397.      jne    noirqbyte        ; 4-11
  398.  
  399.      in     al,dx
  400.  
  401.      mov    edx,[edi]
  402.      cmp    edx,4000
  403.      je     irqfull
  404.      mov    ebx,edi
  405.      add    ebx,0x10
  406.      add    ebx,edx
  407.      mov    [ebx],al
  408.      inc    edx
  409.      mov    [edi],edx
  410.  
  411.      add    esi,4
  412.      jmp    irqnewread
  413.  
  414.    noirqbyte:
  415.  
  416.  
  417.      cmp    [esi+3],byte 2     ; word read
  418.      jne    noirqword
  419.  
  420.      in     ax,dx
  421.  
  422.      mov    edx,[edi]
  423.      cmp    edx,4000
  424.      je     irqfull
  425.      mov    ebx,edi
  426.      add    ebx,0x10
  427.      add    ebx,edx
  428.      mov    [ebx],ax
  429.      add    edx,2
  430.      mov    [edi],edx
  431.      add    esi,4
  432.      jmp    irqnewread
  433.  
  434.    noirqword:
  435.    irqfull:
  436.    irqover:
  437.  
  438.      mov    al,0x20            ; ready for next irq
  439.      out    0x20,al
  440.  
  441.      pop    ebx
  442.      cmp    ebx,7
  443.      jbe    noa0
  444.      out    0xa0,al
  445.    noa0:
  446.  
  447.      ret
  448.  
  449.  
  450.  
  451. set_application_table_status:
  452.         push eax
  453.  
  454.         mov  eax,[0x3000]
  455.         shl  eax, 5
  456.         add  eax,0x3000+4
  457.         mov  eax,[eax]
  458.  
  459.         mov  [application_table_status],eax
  460.  
  461.         pop  eax
  462.  
  463.         ret
  464.  
  465.  
  466. clear_application_table_status:
  467.         push eax
  468.  
  469.         mov  eax,[0x3000]
  470.         shl  eax, 5
  471.         add  eax,0x3000+4
  472.         mov  eax,[eax]
  473.  
  474.         cmp  eax,[application_table_status]
  475.         jne  apptsl1
  476.         mov  [application_table_status],0
  477.       apptsl1:
  478.  
  479.         pop  eax
  480.  
  481.         ret
  482.  
  483.  
  484.  
  485. sys_resize_app_memory:
  486.         ; eax = 1 - resize
  487.         ;     ebx = new amount of memory
  488.  
  489.         cmp    eax,1
  490.         jne    .no_application_mem_resize
  491.        
  492.         jmp    new_mem_resize ;resize for new type of processes
  493.  
  494.  
  495.      .no_application_mem_resize:
  496.  
  497.         ret
  498.  
  499.  
  500.  
  501. get_app_params:
  502.  
  503.     push eax
  504.  
  505.     cmp  [0x90000+6],word '00'
  506.     jne  no_00_header
  507.  
  508.     mov  eax,[0x90000+12]
  509.     mov  [app_start],eax
  510.     mov  eax,[0x90000+16]
  511.     mov  [app_i_end],eax
  512.     mov  eax,[0x90000+20]
  513.     mov  [app_mem],eax
  514.     shr  eax,1
  515.     sub  eax,0x10
  516.     mov  [app_esp],eax
  517.     mov  eax,[0x90000+24]
  518.     mov  [app_i_param],eax
  519.     mov  [app_i_icon],dword 0
  520.  
  521.     pop  eax
  522.     mov  esi,1
  523.     ret
  524.  
  525.   no_00_header:
  526.  
  527.  
  528.     cmp  [0x90000+6],word '01'
  529.     jne  no_01_header
  530.  
  531.     mov  eax,[0x90000+12]
  532.     mov  [app_start],eax
  533.     mov  eax,[0x90000+16]
  534.     mov  [app_i_end],eax
  535.     mov  eax,[0x90000+20]
  536.     mov  [app_mem],eax
  537.     mov  eax,[0x90000+24]
  538.     mov  [app_esp],eax
  539.     mov  eax,[0x90000+28]
  540.     mov  [app_i_param],eax
  541.     mov  eax,[0x90000+32]
  542.     mov  [app_i_icon],eax
  543.  
  544.     pop  eax
  545.     mov  esi,1
  546.     ret
  547.  
  548.    no_01_header:
  549.  
  550.     pop  eax
  551.     mov  esi,0
  552.     ret
  553.  
  554.  
  555. start_application_fl:
  556.     jmp new_start_application_fl
  557.  
  558. ;************************************************************************
  559.  
  560. start_application_floppy:
  561.     jmp  new_start_application_floppy
  562.  
  563. ;********************************************************************
  564.  
  565. start_application_hd:
  566.     jmp   new_start_application_hd
  567.  
  568. uglobal
  569.   new_process_place  dd  0x0
  570.   app_start    dd  0x0
  571.   app_i_end    dd  0x0
  572.   app_mem      dd  0x0
  573.   app_esp      dd  0x0
  574.   app_i_param  dd  0x0
  575.   app_i_icon   dd  0x0
  576.   app_mem_pos  dd  0x0
  577.   appl_path        dd 0x0
  578.   appl_path_size   dd 0x0        
  579. endg
  580.  
  581. iglobal
  582.   hd_app_string      db  'HDAPP       '
  583.   process_loading    db 'K : Process - loading ',13,10,0
  584.   process_running    db 'K : Process - done',13,10,0
  585.   first_gdt_search   dd 0x2
  586. endg
  587.  
  588.  
  589. sys_threads:
  590.  
  591. ; eax=1 create thread
  592. ;
  593. ;   ebx=thread start
  594. ;   ecx=thread stack value
  595. ;
  596. ; on return : eax = pid
  597. jmp new_sys_threads
  598.  
  599. iglobal
  600.   process_terminating   db 'K : Process - terminating',13,10,0
  601.   process_terminated    db 'K : Process - done',13,10,0
  602. endg
  603.  
  604.  
  605. terminate: ; terminate application
  606.     push   esi
  607.     mov    esi,process_terminating
  608.     call   sys_msg_board_str
  609.     pop    esi
  610.  
  611.     cli
  612.     cmp   [application_table_status],0
  613.     je    term9
  614.     sti
  615.     call  change_task
  616.     jmp   terminate
  617.   term9:
  618.  
  619.     call  set_application_table_status
  620.    
  621.     mov    eax,esi
  622.     call   dispose_app_cr3_table
  623.  
  624.     cmp   [prev_user_of_fpu],esi   ; if user fpu last -> fpu user = 1
  625.     jne   fpu_ok_1
  626.     mov   [prev_user_of_fpu],1
  627.   fpu_ok_1:
  628.  
  629.     mov   [0xf400],byte 0           ; empty keyboard buffer
  630.     mov   [0xf500],byte 0           ; empty button buffer
  631.  
  632.  
  633.     mov   ecx,esi                 ; remove buttons
  634.   bnewba2:
  635.     mov   edi,[0xfe88]
  636.     mov   eax,edi
  637.     cld
  638.     movzx ebx,word [edi]
  639.     inc   bx
  640.   bnewba:
  641.     dec   bx
  642.     jz    bnmba
  643.     add   eax,0x10
  644.     cmp   cx,[eax]
  645.     jnz   bnewba
  646.     pusha
  647.     mov   ecx,ebx
  648.     inc   ecx
  649.     shl   ecx,4
  650.     mov   ebx,eax
  651.     add   eax,0x10
  652.     call  memmove
  653.     dec   dword [edi]
  654.     popa
  655.     jmp   bnewba2
  656.   bnmba:
  657.  
  658.     pusha     ; save window coordinates for window restoring
  659.     cld
  660.     shl   esi,5
  661.     add   esi,window_data
  662.     mov   ax,[esi+0]
  663.     mov   word [dlx],ax
  664.     mov   bx,[esi+8]
  665.     add   ax,bx
  666.     mov   word [dlxe],ax
  667.     mov   ax,[esi+4]
  668.     mov   word [dly],ax
  669.     mov   bx,[esi+12]
  670.     add   ax,bx
  671.     mov   word [dlye],ax
  672.     mov   [esi+0],word 0
  673.     mov   [esi+8],word 5
  674.     mov   ax,[0xFE04]
  675.     mov   [esi+4],ax
  676.     mov   [esi+12],word 5
  677.     xor   eax, eax
  678.     mov   [esi+16],eax;dword 0
  679.     mov   [esi+20],eax;dword 0
  680.     mov   [esi+24],eax;dword 0
  681.     mov   [esi+28],eax;dword 0
  682.     popa
  683.  
  684.     pusha
  685.     mov   edi,esi
  686.     shl   edi,5
  687.     add   edi,window_data
  688.     mov   ecx,32/4
  689.     xor   eax, eax
  690.   ;  cld
  691.     rep   stosd
  692.  
  693.     mov   eax,[0xFE04]      ; set window to start from maxy+1
  694.     add   eax,2
  695.  
  696.     mov   edi,esi
  697.     shl   edi,5
  698.     add   edi,window_data
  699.     mov   [edi+4],eax
  700.  
  701.     popa
  702.  
  703.     pusha
  704.     mov   edi,esi
  705.     shl   edi,5
  706.     add   edi,draw_data
  707.     mov   ecx,32/4
  708.     xor   eax, eax
  709.   ;  cld
  710.     rep   stosd
  711.     popa
  712.  
  713.     pusha         ; at 0x80000+
  714.     mov   edi,esi
  715.     shl   edi,8
  716.     add   edi,0x80000
  717.     mov   ecx,256/4
  718.     xor   eax, eax
  719.   ;  cld
  720.     rep   stosd
  721.     popa
  722.  
  723.     pusha          ; name to spaces
  724.     mov   edi,esi
  725.     shl   edi,8
  726.     add   edi,0x80000
  727.     mov   ecx,11
  728.     mov   eax,' '
  729.   ;  cld
  730.     rep   stosb
  731.     popa
  732.  
  733.     pusha                ; C000 --> C400
  734.     mov   eax, 0xc000
  735.     mov   esi, 0
  736.   nlc40:
  737.     add   eax, 2
  738.     inc   esi
  739.     cmp   esi, [0x3004]
  740.     jae   nlc41
  741.     movzx ecx, word [eax]
  742.     mov   [0xC400 + ecx*2], si
  743.     jmp   nlc40
  744.   nlc41:
  745.     popa
  746.  
  747.     pusha ; remove hd1 reservation
  748.     mov   edx,esi
  749.     shl   edx, 5 ;imul  edx,0x20
  750.     add   edx,0x3000
  751.     mov   edx,[edx+4]
  752.     cmp   [hd1_status],edx
  753.     jne   no_hd1_s_remove
  754.     mov   [hd1_status],0
  755.   no_hd1_s_remove:
  756.     popa
  757.  
  758.     pusha ; remove all irq reservations
  759.     mov   edx,esi
  760.     shl   edx, 5 ;imul  edx,0x20
  761.     add   edx,0x3000
  762.     mov   edx,[edx+4]
  763.     mov   edi,irq_owner
  764.     mov   ecx,16
  765.   newirqfree:
  766.     cmp   [edi],edx
  767.     jne   nofreeirq
  768.     mov   [edi],dword 0
  769.   nofreeirq:
  770.     add    edi,4
  771.     loop   newirqfree
  772.     popa
  773.  
  774.  
  775.     pusha                     ; remove all port reservations
  776.  
  777.     mov   edx,esi
  778.     shl   edx, 5 ;imul  edx,0x20
  779.     add   edx,0x3000
  780.     mov   edx,[edx+4]
  781.  
  782.   rmpr0:
  783.  
  784.     mov   esi,[0x2d0000]
  785.  
  786.     cmp   esi,0
  787.     je    rmpr9
  788.  
  789.   rmpr3:
  790.  
  791.     mov   edi,esi
  792.     shl   edi,4
  793.     add   edi,0x2d0000
  794.  
  795.     cmp   edx,[edi]
  796.     je    rmpr4
  797.  
  798.     dec   esi
  799.     jnz   rmpr3
  800.  
  801.     jmp   rmpr9
  802.  
  803.   rmpr4:
  804.  
  805.     mov   ecx,256
  806.     sub   ecx,esi
  807.     shl   ecx,4
  808.  
  809.     mov   esi,edi
  810.     add   esi,16
  811.     cld
  812.     rep   movsb
  813.  
  814.     dec   dword [0x2d0000]
  815.  
  816.     jmp   rmpr0
  817.  
  818.   rmpr9:
  819.  
  820.     popa
  821.     mov  edi,esi         ; do not run this process slot
  822.     shl  edi, 5
  823.     mov  [edi+0x300A],byte 9
  824. ;    call  systest
  825.     sti  ; .. and life goes on
  826.  
  827. ;    movzx eax,word [dlx]
  828. ;    movzx ebx,word [dly]
  829. ;    movzx ecx,word [dlxe]
  830. ;    movzx edx,word [dlye]
  831.     call  calculatescreen
  832.  
  833.     xor   eax, eax
  834.     xor   esi, esi
  835.     call  redrawscreen
  836.  
  837.     mov   [0xfff4],byte 0  ; no mouse background
  838.     mov   [0xfff5],byte 0  ; draw mouse
  839.  
  840.     mov   [application_table_status],0
  841.  
  842.     mov   esi,process_terminated
  843.     call  sys_msg_board_str
  844.  
  845. ;* start code - fix error redraw for terminate (2) - Mario79
  846. ;     cmp  [draw_present],1
  847. ;     je  no_draw_background_temp
  848. ;     mov   [0xfff0],byte 1
  849. ;no_draw_background_temp:
  850. ;    mov   [draw_present],0
  851.     ret
  852. ;draw_present db 0
  853. ;* end code - fix error redraw for terminate (2) - Mario79
  854.  
  855. iglobal
  856.   boot_sched_1    db   'Building gdt tss pointer',0
  857.   boot_sched_2    db   'Building IDT table',0
  858. endg
  859.  
  860.  
  861. build_scheduler:
  862.  
  863.         mov    esi,boot_sched_1
  864.         call   boot_log
  865.         call   build_process_gdt_tss_pointer
  866.  
  867.         mov    esi,boot_sched_2
  868.         call   boot_log
  869.         call   build_interrupt_table
  870.  
  871.         ret
  872.  
  873.