Subversion Repositories Kolibri OS

Rev

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