Subversion Repositories Kolibri OS

Rev

Rev 427 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 427 Rev 430
Line 452... Line 452...
452
set_cr3:
452
set_cr3:
Line 453... Line 453...
453
 
453
 
454
           mov ebx, [current_slot]
454
           mov ebx, [current_slot]
455
           mov [ebx+APPDATA.dir_table], eax
455
           mov [ebx+APPDATA.dir_table], eax
456
           mov cr3, eax
-
 
457
 
-
 
458
;           mov esi, [CURRENT_TASK]
-
 
459
;           mov ebx, esi
-
 
460
;           shl esi,8
-
 
461
;           mov [SLOT_BASE+esi+0xB8],eax
-
 
462
;           imul   ebx,tss_step
-
 
463
;           add    ebx,tss_data
-
 
464
;           mov [ebx+28], eax
-
 
465
;           mov cr3, eax
456
           mov cr3, eax
Line 466... Line 457...
466
           ret
457
           ret
467
 
458
 
Line 921... Line 912...
921
           shl eax, 8
912
           shl eax, 8
922
           mov [eax+SLOT_BASE+APPDATA.fpu_state], edi
913
           mov [eax+SLOT_BASE+APPDATA.fpu_state], edi
923
           mov [eax+SLOT_BASE+APPDATA.fpu_handler], 0
914
           mov [eax+SLOT_BASE+APPDATA.fpu_handler], 0
924
           mov [eax+SLOT_BASE+APPDATA.sse_handler], 0
915
           mov [eax+SLOT_BASE+APPDATA.sse_handler], 0
Line -... Line 916...
-
 
916
 
-
 
917
;set default io permission map
-
 
918
           mov [eax+SLOT_BASE+APPDATA.io_map],\
-
 
919
                  (tss._io_map_0-OS_BASE+PG_MAP)
-
 
920
           mov [eax+SLOT_BASE+APPDATA.io_map+4],\
-
 
921
                  (tss._io_map_1-OS_BASE+PG_MAP)
925
 
922
 
926
           mov esi, fpu_data
923
           mov esi, fpu_data
927
           mov ecx, 512/4
924
           mov ecx, 512/4
Line 928... Line 925...
928
           rep movsd
925
           rep movsd
Line 1001... Line 998...
1001
           mov    eax,[ScreenWidth]
998
           mov    eax,[ScreenWidth]
1002
           mov    [ecx+8],eax
999
           mov    [ecx+8],eax
1003
           mov    eax,[ScreenHeight]
1000
           mov    eax,[ScreenHeight]
1004
           mov    [ecx+12],eax
1001
           mov    [ecx+12],eax
Line 1005... Line -...
1005
 
-
 
1006
           mov edi,[slot]
-
 
1007
           imul edi,tss_step
-
 
1008
           add edi,tss_data
-
 
1009
           mov ecx,128/4
-
 
1010
           xor eax, eax
-
 
1011
           cld
-
 
1012
           rep stosd
-
 
1013
;Add IO access table - bit array of permitted ports
-
 
1014
           not eax
-
 
1015
           mov ecx,2048
-
 
1016
           rep stosd                 ; access to 4096*8=65536 ports
-
 
1017
           sub edi, tss_step
-
 
1018
 
-
 
1019
;set cr3 register in TSS of application
-
 
1020
           mov ecx, [slot]
-
 
1021
           shl ecx, 8
-
 
1022
           mov eax,[SLOT_BASE+ecx+APPDATA.dir_table]
-
 
1023
           mov [edi+TSS._cr3],eax
-
 
1024
 
-
 
1025
           mov esi,[params]
-
 
1026
           mov eax, [esi+0x08]       ;app_eip
-
 
1027
           mov [edi+TSS._eip],eax    ;set eip in TSS
-
 
1028
           mov eax, [esi+0x0C]       ;app_esp
-
 
1029
           mov [edi+TSS._esp],eax    ;set stack in TSS
-
 
1030
           mov [edi+TSS._eflags],dword 0x1202
-
 
1031
 
-
 
1032
           mov [edi+TSS._cs],app_code  ;selector of code segment
-
 
1033
           mov [edi+TSS._ss],app_data
-
 
1034
           mov [edi+TSS._ds],app_data
-
 
1035
           mov [edi+TSS._es],app_data
-
 
1036
           mov [edi+TSS._fs],app_data
-
 
1037
           mov [edi+TSS._gs],graph_data ;selector of graphic segment
-
 
1038
           mov [edi+TSS._io],word 128
-
 
1039
           mov [edi+TSS._ss0], os_stack
-
 
1040
           mov ebx, [pl0_stack]
-
 
1041
           add ebx, RING0_STACK_SIZE
-
 
1042
           mov [edi+TSS._esp0],ebx
-
 
1043
 
-
 
1044
           xor eax, eax
1002
 
-
 
1003
           mov ebx, [pl0_stack]
1045
           mov ebx, [pl0_stack]
1004
           mov esi,[params]
-
 
1005
           lea ecx, [ebx+REG_EIP]
Line 1046... Line 1006...
1046
           lea ecx, [ebx+REG_EIP]
1006
           xor eax, eax
1047
 
1007
 
1048
           mov [ebx+REG_RET], dword irq0.return
1008
           mov [ebx+REG_RET], dword irq0.return
1049
           mov [ebx+REG_EDI], eax
1009
           mov [ebx+REG_EDI], eax
Line 1069... Line 1029...
1069
           lea ecx, [ebx+REG_RET]
1029
           lea ecx, [ebx+REG_RET]
1070
           mov ebx, [slot]
1030
           mov ebx, [slot]
1071
           shl ebx, 8
1031
           shl ebx, 8
1072
           mov [ebx+SLOT_BASE+APPDATA.saved_esp], ecx
1032
           mov [ebx+SLOT_BASE+APPDATA.saved_esp], ecx
Line 1073... Line -...
1073
 
-
 
1074
           mov ecx, edi    ;ecx - address of application TSS
-
 
1075
           mov ebx,[slot]
-
 
1076
           shl ebx,3
-
 
1077
;set TSS descriptor
-
 
1078
           mov [ebx+gdts+tss0+0],word tss_step ;limit (size)
-
 
1079
           mov [ebx+gdts+tss0+2],cx  ;part of offset
-
 
1080
           shr ecx,16
-
 
1081
           mov [ebx+gdts+tss0+4],cl  ;part of offset
-
 
1082
           mov [ebx+gdts+tss0+7],ch  ;part of offset
-
 
1083
           mov [ebx+gdts+tss0+5],word 01010000b*256+11101001b ;system flags
-
 
1084
 
1033
 
1085
;flush keyboard and buttons queue
1034
;flush keyboard and buttons queue
1086
           mov    [KEY_COUNT],byte 0
1035
           mov    [KEY_COUNT],byte 0
Line 1087... Line 1036...
1087
           mov    [BTN_COUNT],byte 0
1036
           mov    [BTN_COUNT],byte 0
Line 1106... Line 1055...
1106
           mov  [SLOT_BASE+ebx*8+0xac],eax ;set debugger PID - current
1055
           mov  [SLOT_BASE+ebx*8+0xac],eax ;set debugger PID - current
1107
.no_debug:
1056
.no_debug:
1108
           mov    esi,new_process_running
1057
           mov    esi,new_process_running
1109
           call   sys_msg_board_str     ;output information about succefull startup
1058
           call   sys_msg_board_str     ;output information about succefull startup
1110
           ret
1059
           ret
1111
 
-
 
1112
if 0
-
 
1113
; set stack frame
-
 
1114
 
-
 
1115
           xor eax, eax
-
 
1116
           lea ecx, [ebx+REG_EIP]
-
 
1117
           mov ebx, [pl0_stack]
-
 
1118
           mov esi,[params]
-
 
1119
 
-
 
1120
           mov [ebx+REG_RET], dword irq0.return
-
 
1121
           mov [ebx+REG_EDI], eax
-
 
1122
           mov [ebx+REG_ESI], eax
-
 
1123
           mov [ebx+REG_EBP], eax
-
 
1124
           mov [ebx+REG_ESP], ecx   ;ebx+REG_EIP
-
 
1125
           mov [ebx+REG_EBX], eax
-
 
1126
           mov [ebx+REG_EDX], eax
-
 
1127
           mov [ebx+REG_ECX], eax
-
 
1128
           mov [ebx+REG_EAX], eax
-
 
1129
 
-
 
1130
           mov [ebx+REG_EFL_2], dword 0x1002
-
 
1131
 
-
 
1132
           mov eax, [esi+0x08]       ;app_eip
-
 
1133
           mov [ebx+REG_EIP],  eax   ;app_entry
-
 
1134
           mov [ebx+REG_CS], dword app_code
-
 
1135
           mov [ebx+REG_EFLAGS], dword 0x1202
-
 
1136
 
-
 
1137
           mov eax, [esi+0x0C]       ;app_esp
-
 
1138
           mov [ebx+REG_ESP], eax    ;app_stack
-
 
1139
           mov [ebx+REG_SS], dword app_data
-
 
1140
end if
-
 
1141
 
-
 
1142
endp
1060
endp
Line 1143... Line 1061...
1143
 
1061