Subversion Repositories Kolibri OS

Rev

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