/kernel/branches/kolibri_pe/core/init.c |
---|
File deleted |
/kernel/branches/kolibri_pe/core/peload.inc |
---|
File deleted |
Property changes: |
Deleted: svn:keywords |
-Revision |
\ No newline at end of property |
/kernel/branches/kolibri_pe/core/debug.inc |
---|
421,7 → 421,7 |
; int 1 = #DB |
save_ring3_context |
cld |
mov ax, app_data ;os_data |
mov ax, sel_app_data |
mov ds, ax |
mov es, ax |
mov eax, dr6 |
/kernel/branches/kolibri_pe/core/dll.c |
---|
366,7 → 366,6 |
return pe_app_param(path, raw, ex_pg_dir, ex_stack); |
}; |
#define master_tab (page_tabs+ (page_tabs>>10)) |
typedef struct |
{ |
385,11 → 384,6 |
u32_t pe_ss; |
}thr_stack_t; |
#define EFL_IF 0x0200 |
#define EFL_IOPL1 0x1000 |
#define EFL_IOPL2 0x2000 |
#define EFL_IOPL3 0x3000 |
void sys_app_entry(addr_t raw, thr_stack_t *thr_stack, exec_stack_t *ex_stack) |
{ |
PIMAGE_DOS_HEADER dos; |
/kernel/branches/kolibri_pe/core/dll.inc |
---|
159,7 → 159,7 |
.main: |
save_ring3_context |
mov eax, [esp + 32] |
mov bx, app_data ;os_data |
mov bx, sel_app_data |
mov ds, bx |
mov es, bx |
514,7 → 514,7 |
mov eax, 70 |
lea ebx, [cmd] |
int 0x40 |
int 0x41 |
ret |
endp |
/kernel/branches/kolibri_pe/core/exports.inc |
---|
67,7 → 67,6 |
szSysMsgBoardStr db 'SysMsgBoardStr', 0 |
szSysMsgBoardChar db 'SysMsgBoardChar', 0 |
szGetCurrentTask db 'GetCurrentTask',0 |
szLFBAddress db 'LFBAddress',0 |
szLoadFile db 'LoadFile',0 |
szSendEvent db 'SendEvent',0 |
szSetMouseData db 'SetMouseData',0 |
150,8 → 149,6 |
dd szStrchr , strchr |
dd szStrrchr , strrchr |
exp_lfb: |
dd szLFBAddress , 0 |
dd 0 ;terminator, must be zero |
endg |
/kernel/branches/kolibri_pe/core/fpu.inc |
---|
145,7 → 145,7 |
e7: ;#NM exception handler |
save_ring3_context |
clts |
mov ax, app_data ; |
mov ax, sel_app_data |
mov ds, ax |
mov es, ax |
/kernel/branches/kolibri_pe/core/heap.c |
---|
6,9 → 6,7 |
#include <mm.h> |
#include <slab.h> |
#define page_tabs 0xDF800000 |
#define MD_FREE 1 |
#define MD_USED 2 |
/kernel/branches/kolibri_pe/core/init.asm |
---|
0,0 → 1,478 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
;; ;; |
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;; |
;; Distributed under terms of the GNU General Public License ;; |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
include "../macros.inc" |
include "../proc32.inc" |
include "../const.inc" |
$Revision: 847 $ |
sel_tss equ 0x08 |
sel_os_code equ 0x10 |
sel_os_stack equ 0x18 |
sel_app_code equ 0x23 |
sel_app_data equ 0x2B |
sel_srv_code equ 0x31 |
sel_srv_stack equ 0x39 |
sel_code_16 equ 0x70 |
format MS COFF |
use32 |
public __os_stack |
public _pg_balloc |
public high_code |
public core_init |
public test_cpu |
public cpu_vendor |
public cpu_sign |
public cpu_info |
public cpu_caps |
extrn _parse_mbi |
extrn _16bit_start |
extrn _16bit_end |
extrn _enter_bootscreen |
extrn init_fpu |
extrn init_idt |
extrn _init_mm |
extrn _slab_cache_init |
extrn @init_heap@8 |
extrn init_malloc |
extrn _init_core_dll |
extrn _init_threads |
extrn init_mtrr |
extrn system_init |
extrn sysenter_entry |
extrn syscall_entry |
extrn @create_systhread@4 |
extrn _sys_pdbr |
extrn _current_thread |
extrn _k_reenter:dword |
extrn scr_mode:dword |
extrn LFBAddress:dword |
extrn LFBSize:dword |
section '.text' code readable align 16 |
high_code: |
mov ax, sel_os_stack |
mov dx, sel_app_data |
mov ss, ax |
mov esp, __os_stack |
mov ds, dx |
mov es, dx |
mov fs, dx |
mov gs, dx |
; bt [cpu_caps], CAPS_PGE |
; jnc @F |
; or dword [sys_pgdir-OS_BASE+(OS_BASE shr 20)], PG_GLOBAL |
; mov ebx, cr4 |
; or ebx, CR4_PGE |
; mov cr4, ebx |
@@: |
; mov eax, cr3 |
; mov cr3, eax ; flush TLB |
mov edx, 0x3fB |
mov eax, 3 |
out dx, al |
call test_cpu |
call _parse_mbi |
; mov eax, [_pg_balloc] |
; mov [_copy_pg_balloc], eax |
__core_restart: |
mov esi, _16bit_start |
mov ecx, _16bit_end |
shr ecx, 2 |
mov edi, _16BIT_BASE |
cld |
rep movsd |
jmp far sel_code_16:_enter_bootscreen; |
align 16 |
core_init: |
cld |
mov ax, sel_os_stack |
mov dx, sel_app_data |
mov ss, ax |
mov esp, __os_stack |
mov ds, dx |
mov es, dx |
mov fs, dx |
mov gs, dx |
mov [tss._ss0], sel_os_stack |
mov [tss._esp0], __os_stack |
mov [tss._esp], __os_stack |
mov [tss._cs], sel_os_code |
mov [tss._ss], sel_os_stack |
mov [tss._ds], sel_app_data |
mov [tss._es], sel_app_data |
mov [tss._fs], sel_app_data |
mov [tss._gs], sel_app_data |
mov [tss._io], 128 |
;Add IO access table - bit array of permitted ports |
mov edi, tss._io_map_0 |
xor eax, eax |
; not eax |
mov ecx, 8192/4 |
rep stosd ; access to 4096*8=65536 ports |
mov ax, sel_tss |
ltr ax |
; -------- Fast System Call init ---------- |
; Intel SYSENTER/SYSEXIT (AMD CPU support it too) |
bt [cpu_caps], CAPS_SEP |
jnc .SEnP ; SysEnter not Present |
xor edx, edx |
mov ecx, MSR_SYSENTER_CS |
mov eax, sel_os_code |
wrmsr |
mov ecx, MSR_SYSENTER_ESP |
; mov eax, sysenter_stack ; Check it |
xor eax, eax |
wrmsr |
mov ecx, MSR_SYSENTER_EIP |
mov eax, sysenter_entry |
wrmsr |
.SEnP: |
; AMD SYSCALL/SYSRET |
cmp byte[cpu_vendor], 'A' |
jne .noSYSCALL |
mov eax, 0x80000001 |
cpuid |
test edx, 0x800 ; bit_11 - SYSCALL/SYSRET support |
jz .noSYSCALL |
mov ecx, MSR_AMD_EFER |
rdmsr |
or eax, 1 ; bit_0 - System Call Extension (SCE) |
wrmsr |
; Bits of EDX : |
; Bit 3116 During the SYSRET instruction, this field is copied into the CS register |
; and the contents of this field, plus 8, are copied into the SS register. |
; Bit 150 During the SYSCALL instruction, this field is copied into the CS register |
; and the contents of this field, plus 8, are copied into the SS register. |
mov edx, ((sel_os_code + 16) shl 16) + sel_os_code |
mov eax, syscall_entry |
mov ecx, MSR_AMD_STAR |
wrmsr |
.noSYSCALL: |
call init_fpu |
call init_idt |
call _init_mm |
call init_malloc |
call _slab_cache_init |
mov ecx, 0x80000000 |
mov edx, 0x40000000 |
call @init_heap@8 |
call _init_core_dll |
call _init_threads |
; SAVE & CLEAR 0-0xffff |
cld |
xor esi, esi |
mov edi,BOOT_VAR |
mov ecx,0x10000 / 4 |
rep movsd |
xor edi, edi |
xor eax, eax |
mov ecx,0x10000 / 4 |
rep stosd |
mov edi, 0x40000 |
mov ecx, (0x90000-0x40000)/4 |
rep stosd |
mov dword [_sys_pdbr], eax |
mov dword [_sys_pdbr+4], eax |
xchg bx, bx |
movzx eax,word [BOOT_VAR+0x9008] ; screen mode |
mov [scr_mode],eax |
mov eax,[BOOT_VAR+0x9018] |
call map_LFB |
mov eax, cr3 |
mov cr3, eax |
jmp system_init |
if 0 |
mov ecx, system_init |
call @create_systhread@4 |
mov [_current_thread], eax |
xchg bx, bx |
mov ebx, [eax+THR.pdir] |
mov ecx, cr3 |
cmp ebx, ecx |
je .skip |
mov cr3, ebx |
.skip: |
mov esp, [_current_thread] |
; lea eax, [esp+THR.pl0_stack] |
; mov [tss._esp0], eax |
restart1: |
dec [_k_reenter] |
popad |
add esp, 4 ; skip return adr |
iretd ; continue process |
end if |
align 4 |
map_LFB: |
cmp eax, -1 |
jne @f |
ret |
@@: |
test [scr_mode], 0100000000000000b |
jnz @f |
mov [BOOT_VAR+0x901c],byte 2 |
ret |
@@: |
mov [LFBAddress], eax |
mov [LFBSize], 0x800000 |
call init_mtrr |
mov eax, [LFBAddress] |
or eax, PG_LARGE+PG_UW |
mov [_sys_pdbr+(LFB_BASE shr 20)], eax |
add eax, 0x00400000 |
mov [_sys_pdbr+4+(LFB_BASE shr 20)], eax |
if SHADOWFB |
mov ecx, 11 |
call @core_alloc@4 |
or eax, PG_LARGE+PG_UW |
mov [_sys_pdbr+(SHADOWFB shr 20)], eax |
add eax, 0x00400000 |
mov [_sys_pdbr+4+(SHADOWFB shr 20)], eax |
end if |
bt [cpu_caps], CAPS_PGE |
jnc @F |
or dword [_sys_pdbr+(LFB_BASE shr 20)], PG_GLOBAL |
@@: |
mov dword [LFBAddress], LFB_BASE |
ret |
align 4 |
proc test_cpu |
locals |
cpu_type dd ? |
cpu_id dd ? |
cpu_Intel dd ? |
cpu_AMD dd ? |
endl |
mov [cpu_type], 0 |
xor eax, eax |
mov [cpu_caps], eax |
mov [cpu_caps+4], eax |
xor eax, eax |
cpuid |
mov [cpu_vendor], ebx |
mov [cpu_vendor+4], edx |
mov [cpu_vendor+8], ecx |
cmp ebx, dword [intel_str] |
jne .check_AMD |
cmp edx, dword [intel_str+4] |
jne .check_AMD |
cmp ecx, dword [intel_str+8] |
jne .check_AMD |
mov [cpu_Intel], 1 |
cmp eax, 1 |
jl .end_cpuid |
mov eax, 1 |
cpuid |
mov [cpu_sign], eax |
mov [cpu_info], ebx |
mov [cpu_caps], edx |
mov [cpu_caps+4],ecx |
shr eax, 8 |
and eax, 0x0f |
ret |
.end_cpuid: |
mov eax, [cpu_type] |
ret |
.check_AMD: |
cmp ebx, dword [AMD_str] |
jne .unknown |
cmp edx, dword [AMD_str+4] |
jne .unknown |
cmp ecx, dword [AMD_str+8] |
jne .unknown |
mov [cpu_AMD], 1 |
cmp eax, 1 |
jl .unknown |
mov eax, 1 |
cpuid |
mov [cpu_sign], eax |
mov [cpu_info], ebx |
mov [cpu_caps], edx |
mov [cpu_caps+4],ecx |
shr eax, 8 |
and eax, 0x0f |
ret |
.unknown: |
mov eax, 1 |
cpuid |
mov [cpu_sign], eax |
mov [cpu_info], ebx |
mov [cpu_caps], edx |
mov [cpu_caps+4],ecx |
shr eax, 8 |
and eax, 0x0f |
ret |
endp |
intel_str db "GenuineIntel",0 |
AMD_str db "AuthenticAMD",0 |
if 0 |
align 4 |
init_BIOS32: |
mov edi, 0xE0000 |
.pcibios_nxt: |
cmp dword[edi], '_32_' ; "magic" word |
je .BIOS32_found |
.pcibios_nxt2: |
add edi, 0x10 |
cmp edi, 0xFFFF0 |
je .BIOS32_not_found |
jmp .pcibios_nxt |
.BIOS32_found: ; magic word found, check control summ |
movzx ecx, byte[edi + 9] |
shl ecx, 4 |
mov esi, edi |
xor eax, eax |
cld ; paranoia |
@@: lodsb |
add ah, al |
loop @b |
jnz .pcibios_nxt2 ; control summ must be zero |
; BIOS32 service found ! |
mov ebp, [edi + 4] |
mov [bios32_entry], ebp |
; check PCI BIOS present |
mov eax, '$PCI' |
xor ebx, ebx |
push cs ; special for 'ret far' from BIOS |
call ebp |
test al, al |
jnz .PCI_BIOS32_not_found |
; çäåñü ñîçäàþòñÿ äèñêðèïòîðû äëÿ PCI BIOS |
add ebx, OS_BASE |
dec ecx |
mov [(pci_code_32-OS_BASE)], cx ;limit 0-15 |
mov [(pci_data_32-OS_BASE)], cx ;limit 0-15 |
mov [(pci_code_32-OS_BASE)+2], bx ;base 0-15 |
mov [(pci_data_32-OS_BASE)+2], bx ;base 0-15 |
shr ebx, 16 |
mov [(pci_code_32-OS_BASE)+4], bl ;base 16-23 |
mov [(pci_data_32-OS_BASE)+4], bl ;base 16-23 |
shr ecx, 16 |
and cl, 0x0F |
mov ch, bh |
add cx, D32 |
mov [(pci_code_32-OS_BASE)+6], cx ;lim 16-19 & |
mov [(pci_data_32-OS_BASE)+6], cx ;base 24-31 |
mov [(pci_bios_entry-OS_BASE)], edx |
; jmp .end |
.PCI_BIOS32_not_found: |
; çäåñü äîëæíà çàïîëíÿòñÿ pci_emu_dat |
.BIOS32_not_found: |
.end: |
ret |
end if |
section '.data' data writeable align 16 |
_pg_balloc dd LAST_PAGE |
section '.bss' data writeable align 16 |
rb 8192-512 |
__os_stack rb 512 |
;CPUID information |
cpu_vendor rd 3 |
cpu_sign rd 1 |
cpu_info rd 1 |
cpu_caps rd 4 |
/kernel/branches/kolibri_pe/core/mbi.c |
---|
0,0 → 1,95 |
#include <types.h> |
#include <core.h> |
#include "multiboot.h" |
extern u32_t pg_balloc; |
extern u32_t mem_amount; |
extern u32_t rd_base; |
extern u32_t rd_fat ; |
extern u32_t rd_fat_end ; |
extern u32_t rd_root ; |
extern u32_t rd_root_end ; |
extern multiboot_info_t *boot_mbi; |
/* Check if the bit BIT in FLAGS is set. */ |
#define CHECK_FLAG(flags,bit) ((flags) & (1 << (bit))) |
void parse_mbi() |
{ |
u32_t last_page = 0; |
if (CHECK_FLAG (boot_mbi->flags, 1)) |
DBG ("boot_device = 0x%x\n", (unsigned) boot_mbi->boot_device); |
/* Is the command line passed? */ |
if (CHECK_FLAG (boot_mbi->flags, 2)) |
DBG ("cmdline = %s\n", (char *) boot_mbi->cmdline); |
/* Are mods_* valid? */ |
if (CHECK_FLAG (boot_mbi->flags, 3)) |
{ |
module_t *mod; |
int i; |
DBG ("mods_count = %d, mods_addr = 0x%x\n", |
(u32_t) boot_mbi->mods_count, (u32_t) boot_mbi->mods_addr); |
for (i = 0, mod = (module_t *) boot_mbi->mods_addr; |
i < boot_mbi->mods_count;i++, mod++) |
{ |
pg_balloc = mod->mod_end; |
DBG (" mod_start = 0x%x, mod_end = 0x%x, string = %s\n", |
(u32_t) mod->mod_start,(u32_t) mod->mod_end, (char *) mod->string); |
}; |
mod--; |
rd_base = mod->mod_start+OS_BASE; |
rd_fat = rd_base + 512; |
rd_fat_end = rd_base + 512 + 4278; |
rd_root = rd_base + 512*19; |
rd_root_end = rd_base + 512*33; |
// printf(" rd_base = %x\n", rd_base); |
} |
if (CHECK_FLAG (boot_mbi->flags, 6)) |
{ |
memory_map_t *mmap; |
u32_t page; |
DBG("mmap_addr = 0x%x, mmap_length = 0x%x\n", |
(unsigned) boot_mbi->mmap_addr, (unsigned) boot_mbi->mmap_length); |
for (mmap = (memory_map_t *) boot_mbi->mmap_addr; |
(u32_t) mmap < boot_mbi->mmap_addr + boot_mbi->mmap_length; |
mmap = (memory_map_t *) ((u32_t) mmap |
+ mmap->size + sizeof (mmap->size))) |
{ |
u32_t page; |
DBG (" size = 0x%x, base_addr = 0x%x%x," |
" length = 0x%x%x, type = 0x%x\n", |
(unsigned) mmap->size, |
(unsigned) mmap->base_addr_high, |
(unsigned) mmap->base_addr_low, |
(unsigned) mmap->length_high, |
(unsigned) mmap->length_low, |
(unsigned) mmap->type); |
if( mmap->type != 1) |
continue; |
page = (mmap->base_addr_low+mmap->length_low)&(~4095); |
if(page > last_page) |
last_page = page; |
} |
} |
if(last_page > 256*1024*1024) |
last_page = 256*1024*1024; |
mem_amount = last_page; |
}; |
/kernel/branches/kolibri_pe/core/memory.inc |
---|
178,47 → 178,7 |
ret |
endp |
align 4 |
proc init_LFB |
locals |
pg_count dd ? |
endl |
cmp dword [LFBAddress], -1 |
jne @f |
mov [BOOT_VAR+0x901c],byte 2 |
mov ecx, 0x280000 |
mov edx, PG_SW |
call @mem_alloc@8 |
mov [LFBAddress], eax |
ret |
@@: |
test [SCR_MODE],word 0100000000000000b |
jnz @f |
mov [BOOT_VAR+0x901c],byte 2 |
ret |
@@: |
call init_mtrr |
mov eax, [LFBAddress] |
or eax, PG_LARGE+PG_UW |
mov [_sys_pdbr+(LFB_BASE shr 20)], eax |
add eax, 0x00400000 |
mov [_sys_pdbr+4+(LFB_BASE shr 20)], eax |
mov dword [exp_lfb+4], LFB_BASE |
bt [cpu_caps], CAPS_PGE |
jnc @F |
or dword [_sys_pdbr+(LFB_BASE shr 20)], PG_GLOBAL |
@@: |
mov dword [LFBAddress], LFB_BASE |
mov eax, cr3 ;flush TLB |
mov cr3, eax |
ret |
endp |
align 4 |
proc new_mem_resize stdcall, new_size:dword |
395,7 → 355,7 |
mov eax, cr2 |
push eax |
mov ax, app_data |
mov ax, sel_app_data |
mov ds, ax |
mov es, ax |
407,25 → 367,22 |
cmp ebx, HEAP_BASE |
jb .user_space ;ñòðàíèöà â ïàìÿòè ïðèëîæåíèÿ ; |
cmp ebx, LFB_BASE |
cmp ebx, page_tabs |
jb .kernel_heap |
cmp ebx, page_tabs |
jb .lfb |
cmp ebx, heap_tabs |
jb .user_tabs |
cmp ebx, OS_BASE |
cmp ebx, LFB_BASE |
jb .heap_tab |
cmp ebx, OS_BASE |
jb .lfb |
; cmp ebx, kernel_tabs |
; jb .alloc;.app_tabs ;òàáëèöû ñòðàíèö ïðèëîæåíèÿ ; |
;ïðîñòî ñîçäàäèì îäíó |
.lfb: |
shr ebx, 22 |
mov edx, [_sys_pdbr + ebx*4] |
996,7 → 953,7 |
ret |
@@: |
cmp eax, 21 ;for test purposes only |
ja @f ;will be removed soon |
ja .fail ;will be removed soon |
cmp ebx, OS_BASE |
jae .fail |
1178,7 → 1135,6 |
_balloc: ; gcc fastcall |
@balloc@4: |
mov eax, [_pg_balloc] |
add ecx, 4095 |
and ecx, -4096 |
/kernel/branches/kolibri_pe/core/sched.inc |
---|
16,7 → 16,7 |
align 32 |
irq0: |
pushad |
mov ax, app_data ; |
mov ax, sel_app_data |
mov ds, ax |
mov es, ax |
31,7 → 31,7 |
mov [next_usage_update],eax |
call updatecputimes |
.nocounter: |
cmp [DONT_SWITCH], byte 1 |
cmp [dont_switch], 1 |
jne .change_task |
mov al,0x20 ; send End Of Interrupt signal |
38,7 → 38,7 |
mov dx,0x20 |
out dx,al |
mov [DONT_SWITCH], byte 0 |
mov [dont_switch], 0 |
popad |
iretd |
95,7 → 95,7 |
test eax, eax ; the same task -> skip switch |
jnz .return |
@@: |
mov [DONT_SWITCH],byte 1 |
mov [dont_switch], 1 |
call do_change_task |
.return: |
225,7 → 225,7 |
@@: |
mov eax, [ebx+APPDATA.saved_esp0] |
mov [tss._esp0], eax |
mov ax, graph_data |
mov ax, sel_graph_data |
mov gs, ax |
mov eax, [CURRENT_TASK] |
/kernel/branches/kolibri_pe/core/sys32.inc |
---|
14,7 → 14,7 |
$Revision$ |
align 4 |
_init_idt: |
init_idt: |
push edi |
push esi |
mov edi, idts |
25,28 → 25,35 |
@@: |
lodsd |
mov [edi], ax ; lower part of offset |
mov [edi+2], word os_code ; segment selector |
mov [edi+2], word sel_os_code ; segment selector |
mov ax, word 10001110b shl 8 ; type: interrupt gate |
mov [edi+4], eax |
add edi, 8 |
loop @b |
mov eax, i40 |
mov ecx, i40 |
mov eax, _i40 |
mov ecx, _i40 |
and eax, 0x0000FFFF |
and ecx, 0xFFFF0000 |
or eax, os_code shl 16 |
or eax, sel_app_code shl 16 |
or ecx, (11101111b shl 8) |
mov [edi], eax |
mov [edi+4], ecx |
mov eax, i41 |
mov ecx, i41 |
and eax, 0x0000FFFF |
and ecx, 0xFFFF0000 |
or eax, sel_os_code shl 16 |
or ecx, (11101111b shl 8) |
mov [edi+8], eax |
mov [edi+12], ecx |
lidt [idtreg] |
pop esi |
pop edi |
ret |
iglobal |
msg_sel_ker db "kernel", 0 |
75,10 → 82,10 |
times 16 dd unknown_interrupt |
dd i40 |
dd i41 |
idtreg: |
dw 8*0x41-1 |
dw 8*0x42-1 |
dd idts |
endg |
118,9 → 125,10 |
exc_wo_code 0, 2, 3, 4, 5, 6, 9, 15, 18 |
exc_w_code 8, 10, 11, 12, 13, 14, 17 |
align 4 |
exc_c: |
mov ax, app_data ;èñêëþ÷åíèå |
mov ds, ax ;çàãðóçèì ïðàâèëüíûå çíà÷åíè |
mov ax, sel_app_data ;èñêëþ÷åíèå |
mov ds, ax ;çàãðóçèì ïðàâèëüíûå çíà÷åíèÿ' |
mov es, ax ;â ðåãèñòðû |
; redirect to V86 manager? (EFLAGS & 0x20000) != 0? |
215,7 → 223,7 |
mov eax, [esp + 8 + 0x20] |
mov edi, msg_sel_app |
mov ebx, [esp + 16 + 0x20] |
cmp eax, app_code |
cmp eax, sel_app_code |
je @f |
mov edi, msg_sel_ker |
mov ebx, [esp - 16 + 0x20] |
239,7 → 247,7 |
p_irq6: |
save_ring3_context |
mov ax, app_data ;os_data |
mov ax, sel_app_data |
mov ds, ax |
mov es, ax |
call fdc_irq |
250,7 → 258,7 |
p_irq14: |
save_ring3_context |
mov ax, app_data ;os_data |
mov ax, sel_app_data |
mov ds, ax |
mov es, ax |
mov byte [BOOT_VAR + 0x48E], 0xFF |
260,7 → 268,7 |
iret |
p_irq15: |
save_ring3_context |
mov ax, app_data ;os_data |
mov ax, sel_app_data |
mov ds, ax |
mov es, ax |
mov byte [BOOT_VAR + 0x48E], 0xFF |
284,7 → 292,7 |
irqD: |
save_ring3_context |
mov ax, app_data ;os_data |
mov ax, sel_app_data |
mov ds, ax |
mov es, ax |
518,8 → 526,8 |
frstor [eax] |
@@: |
mov [KEY_COUNT],byte 0 ; empty keyboard buffer |
mov [BTN_COUNT],byte 0 ; empty button buffer |
mov [KEY_COUNT], 0 ; empty keyboard buffer |
mov [BTN_COUNT], 0 ; empty button buffer |
; remove defined hotkeys |
558,7 → 566,7 |
mov ecx,esi ; remove buttons |
bnewba2: |
mov edi,[BTN_ADDR] |
mov edi,[btn_addr] |
mov eax,edi |
cld |
movzx ebx,word [edi] |
804,8 → 812,8 |
xor esi, esi |
call redrawscreen |
mov [MOUSE_BACKGROUND],byte 0 ; no mouse background |
mov [DONT_DRAW_MOUSE],byte 0 ; draw mouse |
mov [mouse_background], 0 ; no mouse background |
mov [dont_draw_mouse], 0 ; draw mouse |
mov [application_table_status],0 |
;mov esi,process_terminated |
/kernel/branches/kolibri_pe/core/syscall.asm |
---|
0,0 → 1,16 |
format MS COFF |
public _i40 |
section '.text' code readable align 16 |
align 16 |
_i40: |
; xchg bx, bx |
int 0x41 |
iretd |
/kernel/branches/kolibri_pe/core/syscall.inc |
---|
30,7 → 30,7 |
align 16 |
i40: |
i41: |
pushad |
cld |
movzx eax, al |
/kernel/branches/kolibri_pe/core/taskman.inc |
---|
1281,12 → 1281,12 |
mov eax, [esi+0x08] ;app_eip |
mov [ebx+REG_EIP], eax ;app_entry |
mov [ebx+REG_CS], dword app_code |
mov [ebx+REG_CS], dword sel_app_code |
mov [ebx+REG_EFLAGS], dword EFL_IOPL3+EFL_IF |
mov eax, [esi+0x0C] ;app_esp |
mov [ebx+REG_APP_ESP], eax ;app_stack |
mov [ebx+REG_SS], dword app_data |
mov [ebx+REG_SS], dword sel_app_data |
lea ecx, [ebx+REG_RET] |
mov ebx, [slot] |
/kernel/branches/kolibri_pe/core/thread.c |
---|
0,0 → 1,68 |
#include <types.h> |
#include <core.h> |
#include <spinlock.h> |
#include <link.h> |
#include <mm.h> |
#include <slab.h> |
addr_t thr_ptr; |
slab_cache_t *thr_slab; |
extern addr_t sys_pdbr; |
void init_threads() |
{ |
thr_slab = slab_cache_create(sizeof(thr_t), 16, |
NULL,NULL,SLAB_CACHE_MAGDEFERRED); |
}; |
thr_t* __fastcall create_systhread(addr_t entry_ptr) |
{ |
static count_t thr_cnt = 0; |
static count_t slot = 1; |
thr_t *thr; |
addr_t thr_stack; |
thr = (thr_t*)slab_alloc(thr_slab,0); |
thr_stack = PA2KA(core_alloc(1)); |
thr_cnt++; |
thr->eax = (thr_cnt<<8)|slot; |
thr->tid = (thr_cnt<<8)|slot; |
thr->slot = slot; |
slot++; |
thr->pdir = KA2PA(&sys_pdbr); |
thr->ebx = 0; |
thr->edi = 0; |
thr->esi = 0; |
thr->ebp = 0; |
thr->edx = 0; |
thr->ecx = 0; |
thr->cs = sel_srv_code; |
thr->eflags = EFL_IOPL1; |
thr->esp = thr_stack + 8192; |
thr->ss = sel_srv_stack; |
thr->thr_flags = 0; |
thr->ticks_left = 8; |
thr->quantum_size = 8; |
thr->eip = entry_ptr; |
//lock_enqueue(thr_ptr); /* add to scheduling queues */ |
return thr; |
}; |
/kernel/branches/kolibri_pe/core/v86.inc |
---|
392,7 → 392,7 |
endg |
v86_exc_c: |
mov ax, app_data |
mov ax, sel_app_data |
mov ds, ax |
mov es, ax |
; Did we all that we have wanted to do? |