Subversion Repositories Kolibri OS

Compare Revisions

No changes between revisions

Regard whitespace Rev 928 → Rev 914

/kernel/branches/kolibri_pe/core/mbi.c
File deleted
/kernel/branches/kolibri_pe/core/init.asm
File deleted
/kernel/branches/kolibri_pe/core/syscall.asm
File deleted
/kernel/branches/kolibri_pe/core/thread.c
File deleted
/kernel/branches/kolibri_pe/core/dll.c
366,6 → 366,7
return pe_app_param(path, raw, ex_pg_dir, ex_stack);
};
 
#define master_tab (page_tabs+ (page_tabs>>10))
 
typedef struct
{
384,6 → 385,11
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/taskman.inc
1281,12 → 1281,12
 
mov eax, [esi+0x08] ;app_eip
mov [ebx+REG_EIP], eax ;app_entry
mov [ebx+REG_CS], dword sel_app_code
mov [ebx+REG_CS], dword 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 sel_app_data
mov [ebx+REG_SS], dword app_data
 
lea ecx, [ebx+REG_RET]
mov ebx, [slot]
/kernel/branches/kolibri_pe/core/heap.c
6,7 → 6,9
#include <mm.h>
#include <slab.h>
 
#define page_tabs 0xDF800000
 
 
#define MD_FREE 1
#define MD_USED 2
 
/kernel/branches/kolibri_pe/core/memory.inc
178,7 → 178,47
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
 
355,7 → 395,7
mov eax, cr2
push eax
 
mov ax, sel_app_data
mov ax, app_data
mov ds, ax
mov es, ax
 
367,22 → 407,25
cmp ebx, HEAP_BASE
jb .user_space ;ñòðàíèöà â ïàìÿòè ïðèëîæåíèÿ ;
 
cmp ebx, page_tabs
cmp ebx, LFB_BASE
jb .kernel_heap
 
cmp ebx, page_tabs
jb .lfb
 
cmp ebx, heap_tabs
jb .user_tabs
 
cmp ebx, LFB_BASE
cmp ebx, OS_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]
953,7 → 996,7
ret
@@:
cmp eax, 21 ;for test purposes only
ja .fail ;will be removed soon
ja @f ;will be removed soon
cmp ebx, OS_BASE
jae .fail
 
1135,6 → 1178,7
_balloc: ; gcc fastcall
@balloc@4:
 
 
mov eax, [_pg_balloc]
add ecx, 4095
and ecx, -4096
/kernel/branches/kolibri_pe/core/v86.inc
392,7 → 392,7
endg
 
v86_exc_c:
mov ax, sel_app_data
mov ax, app_data
mov ds, ax
mov es, ax
; Did we all that we have wanted to do?
/kernel/branches/kolibri_pe/core/dll.inc
159,7 → 159,7
.main:
save_ring3_context
mov eax, [esp + 32]
mov bx, sel_app_data
mov bx, app_data ;os_data
mov ds, bx
mov es, bx
 
514,7 → 514,7
 
mov eax, 70
lea ebx, [cmd]
int 0x41
int 0x40
ret
endp
 
/kernel/branches/kolibri_pe/core/exports.inc
67,6 → 67,7
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
149,6 → 150,8
dd szStrchr , strchr
dd szStrrchr , strrchr
 
exp_lfb:
dd szLFBAddress , 0
dd 0 ;terminator, must be zero
 
endg
/kernel/branches/kolibri_pe/core/peload.inc
0,0 → 1,51
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;;
;; Distributed under terms of the GNU General Public License ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
$Revision$
 
include 'export.inc'
 
align 4
 
 
align 16
_kernel_exports:
export 'KERNEL', \
commit_pages, 'CommitPages', \ ; eax, ebx, ecx
create_kernel_object, 'CreateObject', \
create_ring_buffer, 'CreateRingBuffer', \ ; stdcall
destroy_kernel_object, 'DestroyObject', \
free_kernel_space, 'FreeKernelSpace', \ ; stdcall
malloc, 'Kmalloc', \
free, 'Kfree', \
map_io_mem, 'MapIoMem', \ ; stdcall
get_pg_addr, 'GetPgAddr', \ ; eax
@mem_alloc@8, 'mem_alloc', \ ; fastcall
@mem_free@4, 'mem_free', \ ; fastcall
\
select_hw_cursor, 'SelectHwCursor', \ ; stdcall
set_hw_cursor, 'SetHwCursor', \ ; stdcall
hw_restore, 'HwCursorRestore', \ ;
create_cursor, 'HwCursorCreate', \ ;
\
set_screen, 'SetScreen', \
pci_api, 'PciApi', \
pci_read8, 'PciRead8', \ ; stdcall
pci_read16, 'PciRead16', \ ; stdcall
pci_read32, 'PciRead32', \ ; stdcall
pci_write8, 'PciWrite8', \ ; stdcall
pci_write16, 'PciWrite16', \ ; stdcall
pci_write32, 'PciWrite32', \ ; stdcall
\
reg_service, 'RegService', \ ; stdcall
user_alloc, 'UserAlloc', \ ; stdcall
user_free, 'UserFree', \ ; stdcall
unmap_pages, 'UnmapPages', \ ; eax, ecx
sys_msg_board_str, 'SysMsgBoardStr'
 
 
 
Property changes:
Added: svn:keywords
+Revision
\ No newline at end of property
/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,35 → 25,28
@@:
lodsd
mov [edi], ax ; lower part of offset
mov [edi+2], word sel_os_code ; segment selector
mov [edi+2], word 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, sel_app_code shl 16
or eax, os_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
82,10 → 75,10
 
times 16 dd unknown_interrupt
 
dd i41
dd i40
 
idtreg:
dw 8*0x42-1
dw 8*0x41-1
dd idts
 
endg
125,10 → 118,9
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, sel_app_data ;èñêëþ÷åíèå
mov ds, ax ;çàãðóçèì ïðàâèëüíûå çíà÷åíèÿ'
mov ax, app_data ;èñêëþ÷åíèå
mov ds, ax ;çàãðóçèì ïðàâèëüíûå çíà÷åíè
mov es, ax ;â ðåãèñòðû
 
; redirect to V86 manager? (EFLAGS & 0x20000) != 0?
223,7 → 215,7
mov eax, [esp + 8 + 0x20]
mov edi, msg_sel_app
mov ebx, [esp + 16 + 0x20]
cmp eax, sel_app_code
cmp eax, app_code
je @f
mov edi, msg_sel_ker
mov ebx, [esp - 16 + 0x20]
247,7 → 239,7
 
p_irq6:
save_ring3_context
mov ax, sel_app_data
mov ax, app_data ;os_data
mov ds, ax
mov es, ax
call fdc_irq
258,7 → 250,7
 
p_irq14:
save_ring3_context
mov ax, sel_app_data
mov ax, app_data ;os_data
mov ds, ax
mov es, ax
mov byte [BOOT_VAR + 0x48E], 0xFF
268,7 → 260,7
iret
p_irq15:
save_ring3_context
mov ax, sel_app_data
mov ax, app_data ;os_data
mov ds, ax
mov es, ax
mov byte [BOOT_VAR + 0x48E], 0xFF
292,7 → 284,7
 
irqD:
save_ring3_context
mov ax, sel_app_data
mov ax, app_data ;os_data
mov ds, ax
mov es, ax
 
526,8 → 518,8
frstor [eax]
@@:
 
mov [KEY_COUNT], 0 ; empty keyboard buffer
mov [BTN_COUNT], 0 ; empty button buffer
mov [KEY_COUNT],byte 0 ; empty keyboard buffer
mov [BTN_COUNT],byte 0 ; empty button buffer
 
 
; remove defined hotkeys
566,7 → 558,7
 
mov ecx,esi ; remove buttons
bnewba2:
mov edi,[btn_addr]
mov edi,[BTN_ADDR]
mov eax,edi
cld
movzx ebx,word [edi]
812,8 → 804,8
xor esi, esi
call redrawscreen
 
mov [mouse_background], 0 ; no mouse background
mov [dont_draw_mouse], 0 ; draw mouse
mov [MOUSE_BACKGROUND],byte 0 ; no mouse background
mov [DONT_DRAW_MOUSE],byte 0 ; draw mouse
 
mov [application_table_status],0
;mov esi,process_terminated
/kernel/branches/kolibri_pe/core/syscall.inc
30,7 → 30,7
 
 
align 16
i41:
i40:
pushad
cld
movzx eax, al
/kernel/branches/kolibri_pe/core/init.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 init()
{
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/sched.inc
16,7 → 16,7
align 32
irq0:
pushad
mov ax, sel_app_data
mov ax, app_data ;
mov ds, ax
mov es, ax
 
31,7 → 31,7
mov [next_usage_update],eax
call updatecputimes
.nocounter:
cmp [dont_switch], 1
cmp [DONT_SWITCH], byte 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], 0
mov [DONT_SWITCH], byte 0
 
popad
iretd
95,7 → 95,7
test eax, eax ; the same task -> skip switch
jnz .return
@@:
mov [dont_switch], 1
mov [DONT_SWITCH],byte 1
call do_change_task
 
.return:
225,7 → 225,7
@@:
mov eax, [ebx+APPDATA.saved_esp0]
mov [tss._esp0], eax
mov ax, sel_graph_data
mov ax, graph_data
mov gs, ax
 
mov eax, [CURRENT_TASK]
/kernel/branches/kolibri_pe/core/debug.inc
421,7 → 421,7
; int 1 = #DB
save_ring3_context
cld
mov ax, sel_app_data
mov ax, app_data ;os_data
mov ds, ax
mov es, ax
mov eax, dr6
/kernel/branches/kolibri_pe/core/fpu.inc
145,7 → 145,7
e7: ;#NM exception handler
save_ring3_context
clts
mov ax, sel_app_data
mov ax, app_data ;
mov ds, ax
mov es, ax