Subversion Repositories Kolibri OS

Rev

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