Subversion Repositories Kolibri OS

Rev

Rev 20 | Rev 23 | 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   edi,6
  349.      ;call  irqhandler
  350.      mov   al, 0x20
  351.      out   0x20, al
  352.  
  353.      pop   es ds
  354.      popad
  355.      iret
  356.  
  357. irqD:
  358.      pushad
  359.      push  ds es
  360.      mov   ax, os_data
  361.      mov   ds, ax
  362.      mov   es, ax
  363.      
  364.      mov   dx,0xf0
  365.      mov   al,0
  366.      out   dx,al
  367.  
  368.      mov   dx,0xa0
  369.      mov   al,0x20
  370.      out   dx,al
  371.      mov   dx,0x20
  372.      out   dx,al    
  373.      
  374.      pop   es ds
  375.      popad
  376.      iret
  377.  
  378.  
  379. irqhandler:
  380.  
  381.      push   edi
  382.  
  383.      mov    esi,edi          ; 1
  384.      shl    esi,6            ; 1
  385.      add    esi,irq00read    ; 1
  386.      shl    edi,12           ; 1
  387.      add    edi,0x2E0000
  388.  
  389.      mov    [check_idle_semaphore],5
  390.  
  391.    irqnewread:
  392.  
  393.      mov    dx,[esi]         ; 2+
  394.  
  395.      cmp    dx,0             ; 1
  396.      jz     irqover
  397.      cmp    [esi+3],byte 1   ; 2     ; byte read
  398.      jne    noirqbyte        ; 4-11
  399.  
  400.      in     al,dx
  401.  
  402.      mov    edx,[edi]
  403.      cmp    edx,4000
  404.      je     irqfull
  405.      mov    ebx,edi
  406.      add    ebx,0x10
  407.      add    ebx,edx
  408.      mov    [ebx],al
  409.      inc    edx
  410.      mov    [edi],edx
  411.  
  412.      add    esi,4
  413.      jmp    irqnewread
  414.  
  415.    noirqbyte:
  416.  
  417.  
  418.      cmp    [esi+3],byte 2     ; word read
  419.      jne    noirqword
  420.  
  421.      in     ax,dx
  422.  
  423.      mov    edx,[edi]
  424.      cmp    edx,4000
  425.      je     irqfull
  426.      mov    ebx,edi
  427.      add    ebx,0x10
  428.      add    ebx,edx
  429.      mov    [ebx],ax
  430.      add    edx,2
  431.      mov    [edi],edx
  432.      add    esi,4
  433.      jmp    irqnewread
  434.  
  435.    noirqword:
  436.    irqfull:
  437.    irqover:
  438.  
  439.      mov    al,0x20            ; ready for next irq
  440.      out    0x20,al
  441.  
  442.      pop    ebx
  443.      cmp    ebx,7
  444.      jbe    noa0
  445.      out    0xa0,al
  446.    noa0:
  447.  
  448.      ret
  449.  
  450.  
  451.  
  452. set_application_table_status:
  453.         push eax
  454.  
  455.         mov  eax,[0x3000]
  456.         shl  eax, 5
  457.         add  eax,0x3000+4
  458.         mov  eax,[eax]
  459.  
  460.         mov  [application_table_status],eax
  461.  
  462.         pop  eax
  463.  
  464.         ret
  465.  
  466.  
  467. clear_application_table_status:
  468.         push eax
  469.  
  470.         mov  eax,[0x3000]
  471.         shl  eax, 5
  472.         add  eax,0x3000+4
  473.         mov  eax,[eax]
  474.  
  475.         cmp  eax,[application_table_status]
  476.         jne  apptsl1
  477.         mov  [application_table_status],0
  478.       apptsl1:
  479.  
  480.         pop  eax
  481.  
  482.         ret
  483.  
  484.  
  485.  
  486. sys_resize_app_memory:
  487.         ; eax = 1 - resize
  488.         ;     ebx = new amount of memory
  489.  
  490.         cmp    eax,1
  491.         jne    .no_application_mem_resize
  492.        
  493.         jmp    new_mem_resize ;resize for new type of processes
  494.  
  495.  
  496.      .no_application_mem_resize:
  497.  
  498.         ret
  499.  
  500.  
  501.  
  502. get_app_params:
  503.  
  504.     push eax
  505.  
  506.     cmp  [0x90000+6],word '00'
  507.     jne  no_00_header
  508.  
  509.     mov  eax,[0x90000+12]
  510.     mov  [app_start],eax
  511.     mov  eax,[0x90000+16]
  512.     mov  [app_i_end],eax
  513.     mov  eax,[0x90000+20]
  514.     mov  [app_mem],eax
  515.     shr  eax,1
  516.     sub  eax,0x10
  517.     mov  [app_esp],eax
  518.     mov  eax,[0x90000+24]
  519.     mov  [app_i_param],eax
  520.     mov  [app_i_icon],dword 0
  521.  
  522.     pop  eax
  523.     mov  esi,1
  524.     ret
  525.  
  526.   no_00_header:
  527.  
  528.  
  529.     cmp  [0x90000+6],word '01'
  530.     jne  no_01_header
  531.  
  532.     mov  eax,[0x90000+12]
  533.     mov  [app_start],eax
  534.     mov  eax,[0x90000+16]
  535.     mov  [app_i_end],eax
  536.     mov  eax,[0x90000+20]
  537.     mov  [app_mem],eax
  538.     mov  eax,[0x90000+24]
  539.     mov  [app_esp],eax
  540.     mov  eax,[0x90000+28]
  541.     mov  [app_i_param],eax
  542.     mov  eax,[0x90000+32]
  543.     mov  [app_i_icon],eax
  544.  
  545.     pop  eax
  546.     mov  esi,1
  547.     ret
  548.  
  549.    no_01_header:
  550.  
  551.     pop  eax
  552.     mov  esi,0
  553.     ret
  554.  
  555.  
  556. start_application_fl:
  557.     jmp new_start_application_fl
  558.  
  559. ;************************************************************************
  560.  
  561. start_application_floppy:
  562.     jmp  new_start_application_floppy
  563.  
  564. ;********************************************************************
  565.  
  566. start_application_hd:
  567.     jmp   new_start_application_hd
  568.  
  569. uglobal
  570.   new_process_place  dd  0x0
  571.   app_start    dd  0x0
  572.   app_i_end    dd  0x0
  573.   app_mem      dd  0x0
  574.   app_esp      dd  0x0
  575.   app_i_param  dd  0x0
  576.   app_i_icon   dd  0x0
  577.   app_mem_pos  dd  0x0
  578.   appl_path        dd 0x0
  579.   appl_path_size   dd 0x0        
  580. endg
  581.  
  582. iglobal
  583.   hd_app_string      db  'HDAPP       '
  584.   process_loading    db 'K : Process - loading ',13,10,0
  585.   process_running    db 'K : Process - done',13,10,0
  586.   first_gdt_search   dd 0x2
  587. endg
  588.  
  589.  
  590. sys_threads:
  591.  
  592. ; eax=1 create thread
  593. ;
  594. ;   ebx=thread start
  595. ;   ecx=thread stack value
  596. ;
  597. ; on return : eax = pid
  598. jmp new_sys_threads
  599.  
  600. iglobal
  601.   process_terminating   db 'K : Process - terminating',13,10,0
  602.   process_terminated    db 'K : Process - done',13,10,0
  603. endg
  604.  
  605.  
  606. terminate: ; terminate application
  607.     push   esi
  608.     mov    esi,process_terminating
  609.     call   sys_msg_board_str
  610.     pop    esi
  611.  
  612.     cli
  613.     cmp   [application_table_status],0
  614.     je    term9
  615.     sti
  616.     call  change_task
  617.     jmp   terminate
  618.   term9:
  619.  
  620.     call  set_application_table_status
  621.    
  622.     mov    eax,esi
  623.     call   dispose_app_cr3_table
  624.  
  625.     cmp   [prev_user_of_fpu],esi   ; if user fpu last -> fpu user = 1
  626.     jne   fpu_ok_1
  627.     mov   [prev_user_of_fpu],1
  628.   fpu_ok_1:
  629.  
  630.     mov   [0xf400],byte 0           ; empty keyboard buffer
  631.     mov   [0xf500],byte 0           ; empty button buffer
  632.  
  633.  
  634.     mov   ecx,esi                 ; remove buttons
  635.   bnewba2:
  636.     mov   edi,[0xfe88]
  637.     mov   eax,edi
  638.     cld
  639.     movzx ebx,word [edi]
  640.     inc   bx
  641.   bnewba:
  642.     dec   bx
  643.     jz    bnmba
  644.     add   eax,0x10
  645.     cmp   cx,[eax]
  646.     jnz   bnewba
  647.     pusha
  648.     mov   ecx,ebx
  649.     inc   ecx
  650.     shl   ecx,4
  651.     mov   ebx,eax
  652.     add   eax,0x10
  653.     call  memmove
  654.     dec   dword [edi]
  655.     popa
  656.     jmp   bnewba2
  657.   bnmba:
  658.  
  659.     pusha     ; save window coordinates for window restoring
  660.     cld
  661.     shl   esi,5
  662.     add   esi,window_data
  663.     mov   ax,[esi+0]
  664.     mov   word [dlx],ax
  665.     mov   bx,[esi+8]
  666.     add   ax,bx
  667.     mov   word [dlxe],ax
  668.     mov   ax,[esi+4]
  669.     mov   word [dly],ax
  670.     mov   bx,[esi+12]
  671.     add   ax,bx
  672.     mov   word [dlye],ax
  673.     mov   [esi+0],word 0
  674.     mov   [esi+8],word 5
  675.     mov   ax,[0xFE04]
  676.     mov   [esi+4],ax
  677.     mov   [esi+12],word 5
  678.     xor   eax, eax
  679.     mov   [esi+16],eax;dword 0
  680.     mov   [esi+20],eax;dword 0
  681.     mov   [esi+24],eax;dword 0
  682.     mov   [esi+28],eax;dword 0
  683.     popa
  684.  
  685.     pusha
  686.     mov   edi,esi
  687.     shl   edi,5
  688.     add   edi,window_data
  689.     mov   ecx,32/4
  690.     xor   eax, eax
  691.   ;  cld
  692.     rep   stosd
  693.  
  694.     mov   eax,[0xFE04]      ; set window to start from maxy+1
  695.     add   eax,2
  696.  
  697.     mov   edi,esi
  698.     shl   edi,5
  699.     add   edi,window_data
  700.     mov   [edi+4],eax
  701.  
  702.     popa
  703.  
  704.     pusha
  705.     mov   edi,esi
  706.     shl   edi,5
  707.     add   edi,draw_data
  708.     mov   ecx,32/4
  709.     xor   eax, eax
  710.   ;  cld
  711.     rep   stosd
  712.     popa
  713.  
  714.     pusha         ; at 0x80000+
  715.     mov   edi,esi
  716.     shl   edi,8
  717.     add   edi,0x80000
  718.     mov   ecx,256/4
  719.     xor   eax, eax
  720.   ;  cld
  721.     rep   stosd
  722.     popa
  723.  
  724.     pusha          ; name to spaces
  725.     mov   edi,esi
  726.     shl   edi,8
  727.     add   edi,0x80000
  728.     mov   ecx,11
  729.     mov   eax,' '
  730.   ;  cld
  731.     rep   stosb
  732.     popa
  733.  
  734.     pusha                ; C000 --> C400
  735.     mov   eax, 0xc000
  736.     mov   esi, 0
  737.   nlc40:
  738.     add   eax, 2
  739.     inc   esi
  740.     cmp   esi, [0x3004]
  741.     jae   nlc41
  742.     movzx ecx, word [eax]
  743.     mov   [0xC400 + ecx*2], si
  744.     jmp   nlc40
  745.   nlc41:
  746.     popa
  747.  
  748.     pusha ; remove hd1 reservation
  749.     mov   edx,esi
  750.     shl   edx, 5 ;imul  edx,0x20
  751.     add   edx,0x3000
  752.     mov   edx,[edx+4]
  753.     cmp   [hd1_status],edx
  754.     jne   no_hd1_s_remove
  755.     mov   [hd1_status],0
  756.   no_hd1_s_remove:
  757.     popa
  758.  
  759.     pusha ; remove all irq reservations
  760.     mov   edx,esi
  761.     shl   edx, 5 ;imul  edx,0x20
  762.     add   edx,0x3000
  763.     mov   edx,[edx+4]
  764.     mov   edi,irq_owner
  765.     mov   ecx,16
  766.   newirqfree:
  767.     cmp   [edi],edx
  768.     jne   nofreeirq
  769.     mov   [edi],dword 0
  770.   nofreeirq:
  771.     add    edi,4
  772.     loop   newirqfree
  773.     popa
  774.  
  775.  
  776.     pusha                     ; remove all port reservations
  777.  
  778.     mov   edx,esi
  779.     shl   edx, 5 ;imul  edx,0x20
  780.     add   edx,0x3000
  781.     mov   edx,[edx+4]
  782.  
  783.   rmpr0:
  784.  
  785.     mov   esi,[0x2d0000]
  786.  
  787.     cmp   esi,0
  788.     je    rmpr9
  789.  
  790.   rmpr3:
  791.  
  792.     mov   edi,esi
  793.     shl   edi,4
  794.     add   edi,0x2d0000
  795.  
  796.     cmp   edx,[edi]
  797.     je    rmpr4
  798.  
  799.     dec   esi
  800.     jnz   rmpr3
  801.  
  802.     jmp   rmpr9
  803.  
  804.   rmpr4:
  805.  
  806.     mov   ecx,256
  807.     sub   ecx,esi
  808.     shl   ecx,4
  809.  
  810.     mov   esi,edi
  811.     add   esi,16
  812.     cld
  813.     rep   movsb
  814.  
  815.     dec   dword [0x2d0000]
  816.  
  817.     jmp   rmpr0
  818.  
  819.   rmpr9:
  820.  
  821.     popa
  822.     mov  edi,esi         ; do not run this process slot
  823.     shl  edi, 5
  824.     mov  [edi+0x300A],byte 9
  825. ;    call  systest
  826.     sti  ; .. and life goes on
  827.  
  828. ;    movzx eax,word [dlx]
  829. ;    movzx ebx,word [dly]
  830. ;    movzx ecx,word [dlxe]
  831. ;    movzx edx,word [dlye]
  832.     call  calculatescreen
  833.  
  834.     xor   eax, eax
  835.     xor   esi, esi
  836.     call  redrawscreen
  837.  
  838.     mov   [0xfff4],byte 0  ; no mouse background
  839.     mov   [0xfff5],byte 0  ; draw mouse
  840.  
  841.     mov   [application_table_status],0
  842.  
  843.     mov   esi,process_terminated
  844.     call  sys_msg_board_str
  845.  
  846. ;* start code - fix error redraw for terminate (2) - Mario79
  847. ;     cmp  [draw_present],1
  848. ;     je  no_draw_background_temp
  849. ;     mov   [0xfff0],byte 1
  850. ;no_draw_background_temp:
  851. ;    mov   [draw_present],0
  852.     ret
  853. ;draw_present db 0
  854. ;* end code - fix error redraw for terminate (2) - Mario79
  855.  
  856. iglobal
  857.   boot_sched_1    db   'Building gdt tss pointer',0
  858.   boot_sched_2    db   'Building IDT table',0
  859. endg
  860.  
  861.  
  862. build_scheduler:
  863.  
  864.         mov    esi,boot_sched_1
  865.         call   boot_log
  866.         call   build_process_gdt_tss_pointer
  867.  
  868.         mov    esi,boot_sched_2
  869.         call   boot_log
  870.         call   build_interrupt_table
  871.  
  872.         ret
  873.  
  874.