/kernel/trunk/core/sched.inc |
---|
174,8 → 174,23 |
cmp eax, [esi+ecx] ;offset>0x7F |
je @f |
mov cr3, eax |
@@: ; set tss.esp0 |
@@: |
; set tss.esp0 |
Mov [tss._esp0],eax,[ebx+APPDATA.saved_esp0] |
mov edx, [ebx+APPDATA.tls_base] |
cmp edx, [esi+APPDATA.tls_base] |
je @f |
mov [tls_data_l+2],dx |
shr edx,16 |
mov [tls_data_l+4],dl |
mov [tls_data_l+7],dh |
mov dx, app_tls |
mov fs, dx |
@: |
; set gs selector unconditionally |
Mov gs,ax,graph_data |
; set CR0.TS |
/kernel/trunk/core/taskman.inc |
---|
113,6 → 113,7 |
popad |
mov eax, -ERROR_FILE_NOT_FOUND |
ret |
.namecopied: |
mov [cmdline], ebx |
201,6 → 202,14 |
mov eax,[hdr_mem] |
mov [ebx+APPDATA.mem_size],eax |
xor edx, edx |
cmp word [6], '02' |
jne @f |
not edx |
@@: |
mov [ebx+APPDATA.tls_base],edx |
if GREEDY_KERNEL |
else |
mov ecx, [hdr_mem] |
278,8 → 287,10 |
.check_01_header: |
cmp [eax+6],word '01' |
je @f |
cmp [eax+6], word '02' |
jne .fail |
@@: |
mov ecx,[APP_HEADER_01.start] |
mov [ebx+0x08], ecx ;app_eip |
mov edx,[APP_HEADER_01.mem_size] |
736,7 → 747,7 |
mov eax, [slot] |
shl eax,8 |
mov ebx, [offset] |
; add ebx, new_app_base |
push ecx |
stdcall map_memEx, [proc_mem_map],\ |
[SLOT_BASE+eax+0xB8],\ |
897,6 → 908,18 |
mov ecx,[ebx+APPDATA.dir_table] |
mov [edx+APPDATA.dir_table],ecx ;copy page directory |
mov eax, [ebx+APPDATA.tls_base] |
test eax, eax |
jz @F |
push edx |
stdcall user_alloc, 4096 |
pop edx |
test eax, eax |
jz .failed |
@@: |
mov [edx+APPDATA.tls_base], eax |
lea eax, [app_cmdline] |
stdcall set_app_params ,[slot],eax,dword 0,\ |
dword 0,dword 0 |
931,6 → 954,24 |
pop eax |
ret |
align 4 |
tls_app_entry: |
call init_heap |
stdcall user_alloc, 4096 |
mov edx, [current_slot] |
mov [edx+APPDATA.tls_base], eax |
mov [tls_data_l+2],ax |
shr eax,16 |
mov [tls_data_l+4],al |
mov [tls_data_l+7],ah |
mov dx, app_tls |
mov fs, dx |
popad |
iretd |
EFL_IF equ 0x0200 |
EFL_IOPL1 equ 0x1000 |
EFL_IOPL2 equ 0x2000 |
1037,6 → 1078,11 |
shl ebx,5 |
lea ecx,[draw_data+ebx] ;ecx - pointer to draw data |
mov edx, irq0.return |
cmp [ebx*8+SLOT_BASE+APPDATA.tls_base], -1 |
jne @F |
mov edx, tls_app_entry |
@@: |
; set window state to 'normal' (non-minimized/maximized/rolled-up) state |
mov [ebx+window_data+WDATA.fl_wstate], WSTATE_NORMAL |
mov [ebx+window_data+WDATA.fl_redraw], 1 |
1063,7 → 1109,7 |
lea ecx, [ebx+REG_EIP] |
xor eax, eax |
mov [ebx+REG_RET], dword irq0.return |
mov [ebx+REG_RET], edx |
mov [ebx+REG_EDI], eax |
mov [ebx+REG_ESI], eax |
mov [ebx+REG_EBP], eax |
/kernel/trunk/data32.inc |
---|
202,7 → 202,7 |
dw 0 |
db 0 |
db cpl3 |
dw G32+D32+(new_app_base shr 16)+0xF; |
dw G32+D32+0xF; |
app_data_l: |
dw 0xFFFF |
209,7 → 209,7 |
dw 0 |
db 0 |
db drw3 |
dw G32+D32+(new_app_base shr 16)+0xF; |
dw G32+D32+0xF; |
; ------------- PCI BIOS ------------------ |
260,6 → 260,14 |
db (tss shr 16) and 0xFF |
db 10001001b |
dw (tss shr 16) and 0xFF00 |
tls_data_l: |
dw 0x0FFF |
dw 0 |
db 0 |
db drw3 |
dw D32 |
endofcode: |
gdte: |
/kernel/trunk/docs/sysfuncr.txt |
---|
3776,6 → 3776,8 |
* E_NOMEM = 30 |
* E_PARAM = 33 |
¬¥ç ¨ï: |
* ।¢ à¨â¥«ì® á«¥¤ã¥â ¨¨æ¨ «¨§¨à®¢ âì ªãçã ¯à®æ¥áá ¢ë§®¢®¬ |
¯®¤äãªæ¨¨ 11. |
* ᫨ ᮧ¤ ñâáï ®¢ ï ®¡« áâì, â® ä« £¨ ¤®áâ㯠ãáâ ¢«¨¢ îâ |
¬ ªá¨¬ «ìë¥ ¯à ¢ ¤®áâ㯠¤«ï ®áâ «ìëå ¯à®æ¥áᮢ. ®¯ë⪠|
®âªàëâ¨ï ¤à㣨¬ ¯®â®ª®¬ á ¥à §à¥èñ묨 ¯à ¢ ¬¨ ¯à®¢ «¨âáï |
/kernel/trunk/kernel.asm |
---|
79,6 → 79,7 |
tss0 equ (tss0_l-gdts) |
app_code equ (3+app_code_l-gdts) |
app_data equ (3+app_data_l-gdts) |
app_tls equ (3+tls_data_l-gdts) |
pci_code_sel equ (pci_code_32-gdts) |
pci_data_sel equ (pci_data_32-gdts) |
283,12 → 284,13 |
high_code: |
mov ax,os_stack |
mov bx,app_data |
mov cx, app_tls |
mov ss,ax |
add esp, OS_BASE |
mov ds,bx |
mov es,bx |
mov fs,bx |
mov fs, cx |
mov gs,bx |
bt [cpu_caps], CAPS_PGE |
711,6 → 713,7 |
mov dword [SLOT_BASE+256+APPDATA.bk_obj], ebx |
mov dword [SLOT_BASE+256+APPDATA.cur_dir], sysdir_path |
mov dword [SLOT_BASE+256+APPDATA.tls_base], eax |
; task list |
mov [CURRENT_TASK],dword 1 |
1907,6 → 1910,14 |
sys_end: |
mov ecx, [current_slot] |
mov eax, [ecx+APPDATA.tls_base] |
test eax, eax |
jz @F |
stdcall user_free, eax |
@@: |
mov eax,[TASK_BASE] |
mov [eax+TASKDATA.state], 3 ; terminate this program |
/kernel/trunk/kernel32.inc |
---|
141,7 → 141,8 |
.wait_begin dd ? ;+92 +++ |
.wait_test dd ? ;+96 +++ |
.wait_param dd ? ;+100 +++ |
db 24 dup(?) ;+104 |
.tls_base dd ? ;+104 |
db 20 dup(?) ;+108 |
.wnd_shape dd ? ;+128 |
.wnd_shape_scale dd ? ;+132 |