Subversion Repositories Kolibri OS

Rev

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