Subversion Repositories Kolibri OS

Rev

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