/kernel/branches/kolibri_pe/init.inc |
---|
File deleted |
Property changes: |
Deleted: svn:keywords |
-Revision |
\ No newline at end of property |
/kernel/branches/kolibri_pe/blkdev/hd_drv.inc |
---|
525,7 → 525,7 |
; mov [dma_slot_ptr], eax |
; mov [CURRENT_TASK], ebx |
; mov [TASK_BASE], edi |
; mov byte [DONT_SWITCH], 1 |
; mov [dont_switch], 1 |
; call do_change_task |
.noswitch: |
popad |
556,7 → 556,7 |
; mov [dma_slot_ptr], eax |
; mov [CURRENT_TASK], ebx |
; mov [TASK_BASE], edi |
; mov byte [DONT_SWITCH], 1 |
; mov [dont_switch], 1 |
; call do_change_task |
.noswitch: |
popad |
/kernel/branches/kolibri_pe/boot/boot.asm |
---|
24,7 → 24,7 |
public _bx_from_load |
extrn __setvars |
extrn core_init |
section '.boot' code readable align 16 |
64,7 → 64,6 |
include "../bus/pci/pci16.inc" |
include "../detect/biosdisk.inc" |
cli |
mov eax, cr0 |
71,18 → 70,8 |
or eax, CR0_PG+CR0_WP+CR0_PE |
mov cr0, eax |
jmp pword 0x08:__setvars |
jmp pword 0x10:core_init |
;align 4 |
;_leave_16bit: |
; |
; cli |
; mov eax, cr0 |
; or eax, CR0_PG+CR0_WP+CR0_PE |
; mov cr0, eax |
; hlt |
align 4 |
rmode_idt: |
dw 0x400 |
/kernel/branches/kolibri_pe/boot/start.asm |
---|
9,7 → 9,7 |
public __start |
extrn _high_code |
extrn high_code |
extrn __os_stack |
extrn _boot_mbi |
extrn _sys_pdbr |
70,8 → 70,9 |
; ENABLE PAGING |
mov ecx, 64 |
mov eax, PG_LARGE+PG_SW |
mov edi, _sys_pdbr+(OS_BASE shr 20)+(0x100000000-OS_BASE) |
mov eax, PG_LARGE+PG_SW |
mov [edi-4], dword (PG_LARGE+PG_USER) |
@@: |
stosd |
add eax, 4*1024*1024 |
110,8 → 111,8 |
add ecx, 4095 |
and ecx, not 4095 |
lgdt [_gdts+(0x100000000-OS_BASE)] |
jmp pword 0x08:_high_code |
lgdt [_gdts] ;+(0x100000000-OS_BASE)] |
jmp pword 0x10:high_code |
.fault: |
/kernel/branches/kolibri_pe/bus/pci/pci32.inc |
---|
385,7 → 385,7 |
jz .emulate_bios |
push ds |
mov ax, pci_data_sel |
mov ax, sel_pci_data |
mov ds, ax |
mov eax, ebp |
mov ah, 0B1h |
/kernel/branches/kolibri_pe/const.inc |
---|
10,8 → 10,11 |
dpl0 equ 10010000b ; data read dpl0 |
drw0 equ 10010010b ; data read/write dpl0 |
drw1 equ 10110010b ; data read/write dpl1 |
drw3 equ 11110010b ; data read/write dpl3 |
cpl0 equ 10011010b ; code read dpl0 |
cpl1 equ 10111010b ; code read dpl1 |
cpl3 equ 11111010b ; code read dpl3 |
D32 equ 01000000b ; 32bit segment |
188,16 → 191,17 |
HEAP_MIN_SIZE equ 0x01000000 |
LFB_BASE equ 0xDF000000 |
page_tabs equ 0xDDC00000 |
app_page_tabs equ 0xDDC00000 |
page_tabs equ 0xDF800000 |
app_page_tabs equ 0xDF800000 |
heap_tabs equ (page_tabs+ (HEAP_BASE shr 10)) |
kernel_tabs equ (page_tabs+ (OS_BASE shr 10)) |
master_tab equ (page_tabs+ (page_tabs shr 10)) |
OS_TEMP equ 0xDFC00000 |
LFB_BASE equ 0xDE000000 |
SHADOWFB equ 0 ;0xDE800000 |
heap_tabs equ (page_tabs+ (HEAP_BASE shr 10)) |
kernel_tabs equ (page_tabs+ (OS_BASE shr 10)) ;0xFDE00000 |
master_tab equ (page_tabs+ (page_tabs shr 10)) ;0xFDFF70000 |
TEXT_BASE equ 0xDFC00000 |
_16BIT_BASE equ 0x00010000 |
LOAD_BASE equ 0x00100000 |
221,81 → 225,10 |
WIN_POS equ (OS_BASE+0x000C400) |
FDD_BUFF equ (OS_BASE+0x000D000) |
;unused ? only one reference |
ENABLE_TASKSWITCH equ (OS_BASE+0x000E000) |
PUTPIXEL equ (OS_BASE+0x000E020) |
GETPIXEL equ (OS_BASE+0x000E024) |
;unused ? only one reference |
BANK_SWITCH equ (OS_BASE+0x000E030) |
;unused ? store mousepointer |
MOUSE_PICTURE equ (OS_BASE+0x000F200) |
MOUSE_VISIBLE equ (OS_BASE+0x000F204) |
WIN_TEMP_XY equ (OS_BASE+0x000F300) |
KEY_COUNT equ (OS_BASE+0x000F400) |
KEY_BUFF equ (OS_BASE+0x000F401) |
BTN_COUNT equ (OS_BASE+0x000F500) |
BTN_BUFF equ (OS_BASE+0x000F501) |
CPU_FREQ equ (OS_BASE+0x000F600) |
;unused ? no active references |
MOUSE_PORT equ (OS_BASE+0x000F604) |
;unused |
PS2_CHUNK equ (OS_BASE+0x000FB00) |
MOUSE_SCROLL_H equ (OS_BASE+0x000FB08) |
MOUSE_X equ (OS_BASE+0x000FB0A) |
MOUSE_Y equ (OS_BASE+0x000FB0C) |
MOUSE_SCROLL_V equ (OS_BASE+0x000FB0E) |
MOUSE_COLOR_MEM equ (OS_BASE+0x000FB10) |
COLOR_TEMP equ (OS_BASE+0x000FB30) |
BTN_DOWN equ (OS_BASE+0x000FB40) |
MOUSE_DOWN equ (OS_BASE+0x000FB44) |
X_UNDER equ (OS_BASE+0x000FB4A) |
Y_UNDER equ (OS_BASE+0x000FB4C) |
ScreenBPP equ (OS_BASE+0x000FBF1) |
;unused ? only one reference |
MOUSE_BUFF_COUNT equ (OS_BASE+0x000FCFF) |
LFBAddress equ (OS_BASE+0x000FE80) |
Screen_Max_X equ (OS_BASE+0x000FE00) |
Screen_Max_Y equ (OS_BASE+0x000FE04) |
BytesPerScanLine equ (OS_BASE+0x000FE08) |
SCR_MODE equ (OS_BASE+0x000FE0C) |
BTN_ADDR equ (OS_BASE+0x000FE88) |
SYS_SHUTDOWN equ (OS_BASE+0x000FF00) |
TASK_ACTIVATE equ (OS_BASE+0x000FF01) |
REDRAW_BACKGROUND equ (OS_BASE+0x000FFF0) |
BANK_RW equ (OS_BASE+0x000FFF2) |
MOUSE_BACKGROUND equ (OS_BASE+0x000FFF4) |
DONT_DRAW_MOUSE equ (OS_BASE+0x000FFF5) |
DONT_SWITCH equ (OS_BASE+0x000FFFF) |
;TMP_STACK_TOP equ 0x006CC00 |
FONT_II equ (OS_BASE+0x006DC00) |
FONT_I equ (OS_BASE+0x006E600) |
;sys_pgdir equ (OS_BASE+0x006F000) |
DRIVE_DATA equ (OS_BASE+0x0070000) |
SLOT_BASE equ (OS_BASE+0x0080000) |
;unused |
TMP_BUFF equ (OS_BASE+0x0090000) |
VGABasePtr equ (OS_BASE+0x00A0000) |
RAMDISK_FAT equ (OS_BASE+0x0180000) |
377,7 → 310,6 |
BOOT_VESA_MODE equ 0x9008 ;word vesa video mode |
;;BOOT_X_RES equ 0x900A ;word X res |
;;BOOT_Y_RES equ 0x900C ;word Y res |
;;BOOT_MOUSE_PORT equ 0x9010 ;byte mouse port - not used |
BOOT_BANK_SW equ 0x9014 ;dword Vesa 1.2 pm bank switch |
BOOT_LFB equ 0x9018 ;dword Vesa 2.0 LFB address |
BOOT_MTRR equ 0x901C ;byte 0 or 1 : enable MTRR graphics acceleration |
658,3 → 590,37 |
CSYM COFF_SYM |
end virtual |
struc THR |
{ |
.edi rd 1 ; 0x00 |
.esi rd 1 ; 0x04 |
.ebp rd 1 ; 0x08 |
rd 1 ; 0x0C ;esp |
.ebx rd 1 ; 0x10 |
.edx rd 1 ; 0x14 |
.ecx rd 1 ; 0x18 |
.eax rd 1 ; 0x1C |
.retaddr rd 1 ; 0x20 ;èëè êîä îøèáêè |
.eip rd 1 ; 0x24 |
.cs rd 1 ; 0x28 |
.eflags rd 1 ; 0x2C |
.esp rd 1 ; 0x30 |
.ss rd 1 ; 0x34 |
.pl0_stack: |
.tid rd 1 ; ; number of this process (for fast access) |
.slot rd 1 ; ; number of this process (for fast access) |
.pdir rd 1 ; ; |
.thr_flags rd 1 ; ; process is runnable only if zero |
.ticks_left rd 1 ; ; number of scheduling ticks left |
.quantum_size rd 1 ; ; quantum size in ticks |
.user_time rd 1 ; ; user time in ticks |
.sys_time rd 1 ; ; sys time in ticks |
} |
virtual at 0 |
THR THR |
end virtual |
/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? |
/kernel/branches/kolibri_pe/data32.inc |
---|
81,8 → 81,6 |
msg_www db 'please visit www.kolibrios.org',13,10,0 |
msg_CR db 13,10,0 |
intel_str db "GenuineIntel",0 |
AMD_str db "AuthenticAMD",0 |
;szSound db 'SOUND',0 |
;szInfinity db 'INFINITY',0 |
108,10 → 106,7 |
vrr_m db 'VRR_M',0 |
kernel_file db 'KERNEL MNT' |
align 4 |
_pg_balloc dd LAST_PAGE |
;supported videomodes |
mode_1280_1024_32: |
dw 1280,1024,32,60 |
162,7 → 157,7 |
boot_y dd 10 |
pci_bios_entry dd 0 |
dw pci_code_sel |
dw sel_pci_code |
if __DEBUG__ eq 1 |
include_debug_strings |
173,15 → 168,21 |
align 16 |
_gdts: |
dw 0x67; gdte-$-1 |
dw (gdte - _gdts -1) |
dd _gdts |
dw 0 |
tss_l: |
dw TSS_SIZE-1 |
dw tss and 0xFFFF |
db (tss shr 16) and 0xFF |
db 10001001b |
dw (tss shr 16) and 0xFF00 |
; Attention! Do not change the order of the first four selectors. They are used in Fast System Call |
; must be : os_code, os_data, app_code, app_data, .... |
int_code_l: |
os_code_l: |
os_code_l: ;0x10 |
dw 0xffff |
dw 0x0000 |
db 0x00 |
188,8 → 189,7 |
dw 11011111b *256 +10011010b |
db 0x00 |
int_data_l: |
os_data_l: |
os_stacK_l: ;0x18 |
dw 0xffff |
dw 0x0000 |
db 0x00 |
196,7 → 196,7 |
dw 11011111b *256 +10010010b |
db 0x00 |
app_code_l: |
app_code_l: ;0x20 |
dw 0xFFFF |
dw 0 |
db 0 |
203,7 → 203,7 |
db cpl3 |
dw G32+D32+0xF; |
app_data_l: |
app_data_l: ;0x28 |
dw 0xFFFF |
dw 0 |
db 0 |
210,6 → 210,20 |
db drw3 |
dw G32+D32+0xF; |
srv_code_l: ;0x30 |
dw 0xFFFF |
dw 0 |
db 0 |
db cpl1 |
dw G32+D32+0xF; |
srv_stack_l: ;0x38 |
dw 0xFFFF |
dw 0 |
db 0 |
db drw1 |
dw G32+D32+0xF; |
; ------------- PCI BIOS ------------------ |
pci_code_32: |
253,14 → 267,8 |
db 0x00 |
dw 11010000b *256 +11110010b |
db 0x00 |
tss0_l: |
dw TSS_SIZE-1 |
dw tss and 0xFFFF |
db (tss shr 16) and 0xFF |
db 10001001b |
dw (tss shr 16) and 0xFF00 |
code_16: |
code_16_l: |
dw 0xFFFF |
dw 0 |
db 1 |
276,16 → 284,13 |
_sys_pdbr rd 1024 |
rb 8192-512 |
__os_stack rb 512 |
cur_saved_data rb 4096 |
cur_saved_data rb 4096 |
fpu_data: rb 512 |
idts rq 0x42 |
idts rq 0x41 |
; device irq owners |
irq_owner rd 16 ; process id |
310,6 → 315,9 |
irq_tab rd 16 |
FONT_I rb 2304 ;16*144 |
FONT_II rb 2560 ;16*160 |
_z_core rd 52 |
mem_block_map rb 512 |
330,13 → 338,6 |
_rd_root rd 1 ;RAMDISK + 512*18 + 512 |
_rd_root_end rd 1 ;RAMDISK + 512*33 |
mem_used.fd rd 1 |
mem_used.bk rd 1 |
mem_block_arr rd 1 |
mem_block_start rd 1 |
mem_block_end rd 1 |
heap_mutex rd 1 |
heap_size rd 1 |
heap_free rd 1 |
393,7 → 394,6 |
default_io_map rd 1 |
LFBSize rd 1 ;8Mb hardcoded |
stall_mcs rd 1 |
402,6 → 402,59 |
_display_data rd 1 |
_current_thread rd 1 |
_k_reenter rd 1 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
scr_mode rd 1 |
LFBAddress rd 1 |
LFBSize rd 1 ;8Mb hardcoded |
ScreenBPP rd 1 |
BytesPerScanLine rd 1 |
put_pixel rd 1 |
get_pixel rd 1 |
Screen_Max_X rd 1 |
Screen_Max_Y rd 1 |
btn_addr rd 1 |
redraw_background rd 1 |
mouse_background rd 1 |
dont_draw_mouse rd 1 |
MOUSE_VISIBLE rd 1 |
WIN_TEMP_XY rd 1 |
MOUSE_X rw 1 |
MOUSE_Y rw 1 |
mouse_scroll_v rd 1 |
mouse_scroll_h rd 1 |
BTN_COUNT rd 1 |
BTN_BUFF rd 1 |
KEY_COUNT rd 1 |
KEY_BUFF rb 128 |
mouse_color_mem rd 1 |
color_temp rd 1 |
btn_down rd 1 |
x_under rd 1 |
y_under rd 1 |
dont_switch rd 1 |
sys_shutdown rd 1 |
bank_rw rd 1 |
CPU_FREQ rd 1 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
; status |
hd1_status rd 1 ; 0 - free : other - pid |
application_table_status rd 1 ; 0 - free : other - pid |
419,11 → 472,6 |
fat32part rd 1 ; for boot 0x1 |
cdpos rd 1 |
;CPUID information |
cpu_vendor rd 3 |
cpu_sign rd 1 |
cpu_info rd 1 |
cpu_caps rd 4 |
pg_data PG_DATA |
499,13 → 547,16 |
cache_ide3_appl_search_start rd 1 |
debug_step_pointer rd 1 |
hdd_appl_data rb 1 ; 0 = system cache, 1 - application cache |
cd_appl_data rb 1 ; 0 = system cache, 1 - application cache |
align 4 |
lba_read_enabled rd 1 ; 0 = disabled , 1 = enabled |
pci_access_enabled rd 1 ; 0 = disabled , 1 = enabled |
timer_ticks_enable rb 1 ; for cd driver |
align 4 |
NumBiosDisks rd 1 |
BiosDisksData rb 200h |
BiosDiskCaches rb 80h*(cache_ide1-cache_ide0) |
/kernel/branches/kolibri_pe/drivers/ati2d.asm |
---|
571,7 → 571,7 |
shl edx, 8 |
add edx, [esi+CURSOR.base] |
sub edx, LFBAddress |
sub edx, LFB_BASE |
wrr CUR_OFFSET, edx |
popfd |
ret |
602,7 → 602,7 |
lea eax,[eax+ebx*8] |
shl eax,14 |
add eax, LFBAddress+CURSOR_IMAGE_OFFSET |
add eax, LFB_BASE+CURSOR_IMAGE_OFFSET |
ret |
endp |
610,7 → 610,7 |
video_free: |
pushfd |
cli |
sub eax, LFBAddress+CURSOR_IMAGE_OFFSET |
sub eax, LFB_BASE+CURSOR_IMAGE_OFFSET |
shr eax, 14 |
mov ebx, cursor_map |
bts [ebx], eax |
/kernel/branches/kolibri_pe/drivers/imports.inc |
---|
82,6 → 82,6 |
strncmp,\ |
strnlen,\ |
strchr,\ |
strrchr,\ |
\ |
LFBAddress |
strrchr |
/kernel/branches/kolibri_pe/gui/button.inc |
---|
227,7 → 227,7 |
button_no_draw: |
push edi |
mov edi, [BTN_ADDR] |
mov edi, [btn_addr] |
movzx eax, word [edi] |
cmp eax, max_buttons |
jge noaddbutt |
264,7 → 264,7 |
rnewba2: |
mov edi, [BTN_ADDR] |
mov edi, [btn_addr] |
mov eax, edi |
movzx ebx, word [edi] |
inc ebx |
429,7 → 429,7 |
checkbuttons: |
cmp [BTN_DOWN],byte 0 ; mouse buttons pressed |
cmp byte [btn_down], 0 ; mouse buttons pressed |
jnz @f |
;..................................... start 1/5 : modified by vhanla ............................. |
mov [bPressedMouseXY_B],0 |
439,7 → 439,7 |
pushad |
xor esi, esi |
mov edi, [BTN_ADDR] |
mov edi, [btn_addr] |
movzx edx, word [edi] |
test edx, edx |
jne @f |
449,7 → 449,7 |
@@: |
;..................................... start 2/5 : modified by vhanla ............................. |
;here i catch the coordinates when the mouse's button is clicked |
push ax |
push eax |
cmp [bPressedMouseXY_B],0;FALSE |
jnz @f |
mov [bPressedMouseXY_B],1;TRUE - it was already clicked |
458,7 → 458,7 |
mov ax,[MOUSE_Y] |
mov [my],ax |
@@: |
pop ax |
pop eax |
;and it is only refreshed after the mouse's button release |
;..................................... end 2/5 : modified by vhanla ............................. |
520,7 → 520,7 |
movzx edx,word [eax+4] ; button x start |
add edx,ecx |
;..................................... start 3/5 : modified by vhanla ............................. |
mov cx,[mx] ;mov cx,[MOUSE_X] |
mov cx,[mx] ;mov cx,[mouse_x] |
;..................................... end 3/5 : modified by vhanla ............................. |
cmp edx,ecx |
jg buttonnewcheck |
558,7 → 558,6 |
mov bx,[eax+2] ; button id : bits 00-16 |
push ebx |
mov [MOUSE_DOWN],byte 1 ; no mouse down checks |
call find_pressed_button_frames |
call negativebutton |
565,7 → 564,7 |
pushad |
; // Alver 22.06.2008 // { |
push eax |
mov al, byte [BTN_DOWN] |
mov al, byte [btn_down] |
mov byte [btn_down_determ], al |
pop eax |
; } \\ Alver \\ |
580,13 → 579,13 |
call stack_handler |
popad |
cmp [BTN_DOWN],byte 0 ; mouse buttons pressed ? |
cmp byte [btn_down], 0 ; mouse buttons pressed ? |
jnz cbwaitmouseup |
popad |
call negativebutton |
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 |
;..................................... start 5/5 : modified by vhanla ............................. |
; check coordinates |
iglobal |
629,7 → 628,7 |
cmp ecx,edx |
jg no_on_button |
popa |
mov [BTN_COUNT],byte 1 ; no of buttons in buffer |
mov [BTN_COUNT], 1 ; no of buttons in buffer |
pop ebx |
mov [BTN_BUFF],ebx ; lets put the button id in buffer |
push ebx |
636,9 → 635,8 |
pusha |
jmp yes_on_button |
no_on_button: |
mov [BTN_COUNT],byte 0 ; no of buttons in buffer |
mov [BTN_COUNT], 0 ; no of buttons in buffer |
yes_on_button: |
mov [MOUSE_DOWN],byte 0 ; mouse down -> do not draw |
popa |
pop ebx |
popa |
/kernel/branches/kolibri_pe/gui/event.inc |
---|
507,12 → 507,12 |
.sendkey: |
pushf |
cli |
movzx eax, byte [KEY_COUNT] |
cmp al, 120 |
mov eax, [KEY_COUNT] |
cmp eax, 120 |
jae .overflow |
inc eax |
mov [KEY_COUNT], al |
mov [KEY_COUNT+eax], cl |
mov [KEY_COUNT], eax |
mov [KEY_BUFF+eax-1], cl |
jmp .ok |
.overflow: |
popf |
521,9 → 521,9 |
.sendbtn: |
pushf |
cli |
cmp byte [BTN_COUNT], 0 |
cmp [BTN_COUNT], 0 |
jnz .overflow |
mov byte [BTN_COUNT], 1 |
mov [BTN_COUNT], 1 |
mov [BTN_BUFF], ecx |
.ok: |
popf |
554,7 → 554,7 |
mov eax, [TASK_COUNT] |
cmp eax,edx |
jne no_eventoccur2x |
cmp [KEY_COUNT],byte 0 |
cmp [KEY_COUNT], 0 |
je no_eventoccur2x |
eventoccur2: |
popad |
573,7 → 573,7 |
;mov edi,[TASK_BASE] ; BUTTON IN BUFFER |
test [edi+TASKDATA.event_mask],dword 4 |
jz no_eventoccur3 |
cmp [BTN_COUNT],byte 0 |
cmp [BTN_COUNT], 0 |
je no_eventoccur3 |
mov ecx, [CURRENT_TASK] |
movzx edx, word [WIN_STACK+ecx*2] |
589,7 → 589,7 |
no_event_1: |
mov [window_minimize],1 |
mov [BTN_COUNT],byte 0 |
mov [BTN_COUNT], 0 |
xor eax, eax |
ret |
613,7 → 613,7 |
;mov edi,[TASK_BASE] ; DESKTOP BACKGROUND REDRAW |
test [edi+TASKDATA.event_mask], 16 |
jz no_eventoccur5 |
; cmp [REDRAW_BACKGROUND],byte 2 |
; cmp [redraw_background], 2 |
; jnz no_eventoccur5 |
test [eax+APPDATA.event_mask], 16 |
jz no_eventoccur5 |
/kernel/branches/kolibri_pe/gui/skincode.inc |
---|
379,7 → 379,7 |
jne no_skin_add_button |
;* close button |
mov edi,[BTN_ADDR] |
mov edi,[btn_addr] |
movzx eax,word [edi] |
cmp eax,1000 |
jge no_skin_add_button |
418,7 → 418,7 |
mov [eax],bx |
;* minimize button |
mov edi,[BTN_ADDR] |
mov edi,[btn_addr] |
movzx eax,word [edi] |
cmp eax,1000 |
jge no_skin_add_button |
/kernel/branches/kolibri_pe/gui/window.inc |
---|
629,8 → 629,8 |
cmp [new_window_starting],eax |
jb swml1 |
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 [new_window_starting],eax |
957,10 → 957,10 |
mov [ebx*2 + WIN_POS], si |
jmp waloop2 |
wacont2: |
mov [KEY_COUNT], byte 0 ; empty keyboard buffer |
mov [BTN_COUNT], byte 0 ; empty button buffer |
mov [MOUSE_SCROLL_H], word 0 ; zero mouse z-index |
mov [MOUSE_SCROLL_V], word 0 ; zero mouse z-index |
mov [KEY_COUNT], 0 ; empty keyboard buffer |
mov [BTN_COUNT], 0 ; empty button buffer |
mov [mouse_scroll_h], 0 ; zero mouse z-index |
mov [mouse_scroll_v], 0 ; zero mouse z-index |
popad |
ret |
1056,7 → 1056,6 |
jz .do_not_draw |
popad |
mov [MOUSE_DOWN], byte 1 ; do draw mouse |
call windowactivate |
; update screen info |
1081,7 → 1080,6 |
popad |
mov [edi + WDATA.fl_redraw], 1 ; redraw flag for app |
mov [MOUSE_DOWN],byte 0 ; mouse down checks |
ret |
1090,9 → 1088,8 |
popad |
call windowactivate |
mov [MOUSE_DOWN],byte 0 ; mouse down checks |
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 |
ret |
1159,7 → 1156,7 |
add edx, [edi+WDATA.box.height] |
call calculatescreen |
.done: |
mov [MOUSE_BACKGROUND],byte 0 ; no mouse under |
mov [mouse_background], 0 ; no mouse under |
.skip_redrawings: |
popfd |
ret |
1189,7 → 1186,7 |
.continue: |
.no_minimizing: |
cmp [BTN_DOWN],byte 0 ; mouse buttons pressed ? |
cmp byte [btn_down], 0 ; mouse buttons pressed ? |
jne .mouse_buttons_pressed |
;..................................... start 1/4 : modified by vhanla ................. |
mov [bPressedMouseXY_W],0 |
1206,7 → 1203,7 |
inc esi |
;..................................... start 3/4 : modified by vhanla ................. |
push ax |
push eax |
cmp [bPressedMouseXY_W],0 |
jnz @f |
mov [bPressedMouseXY_W],1 |
1215,7 → 1212,7 |
mov ax,[MOUSE_Y] |
mov [my],ax |
@@: |
pop ax |
pop eax |
;..................................... end 3/4 : modified by vhanla ................... |
cwloop: |
1236,7 → 1233,7 |
jnz cwloop |
;..................................... start 4/4 : modified by vhanla ................. |
movzx eax, word [mx]; movzx eax,word[MOUSE_X] |
movzx eax, word [mx]; movzx eax,word[mouse_x] |
movzx ebx, word [my]; movzx ebx,word[MOUSE_Y] |
;..................................... endt 4/4 : modified by vhanla .................. |
cmp ecx, eax |
1321,7 → 1318,7 |
mov [latest_window_touch], ecx |
mov [latest_window_touch_delta], edx |
mov cl, [BTN_DOWN] ; save for shade check |
mov cl, byte [btn_down] ; save for shade check |
mov [do_resize], cl |
no_emulation_righ_button: |
mov ecx, [edi + WDATA.box.left] |
1341,7 → 1338,7 |
sub eax, ecx |
sub ebx, edx |
mov esi, [MOUSE_X] |
mov esi, dword [MOUSE_X] |
mov [WIN_TEMP_XY], esi |
pushad ; wait for putimages to finish |
1369,19 → 1366,18 |
call drawwindowframes |
mov [reposition],0 |
mov [MOUSE_DOWN],byte 1 ; no reaction to mouse up/down |
; move window |
newchm: |
mov [DONT_DRAW_MOUSE],byte 1 |
mov [dont_draw_mouse], 1 |
call checkidle |
call checkVga_N13 |
mov [MOUSE_BACKGROUND],byte 0 |
mov [mouse_background], 0 |
call [draw_pointer] |
1390,7 → 1386,7 |
popad |
mov esi,[WIN_TEMP_XY] |
cmp esi,[MOUSE_X] |
cmp esi, dword [MOUSE_X] |
je cwb |
mov cx,[MOUSE_X] |
1403,8 → 1399,8 |
call drawwindowframes |
mov ax,[Screen_Max_X] |
mov bx,[Screen_Max_Y] |
mov ax, word [Screen_Max_X] |
mov bx, word [Screen_Max_Y] |
cmp [do_resize_from_corner],1 |
je no_new_position |
1477,14 → 1473,14 |
pop ax |
call drawwindowframes |
mov esi,[MOUSE_X] |
mov esi, dword [MOUSE_X] |
mov [WIN_TEMP_XY],esi |
cwb: |
cmp [BTN_DOWN],byte 0 |
cmp byte [btn_down], 0 |
jne newchm |
; new position done |
mov [DONT_DRAW_MOUSE],byte 1 |
mov [dont_draw_mouse], 1 |
mov cl,0 |
test [edi+WDATA.fl_wstate],WSTATE_MAXIMIZED |
jnz @f |
1637,7 → 1633,7 |
cmp [reposition],0 |
je retwm |
mov [DONT_DRAW_MOUSE],byte 1 ; no mouse |
mov [dont_draw_mouse], 1 ; no mouse |
push eax ebx ecx edx |
1666,7 → 1662,7 |
mov ecx,100 ; wait to avoid mouse residuals |
waitre2: |
mov [DONT_DRAW_MOUSE],byte 1 |
mov [dont_draw_mouse], 1 |
call checkidle |
cmp [edi+WDATA.fl_redraw],0 |
jz retwm |
1674,9 → 1670,8 |
retwm: |
mov [DONT_DRAW_MOUSE],byte 0 ; mouse pointer |
mov [MOUSE_BACKGROUND],byte 0 ; no mouse under |
mov [MOUSE_DOWN],byte 0 ; react to mouse up/down |
mov [dont_draw_mouse], 0 ; mouse pointer |
mov [mouse_background], 0 ; no mouse under |
mov esi,window_moved |
call sys_msg_board_str |
/kernel/branches/kolibri_pe/hid/keyboard.inc |
---|
300,12 → 300,12 |
.scancode: |
mov bl, ch |
.dowrite: |
movzx eax,byte[KEY_COUNT] |
mov eax, [KEY_COUNT] |
cmp al,120 |
jae .exit.irq1 |
inc eax |
mov [KEY_COUNT],al |
mov [KEY_COUNT+eax],bl |
mov [KEY_COUNT], eax |
mov [KEY_BUFF+eax-1],bl |
.exit.irq1: |
mov [check_idle_semaphore],5 |
/kernel/branches/kolibri_pe/hid/mousedrv.inc |
---|
17,9 → 17,6 |
; FB22 y move |
; FB30 color temp |
; FB28 high bits temp |
; FB4A -> FB4D FB4A-B x-under - FB4C-D y-under |
; FC00 -> FCFE com1/ps2 buffer |
; FCFF com1/ps2 buffer count starting from FC00 |
uglobal |
mousecount dd 0x0 |
32,22 → 29,7 |
mouse_timer_ticks dd 0 |
endg |
;include 'm_com.inc' |
;test_mario79: |
; push esi |
; push eax |
; mov [write_error_to],process_test_m79+43 |
; movzx eax,al ;[DevErrorCode] |
; call writehex |
; mov esi,process_test_m79 |
; call sys_msg_board_str |
; pop eax |
; pop esi |
; ret |
;process_test_m79 db 'K : Process - test Mario79 error 00000000',13,10,0 |
align 4 |
draw_mouse_under: |
; return old picture |
54,8 → 36,8 |
cmp [set_hw_cursor], 0 |
jz @F |
pushad |
movzx eax,word [X_UNDER] |
movzx ebx,word [Y_UNDER] |
mov eax, [x_under] |
mov ebx, [y_under] |
stdcall [hw_restore], eax, ebx |
popad |
ret |
65,8 → 47,8 |
xor edx,edx |
align 4 |
mres: |
movzx eax,word [X_UNDER] |
movzx ebx,word [Y_UNDER] |
mov eax, [x_under] |
mov ebx, [y_under] |
add eax,ecx |
add ebx,edx |
push ecx |
101,8 → 83,8 |
je .no_hw_cursor |
pushad |
mov [X_UNDER],ax |
mov [Y_UNDER],bx |
mov [x_under], eax |
mov [y_under], ebx |
movzx eax,word [MOUSE_Y] |
movzx ebx,word [MOUSE_X] |
push eax |
139,8 → 121,8 |
.no_hw_cursor: |
pushad |
; save & draw |
mov [X_UNDER],ax |
mov [Y_UNDER],bx |
mov [x_under], eax |
mov [y_under], ebx |
push eax |
push ebx |
mov ecx,0 |
157,7 → 139,7 |
add ebx,edx |
push ecx |
call getpixel |
mov [COLOR_TEMP],ecx |
mov [color_temp],ecx |
pop ecx |
mov eax,edx |
shl eax,6 |
164,22 → 146,19 |
shl ecx,2 |
add eax,ecx |
add eax,mouseunder |
mov ebx,[COLOR_TEMP] |
mov ebx,[color_temp] |
mov [eax],ebx |
pop ecx |
mov edi,edx ; y cycle |
shl edi,4 ; *16 bytes per row |
add edi,ecx ; x cycle |
lea edi, [mousepointer+edi+edi*2] ; we have our str address |
mov esi, edi |
add edi, esi |
add edi, esi ; *3 |
add edi,[MOUSE_PICTURE] ; we have our str address |
mov esi, edi |
add esi, 16*24*3 |
push ecx |
mov ecx, [COLOR_TEMP] |
mov ecx, [color_temp] |
call combine_colors |
mov [MOUSE_COLOR_MEM], ecx |
mov [mouse_color_mem], ecx |
pop ecx |
pop edx |
pop ecx |
188,7 → 167,7 |
add eax,ecx ; we have x coord+cycle |
add ebx,edx ; and y coord+cycle |
push ecx |
mov ecx, [MOUSE_COLOR_MEM] |
mov ecx, [mouse_color_mem] |
mov edi, 1 |
call [putpixel] |
pop ecx |
276,7 → 255,7 |
__sys_disable_mouse: |
cmp dword [MOUSE_VISIBLE],dword 0 |
cmp [MOUSE_VISIBLE], 0 |
je @f |
ret |
@@: |
334,13 → 313,13 |
cmp ebx,ecx |
jg no_mouse_disable |
disable_m: |
cmp dword [MOUSE_VISIBLE],dword 0 |
cmp [MOUSE_VISIBLE], 0 |
jne no_mouse_disable |
pushf |
cli |
call draw_mouse_under |
popf |
mov [MOUSE_VISIBLE],dword 1 |
mov [MOUSE_VISIBLE], 1 |
no_mouse_disable: |
popad |
ret |
362,9 → 341,9 |
mov [MouseTickCounter],eax |
pop eax |
pushad |
cmp dword [MOUSE_VISIBLE],dword 0 ; mouse visible ? |
cmp [MOUSE_VISIBLE], 0 ; mouse visible ? |
je chms00 |
mov [MOUSE_VISIBLE], dword 0 |
mov [MOUSE_VISIBLE], 0 |
movzx ebx,word [MOUSE_Y] |
movzx eax,word [MOUSE_X] |
pushfd |
375,8 → 354,8 |
popad |
ret |
chms00: |
movzx ecx,word [X_UNDER] |
movzx edx,word [Y_UNDER] |
mov ecx, [x_under] |
mov edx, [y_under] |
movzx ebx,word [MOUSE_Y] |
movzx eax,word [MOUSE_X] |
cmp eax,ecx |
397,7 → 376,7 |
proc set_mouse_data stdcall, BtnState:dword, XMoving:dword, YMoving:dword, VScroll:dword, HScroll:dword |
mov eax,[BtnState] |
mov [BTN_DOWN],eax |
mov [btn_down],eax |
mov eax,[XMoving] |
call mouse_acceleration |
407,9 → 386,9 |
mov eax,0 |
jmp @@M2 |
@@M1: |
cmp ax,[Screen_Max_X] ;ScreenLength |
cmp ax, word [Screen_Max_X] ;ScreenLength |
jl @@M2 |
mov ax,[Screen_Max_X] ;ScreenLength-1 |
mov ax, word [Screen_Max_X] ;ScreenLength-1 |
@@M2: |
mov [MOUSE_X],ax ;[XCoordinate] |
424,18 → 403,18 |
mov ax,0 |
jmp @@M4 |
@@M3: |
cmp ax,[Screen_Max_Y] ;ScreenHeigth |
cmp ax, word [Screen_Max_Y] ;ScreenHeigth |
jl @@M4 |
mov ax,[Screen_Max_Y] ;ScreenHeigth-1 |
mov ax, word [Screen_Max_Y] ;ScreenHeigth-1 |
@@M4: |
mov [MOUSE_Y],ax ;[YCoordinate] |
mov eax,[VScroll] |
add [MOUSE_SCROLL_V],ax |
add [mouse_scroll_v], eax |
mov eax,[HScroll] |
add [MOUSE_SCROLL_H],ax |
add [mouse_scroll_h], eax |
mov [mouse_active],1 |
mov eax,[timer_ticks] |
/kernel/branches/kolibri_pe/include/core.h |
---|
4,10 → 4,22 |
#define LOAD_BASE 0x00100000 |
#define page_tabs 0xDF800000 |
#define page_tabs 0xDDC00000 |
#define master_tab (page_tabs+(page_tabs>>10)) |
#define sel_tss 0x08 |
#define sel_os_stack 0x10 |
#define sel_os_code 0x18 |
#define sel_app_code 0x23 |
#define sel_app_data 0x2B |
#define sel_srv_code 0x31 |
#define sel_srv_stack 0x39 |
void printf (const char *format, ...); |
#define CALLER ((addr_t) __builtin_return_address(0)) |
53,8 → 65,7 |
"pushfl\n\t" |
"popl %0\n\t" |
"cli\n" |
: "=r" (tmp) |
); |
: "=r" (tmp)); |
return tmp; |
} |
70,11 → 81,10 |
static inline count_t fnzb(u32_t arg) |
{ |
count_t n; |
asm volatile ("xorl %0, %0 \n\t" |
asm volatile ( |
"xorl %0, %0 \n\t" |
"bsr %1, %0" |
:"=&r" (n) |
:"r"(arg) |
); |
:"=&r"(n) :"r"(arg) ); |
return n; |
} |
81,30 → 91,25 |
static inline count_t _bsf(u32_t arg) |
{ |
count_t n; |
asm volatile ("xorl %0, %0 \n\t" |
asm volatile ( |
"xorl %0, %0 \n\t" |
"bsf %1, %0" |
:"=&r" (n) |
:"r"(arg) |
); |
:"=&r" (n) :"r"(arg)); |
return n; |
} |
static inline void _bts(u32_t *data, count_t val) |
{ |
asm volatile ("bts %0, %1 \n\t" |
: |
:"g"(data), "r"(val) |
:"cc" |
); |
asm volatile ( |
"bts %0, %1 \n\t" |
::"g"(data), "r"(val):"cc"); |
} |
extern inline void _btr(u32_t *data, count_t val) |
{ |
asm volatile ("btr %0, %1 \n\t" |
: |
:"g"(data), "r"(val) |
:"cc" |
); |
asm volatile ( |
"btr %0, %1 \n\t" |
::"g"(data), "r"(val):"cc"); |
} |
extern inline void* load_file(const char *path, size_t *size) |
124,4 → 129,63 |
}; |
/* reemain part |
saved_box BOX |
ipc_start dd ? |
ipc_size dd ? |
event_mask dd ? |
debugger_slot dd ? |
dd ? |
keyboard_mode db ? |
db 3 dup(?) |
dir_table dd ? |
dbg_event_mem dd ? |
dbg_regs: |
dbg_regs.dr0 dd ? |
dbg_regs.dr1 dd ? |
dbg_regs.dr2 dd ? |
dbg_regs.dr3 dd ? |
dbg_regs.dr7 dd ? |
wnd_caption dd ? |
wnd_clientbox BOX |
*/ |
//extern __fastcall void* load_file(const char *path, size_t *size); |
typedef struct |
{ |
u32_t edi; |
u32_t esi; |
u32_t ebp; |
u32_t tmp; // esp |
u32_t ebx; |
u32_t edx; |
u32_t ecx; |
u32_t eax; |
addr_t retaddr; |
addr_t eip; |
u32_t cs; |
u32_t eflags; |
addr_t esp; |
u32_t ss; // 14*4 |
u32_t tid; // thread id |
u32_t slot; // thread slot |
addr_t pdir; // |
u32_t thr_flags; // process is runnable only if zero |
int ticks_left; // number of scheduling ticks left */ |
int quantum_size; // quantum size in ticks */ |
u32_t user_time; // user time in ticks |
u32_t sys_time; // sys time in ticks |
}thr_t; |
#define EFL_IF 0x0200 |
#define EFL_IOPL1 0x1000 |
#define EFL_IOPL2 0x2000 |
#define EFL_IOPL3 0x3000 |
/kernel/branches/kolibri_pe/kernel.asm |
---|
73,17 → 73,24 |
max_processes equ 255 |
tss_step equ (128+8192) ; tss & i/o - 65535 ports, * 256=557056*4 |
sel_tss equ (tss_l - _gdts) ;0x08 |
os_stack equ (os_data_l-_gdts) ; GDTs |
os_code equ (os_code_l-_gdts) |
graph_data equ (3+graph_data_l-_gdts) |
tss0 equ (tss0_l-_gdts) |
app_code equ (3+app_code_l-_gdts) |
app_data equ (3+app_data_l-_gdts) |
pci_code_sel equ (pci_code_32-_gdts) |
pci_data_sel equ (pci_data_32-_gdts) |
sel_os_code equ (os_code_l - _gdts) ;0x10 |
sel_os_stack equ (os_stacK_l - _gdts) ;0x18 |
sel_app_code equ (app_code_l - _gdts +3) ;0x23 |
sel_app_data equ (app_data_l - _gdts +3) ;0x2B |
sel_srv_code equ (srv_code_l - _gdts +1) ;0x31 |
sel_srv_stack equ (srv_stack_l- _gdts +1) ;0x39 |
sel_pci_code equ (pci_code_32-_gdts) ;0x40 |
sel_pci_data equ (pci_data_32-_gdts) ;0x48 |
sel_graph_data equ (graph_data_l-_gdts +3) |
sel_code_16 equ (code_16_l - _gdts) |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
;; |
;; Included files: |
108,11 → 115,9 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
public __os_stack |
public _boot_mbi |
public _sys_pdbr |
public _gdts |
public _high_code |
public __hlt |
public _panic_printf |
121,7 → 126,7 |
public _mem_amount |
public @balloc@4 |
public __setvars |
public system_init |
public _rd_base |
public _rd_fat |
130,6 → 135,8 |
public _rd_root_end |
public _current_slot |
public _current_thread |
public _k_reenter |
public _load_file@4 |
141,6 → 148,7 |
public user_alloc |
public user_free |
public _strncmp@12 |
public _LoadFile ; stdcall export |
163,7 → 171,6 |
public _SysMsgBoardStr ; export |
public _SetScreen ; export FIXME make fastcall |
public _PciApi ; export |
public _PciRead8 ; stdcall export |
public _PciRead16 ; stdcall export |
172,26 → 179,36 |
public _PciWrite16 ; stdcall export |
public _PciWrite32 ; stdcall export |
public _SelectHwCursor ; stdcall export |
public _SetHwCursor ; stdcall export |
public _HwCursorRestore ; export |
public _HwCursorCreate ; export |
public init_idt |
public init_fpu |
public init_malloc |
public init_mtrr |
public sysenter_entry |
public syscall_entry |
public scr_mode |
public LFBAddress |
public LFBSize |
extrn __edata |
extrn __os_stack |
extrn _pg_balloc |
extrn _16bit_start |
extrn _16bit_end |
extrn _enter_bootscreen |
extrn _poweroff |
extrn _init |
extrn _init_mm |
extrn @init_heap@8 |
extrn _init_core_dll |
extrn @core_alloc@4 |
extrn @core_free@4 |
203,12 → 220,12 |
@mem_alloc@8 equ _MemAlloc |
@mem_free@4 equ _MemFree |
extrn @create_systhread@4 |
extrn _sys_exec |
;extrn @load_pe@4 |
extrn @load_pe_driver@4 |
extrn _slab_cache_init |
extrn _alloc_page |
extrn _get_free_mem |
217,6 → 234,17 |
extrn _sys_app_entry |
extrn _i40 |
extrn test_cpu |
extrn cpu_vendor |
extrn cpu_sign |
extrn cpu_info |
extrn cpu_caps:dword |
section '.flat' code readable align 4096 |
use32 |
261,211 → 289,10 |
align 4 |
include 'printf.inc' |
align 4 |
proc test_cpu |
locals |
cpu_type dd ? |
cpu_id dd ? |
cpu_Intel dd ? |
cpu_AMD dd ? |
endl |
; --------------- APM --------------------- |
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 |
align 4 |
_copy_pg_balloc dd 0 |
_high_code: |
mov ax,os_stack |
mov dx,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 _init |
mov eax, [_pg_balloc] |
mov [_copy_pg_balloc], eax |
mov [tss._ss0], os_stack |
mov [tss._esp0], __os_stack |
mov [tss._esp], __os_stack |
mov [tss._cs],os_code |
mov [tss._ss],os_stack |
mov [tss._ds],app_data |
mov [tss._es],app_data |
mov [tss._fs],app_data |
mov [tss._gs],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,tss0 |
ltr ax |
__core_restart: |
mov ecx, 1280*1024 |
fastcall _balloc |
mov [_display_data], eax |
mov ecx, (unpack.LZMA_BASE_SIZE+(unpack.LZMA_LIT_SIZE shl \ |
(unpack.lc+unpack.lp)))*4 |
fastcall _balloc |
mov [unpack.p], eax |
; MEMORY MODEL |
call _init_mm |
mov [pg_data.pg_mutex], 0 |
call _slab_cache_init |
mov ecx, 0x80000000 |
mov edx, 0x40000000 |
call @init_heap@8 |
call _init_core_dll |
mov esi, _16bit_start |
mov ecx, _16bit_end |
shr ecx, 2 |
mov edi, _16BIT_BASE |
cld |
rep movsd |
jmp far 0x60:_enter_bootscreen; |
align 4 |
__setvars: |
mov ax,os_stack |
mov dx,app_data |
mov ss,ax |
mov esp, __os_stack |
mov ds, dx |
mov es, dx |
mov fs, dx |
mov gs, dx |
; 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 |
mov eax, cr3 |
mov cr3, eax |
; SAVE REAL MODE VARIABLES |
mov ax, [BOOT_VAR + 0x9031] |
mov [IDEContrRegsBaseAddr], ax |
; --------------- APM --------------------- |
init_apm: |
; init selectors |
mov ebx, [BOOT_VAR +0x9040] ; offset of APM entry point |
movzx eax, word [BOOT_VAR+0x9050] ; real-mode segment base address of |
495,14 → 322,25 |
mov eax, [BOOT_VAR + 0x9044] ; version & flags |
mov [apm_vf], eax |
; ----------------------------------------- |
; movzx eax,byte [BOOT_VAR+0x9010] ; mouse port |
; mov [0xF604],byte 1 ;al |
ret |
align 16 |
system_init: |
mov [pg_data.pg_mutex], 0 |
call init_apm |
; SAVE REAL MODE VARIABLES |
mov ax, [BOOT_VAR + 0x9031] |
mov [IDEContrRegsBaseAddr], ax |
mov al, [BOOT_VAR+0x901F] ; DMA access |
mov [allow_dma_access], al |
mov al,[BOOT_VAR+0x9000] ; bpp |
mov [ScreenBPP],al |
movzx eax, byte [BOOT_VAR+0x9000] ; bpp |
mov [ScreenBPP], eax |
movzx eax,word [BOOT_VAR+0x900A] ; X max |
dec eax |
mov [Screen_Max_X],eax |
511,18 → 349,14 |
dec eax |
mov [Screen_Max_Y],eax |
mov [screen_workarea.bottom],eax |
movzx eax,word [BOOT_VAR+0x9008] ; screen mode |
mov [SCR_MODE],eax |
mov eax,[BOOT_VAR+0x9014] ; Vesa 1.2 bnk sw add |
mov [BANK_SWITCH],eax |
mov [BytesPerScanLine],word 640*4 ; Bytes PerScanLine |
cmp [SCR_MODE],word 0x13 ; 320x200 |
mov [BytesPerScanLine], 640*4 |
cmp [scr_mode], 0x13 ; 320x200 |
je @f |
cmp [SCR_MODE],word 0x12 ; VGA 640x480 |
cmp [scr_mode], 0x12 ; VGA 640x480 |
je @f |
mov ax,[BOOT_VAR+0x9001] ; for other modes |
mov [BytesPerScanLine],ax |
movzx eax, word [BOOT_VAR+0x9001] ; for other modes |
mov [BytesPerScanLine], eax |
@@: |
mov esi, BOOT_VAR+0x9080 |
movzx ecx, byte [esi-1] |
533,88 → 367,53 |
; GRAPHICS ADDRESSES |
mov byte [BOOT_VAR+0x901e],0x0 |
mov eax,[BOOT_VAR+0x9018] |
mov [LFBAddress],eax |
cmp [SCR_MODE],word 0100000000000000b |
cmp [scr_mode], 0100000000000000b |
jge setvesa20 |
cmp [SCR_MODE],word 0x13 |
cmp [scr_mode], 0x13 |
je v20ga32 |
mov [PUTPIXEL],dword Vesa12_putpixel24 ; Vesa 1.2 |
mov [GETPIXEL],dword Vesa12_getpixel24 |
cmp [ScreenBPP],byte 24 |
mov [put_pixel], Vesa12_putpixel24 ; Vesa 1.2 |
mov [get_pixel],dword Vesa12_getpixel24 |
cmp byte [ScreenBPP], 24 |
jz ga24 |
mov [PUTPIXEL],dword Vesa12_putpixel32 |
mov [GETPIXEL],dword Vesa12_getpixel32 |
mov [put_pixel], Vesa12_putpixel32 |
mov [get_pixel],dword Vesa12_getpixel32 |
ga24: |
jmp v20ga24 |
setvesa20: |
mov [PUTPIXEL],dword Vesa20_putpixel24 ; Vesa 2.0 |
mov [GETPIXEL],dword Vesa20_getpixel24 |
cmp [ScreenBPP],byte 24 |
mov [put_pixel], Vesa20_putpixel24 ; Vesa 2.0 |
mov [get_pixel],dword Vesa20_getpixel24 |
cmp byte [ScreenBPP], 24 |
jz v20ga24 |
v20ga32: |
mov [PUTPIXEL],dword Vesa20_putpixel32 |
mov [GETPIXEL],dword Vesa20_getpixel32 |
mov [put_pixel], Vesa20_putpixel32 |
mov [get_pixel],dword Vesa20_getpixel32 |
v20ga24: |
cmp [SCR_MODE],word 0x12 ; 16 C VGA 640x480 |
cmp [scr_mode], 0x12 ; 16 C VGA 640x480 |
jne no_mode_0x12 |
mov [PUTPIXEL],dword VGA_putpixel |
mov [GETPIXEL],dword Vesa20_getpixel32 |
mov [put_pixel], VGA_putpixel |
mov [get_pixel],dword Vesa20_getpixel32 |
no_mode_0x12: |
; -------- 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, 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 |
mov ecx, 1280*1024 |
mov edx, PG_SW |
call @mem_alloc@8 |
mov [_display_data], eax |
; !!!! It`s dirty hack, fix it !!! |
; 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 ecx, (unpack.LZMA_BASE_SIZE+(unpack.LZMA_LIT_SIZE shl \ |
(unpack.lc+unpack.lp)))*4 |
mov edx, PG_SW |
call @mem_alloc@8 |
mov [unpack.p], eax |
; mov edx, (os_code + 16) * 65536 + os_code |
mov edx, 0x1B0008 |
;Set base of graphic segment to linear address of LFB |
mov eax, syscall_entry |
mov ecx, MSR_AMD_STAR |
wrmsr |
.noSYSCALL: |
; ----------------------------------------- |
; LOAD IDT |
mov eax, LFB_BASE |
mov [graph_data_l+2],ax |
shr eax,16 |
mov [graph_data_l+4],al |
mov [graph_data_l+7],ah |
call _init_idt |
mov [LFBSize], 0x800000 |
call init_LFB |
call init_fpu |
call init_malloc |
mov ecx, 0x51000 |
xor edx, edx |
call @mem_alloc@8 |
655,13 → 454,6 |
mov ecx, 16 |
rep stosd |
;Set base of graphic segment to linear address of LFB |
mov eax,[LFBAddress] ; set for gs |
mov [graph_data_l+2],ax |
shr eax,16 |
mov [graph_data_l+4],al |
mov [graph_data_l+7],ah |
mov [CURRENT_TASK],dword 1 |
mov [TASK_COUNT],dword 1 |
mov [TASK_BASE],dword TASK_DATA |
869,11 → 661,6 |
stdcall load_driver, szPS2MDriver |
; stdcall load_driver, szCOM_MDriver |
mov esi,boot_setmouse |
call boot_log |
call setmouse |
; STACK AND FDC |
call stack_init |
881,7 → 668,7 |
; PALETTE FOR 320x200 and 640x480 16 col |
cmp [SCR_MODE],word 0x12 |
cmp [scr_mode], 0x12 |
jne no_pal_vga |
mov esi,boot_pal_vga |
call boot_log |
888,7 → 675,7 |
call paletteVGA |
no_pal_vga: |
cmp [SCR_MODE],word 0x13 |
cmp [scr_mode], 0x13 |
jne no_pal_ega |
mov esi,boot_pal_ega |
call boot_log |
919,7 → 706,6 |
; LOAD FIRST APPLICATION |
push 0 |
push 0 |
push read_firstapp |
973,8 → 759,6 |
; jne .bll1 |
;end if |
; mov [ENABLE_TASKSWITCH],byte 1 ; multitasking enabled |
; UNMASK ALL IRQ'S |
mov esi,boot_allirqs |
1195,13 → 979,13 |
set_variables: |
mov ecx,0x100 ; flush port 0x60 |
.fl60: in al,0x60 |
.fl60: |
in al,0x60 |
loop .fl60 |
mov [MOUSE_BUFF_COUNT],byte 0 ; mouse buffer |
mov [KEY_COUNT],byte 0 ; keyboard buffer |
mov [BTN_COUNT],byte 0 ; button buffer |
; mov [MOUSE_X],dword 100*65536+100 ; mouse x/y |
mov [KEY_COUNT], 0 ; keyboard buffer |
mov [BTN_COUNT], 0 ; button buffer |
push eax |
mov ax,[BOOT_VAR+0x900c] |
shr ax,1 |
1208,14 → 992,14 |
shl eax,16 |
mov ax,[BOOT_VAR+0x900A] |
shr ax,1 |
mov [MOUSE_X],eax |
mov dword [MOUSE_X], eax |
pop eax |
mov [BTN_ADDR],dword BUTTON_INFO ; address of button list |
mov [btn_addr], BUTTON_INFO ; address of button list |
;!! IP 04.02.2005: |
mov [next_usage_update], 100 |
mov byte [DONT_SWITCH], 0 ; change task if possible |
mov [dont_switch], 0 ; change task if possible |
ret |
1801,13 → 1585,13 |
ja msset |
jmp [mousefn+eax*4] |
msscreen: |
mov eax,[MOUSE_X] |
mov eax, dword [MOUSE_X] |
shl eax,16 |
mov ax,[MOUSE_Y] |
mov [esp+36],eax |
ret |
mswin: |
mov eax,[MOUSE_X] |
mov eax, dword [MOUSE_X] |
shl eax,16 |
mov ax,[MOUSE_Y] |
mov esi,[TASK_BASE] |
1825,7 → 1609,7 |
mov [esp+36],eax |
ret |
msbutton: |
movzx eax,byte [BTN_DOWN] |
movzx eax,byte [btn_down] |
mov [esp+36],eax |
ret |
msz: |
1833,12 → 1617,12 |
movzx edi, word [WIN_POS + edi*2] |
cmp edi, [CURRENT_TASK] |
jne @f |
mov ax,[MOUSE_SCROLL_H] |
mov eax,[mouse_scroll_h] |
shl eax,16 |
mov ax,[MOUSE_SCROLL_V] |
mov ax, word [mouse_scroll_v] |
mov [esp+36],eax |
mov [MOUSE_SCROLL_H],word 0 |
mov [MOUSE_SCROLL_V],word 0 |
mov [mouse_scroll_h], 0 |
mov [mouse_scroll_v], 0 |
ret |
@@: |
mov [esp+36],dword 0 |
2018,7 → 1802,7 |
mov [BOOT_VAR+0x9030],cl |
mov eax,[TASK_COUNT] |
mov [SYS_SHUTDOWN],al |
mov [sys_shutdown], eax |
mov [shutdown_processes],eax |
and dword [esp+32], 0 |
exit_for_anyone: |
2221,7 → 2005,7 |
.set_mouse_button: |
cmp ecx,5 ; set mouse button features |
jnz .end |
mov [BTN_DOWN],dl |
mov byte [btn_down],dl |
mov [mouse_active],1 |
.end: |
ret |
2408,7 → 2192,7 |
; mov [bgrchanged],1 ;0 |
mov [background_defined], 1 |
call force_redraw_background |
mov [REDRAW_BACKGROUND], byte 2 |
mov [redraw_background], 2 |
nosb31: |
ret |
nosb3: |
2522,7 → 2306,7 |
mov [draw_data+32 + RECT.right],eax |
mov [draw_data+32 + RECT.bottom],ebx |
pop ebx eax |
mov byte [REDRAW_BACKGROUND], 1 |
mov [redraw_background], 1 |
ret |
align 4 |
2577,14 → 2361,14 |
mov edx, [TASK_COUNT] |
cmp ecx, edx |
jne .finish |
cmp [KEY_COUNT], byte 0 |
cmp [KEY_COUNT], 0 |
je .finish |
movzx eax, byte [KEY_BUFF] |
shl eax, 8 |
push eax |
dec byte [KEY_COUNT] |
and byte [KEY_COUNT], 127 |
movzx ecx, byte [KEY_COUNT] |
dec [KEY_COUNT] |
and [KEY_COUNT], 127 |
mov ecx, [KEY_COUNT] |
add ecx, 2 |
mov eax, KEY_BUFF + 1 |
mov ebx, KEY_BUFF |
2622,7 → 2406,7 |
mov edx, [TASK_COUNT] ; less than 256 processes |
cmp ecx, edx |
jne .exit |
movzx eax, byte [BTN_COUNT] |
mov eax, [BTN_COUNT] |
test eax, eax |
jz .exit |
mov eax, [BTN_BUFF] |
2631,7 → 2415,7 |
mov al, byte [btn_down_determ] |
and al,0xFE ; delete left button bit |
; } \\ Alver \\ |
mov [BTN_COUNT], byte 0 |
mov [BTN_COUNT], 0 |
mov [esp + 32], eax |
.exit: |
ret |
2810,7 → 2594,7 |
; buttons away |
mov ecx,[CURRENT_TASK] |
sys_newba2: |
mov edi,[BTN_ADDR] |
mov edi,[btn_addr] |
cmp [edi], dword 0 ; empty button list ? |
je end_of_buttons_away |
movzx ebx, word [edi] |
3187,8 → 2971,8 |
add edx, ebx |
call calculatescreen |
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 |
newd: |
mov [edi+WDATA.fl_redraw],byte 0 ; no redraw |
3316,9 → 3100,8 |
xor esi,esi |
call redrawscreen |
mov [DONT_DRAW_MOUSE],byte 0 ; mouse pointer |
mov [MOUSE_BACKGROUND],byte 0 ; no mouse under |
mov [MOUSE_DOWN],byte 0 ; react to mouse up/down |
mov [dont_draw_mouse], 0 ; mouse pointer |
mov [mouse_background], 0 ; no mouse under |
call [draw_pointer] |
3510,11 → 3293,11 |
loop set_mouse_event |
mouse_not_active: |
cmp [REDRAW_BACKGROUND],byte 0 ; background update ? |
cmp [redraw_background], 0 ; background update ? |
jz nobackgr |
cmp [background_defined], 0 |
jz nobackgr |
cmp [REDRAW_BACKGROUND], byte 2 |
cmp [redraw_background], 2 |
jnz no_set_bgr_event |
xor edi, edi |
mov ecx, [TASK_COUNT] |
3530,19 → 3313,19 |
; mov [draw_data+32 + RECT.right],eax |
; mov [draw_data+32 + RECT.bottom],ebx |
call drawbackground |
mov [REDRAW_BACKGROUND],byte 0 |
mov [MOUSE_BACKGROUND],byte 0 |
mov [redraw_background], 0 |
mov [redraw_background], 0 |
nobackgr: |
; system shutdown request |
cmp [SYS_SHUTDOWN],byte 0 |
cmp [sys_shutdown], 0 |
je noshutdown |
mov edx,[shutdown_processes] |
cmp [SYS_SHUTDOWN],dl |
cmp [sys_shutdown], edx |
jne no_mark_system_shutdown |
lea ecx,[edx-1] |
3558,7 → 3341,7 |
call [disable_mouse] |
dec byte [SYS_SHUTDOWN] |
dec [sys_shutdown] |
je system_shutdown |
noshutdown: |
3646,7 → 3429,7 |
cmp ecx,1 |
jnz .az |
mov al,[REDRAW_BACKGROUND] |
mov al, byte [redraw_background] |
cmp al,2 |
jz newdw8 |
test al,al |
3691,7 → 3474,7 |
cmp dword [esp],1 |
jne nobgrd |
mov byte [REDRAW_BACKGROUND], 1 |
mov [redraw_background], 1 |
newdw8: |
nobgrd: |
3727,7 → 3510,7 |
mov ecx,1280*1024 / 4 |
rep stosd |
mov byte [REDRAW_BACKGROUND], 0 ; do not draw background! |
mov [redraw_background], 0 ; do not draw background! |
ret |
4229,12 → 4012,12 |
drawbackground: |
inc [mouse_pause] |
cmp [SCR_MODE],word 0x12 |
cmp [scr_mode], 0x12 |
je dbrv20 |
dbrv12: |
cmp [SCR_MODE],word 0100000000000000b |
cmp [scr_mode], 0100000000000000b |
jge dbrv20 |
cmp [SCR_MODE],word 0x13 |
cmp [scr_mode], 0x13 |
je dbrv20 |
call vesa12_drawbackground |
dec [mouse_pause] |
4278,12 → 4061,12 |
sys_putimage_bpp: |
; call [disable_mouse] ; this will be done in xxx_putimage |
; mov eax, vga_putimage |
cmp [SCR_MODE], word 0x12 |
cmp [scr_mode], 0x12 |
jz @f ;.doit |
mov eax, vesa12_putimage |
cmp [SCR_MODE], word 0100000000000000b |
cmp [scr_mode], 0100000000000000b |
jae @f |
cmp [SCR_MODE], word 0x13 |
cmp [scr_mode], 0x13 |
jnz .doit |
@@: |
mov eax, vesa20_putimage |
4527,12 → 4310,12 |
.forced: |
inc [mouse_pause] |
; call [disable_mouse] |
cmp [SCR_MODE],word 0x12 |
cmp [scr_mode], 0x12 |
je dbv20 |
sdbv20: |
cmp [SCR_MODE],word 0100000000000000b |
cmp [scr_mode], 0100000000000000b |
jge dbv20 |
cmp [SCR_MODE],word 0x13 |
cmp [scr_mode], 0x13 |
je dbv20 |
call vesa12_drawbar |
dec [mouse_pause] |
4654,16 → 4437,6 |
ret |
setmouse: ; set mousepicture -pointer |
; ps2 mouse enable |
mov [MOUSE_PICTURE],dword mousepointer |
cli |
ret |
_rdtsc: |
bt [cpu_caps], CAPS_TSC |
jnc ret_rdtsc |
4678,56 → 4451,31 |
mov al,0x11 ; icw4, edge triggered |
out 0x20,al |
call pic_delay |
out 0xA0,al |
call pic_delay |
mov al,0x20 ; generate 0x20 + |
out 0x21,al |
call pic_delay |
mov al,0x28 ; generate 0x28 + |
out 0xA1,al |
call pic_delay |
mov al,0x04 ; slave at irq2 |
out 0x21,al |
call pic_delay |
mov al,0x02 ; at irq9 |
out 0xA1,al |
call pic_delay |
mov al,0x01 ; 8086 mode |
out 0x21,al |
call pic_delay |
out 0xA1,al |
call pic_delay |
mov al,255 ; mask all irq's |
out 0xA1,al |
call pic_delay |
out 0x21,al |
call pic_delay |
mov ecx,0x1000 |
cld |
picl1: call pic_delay |
loop picl1 |
mov al,255 ; mask all irq's |
out 0xA1,al |
call pic_delay |
out 0x21,al |
call pic_delay |
ret |
pic_delay: |
jmp pdl1 |
pdl1: ret |
align 4 |
_SysMsgBoardStr: |
sys_msg_board_str: |
4953,7 → 4701,7 |
jne no_gs1 |
mov eax,[Screen_Max_X] |
shl eax,16 |
mov ax,[Screen_Max_Y] |
mov ax, word [Screen_Max_Y] |
add eax,0x00010001 |
mov [esp+36],eax |
ret |
4961,7 → 4709,7 |
cmp eax,2 ; bits per pixel |
jne no_gs2 |
movzx eax,byte [ScreenBPP] |
mov eax, [ScreenBPP] |
mov [esp+36],eax |
ret |
no_gs2: |
5065,9 → 4813,9 |
align 4 |
syscall_getscreensize: ; GetScreenSize |
mov ax, [Screen_Max_X] |
mov eax, [Screen_Max_X] |
shl eax, 16 |
mov ax, [Screen_Max_Y] |
mov ax, word [Screen_Max_Y] |
mov [esp + 32], eax |
ret |
5139,7 → 4887,7 |
div ecx |
mov ebx, edx |
xchg eax, ebx |
call dword [GETPIXEL] ; eax - x, ebx - y |
call dword [get_pixel] ; eax - x, ebx - y |
mov [esp + 32], ecx |
ret |
5381,13 → 5129,14 |
mov eax, _sys_pdbr + (0x100000000-OS_BASE) |
mov cr3, eax |
jmp far 0x60:_poweroff; |
jmp far sel_code_16:_poweroff; |
align 4 |
_sys_restart: |
mov ax,os_stack |
mov dx,app_data |
mov ax, sel_os_stack |
mov dx, sel_app_data |
mov ss,ax |
mov esp, __os_stack |
5404,7 → 5153,7 |
mov ecx,0x10000/4 |
rep movsd |
mov eax, [_copy_pg_balloc] |
; mov eax, [_copy_pg_balloc] |
mov [_pg_balloc], eax |
mov dword [_sys_pdbr], PG_LARGE+PG_SW |
/kernel/branches/kolibri_pe/ld.x |
---|
16,11 → 16,17 |
. = ALIGN(4096); |
} |
.flat . + 0xE0000000: |
.text . + 0xDFC00000: |
{ |
*(.flat) *(.text) *(.rdata) *(.data) |
*(.text) *(.rdata) |
. = ALIGN(4096); |
} |
.flat . + 0x00400000: |
{ |
*(.flat) *(.data) |
} |
.edata ALIGN(32): |
{ |
*(.edata) |
/kernel/branches/kolibri_pe/makefile |
---|
28,7 → 28,8 |
PE_SRC:= \ |
init.c \ |
init.asm \ |
mbi.c \ |
mm.c \ |
slab.c \ |
heap.c \ |
35,6 → 36,8 |
pe.c \ |
dll.c \ |
spinlock.c \ |
thread.c \ |
syscall.asm \ |
boot/boot.asm \ |
boot/start.asm |
64,6 → 67,9 |
bin/%.obj : core/%.c $(H_SRC) Makefile |
$(CC) $(CFLAGS) -o $@ $< |
bin/%.obj: core/%.asm Makefile |
$(FASM) $< $@ |
bin/%.obj: %.asm |
$(FASM) $< $@ |
/kernel/branches/kolibri_pe/video/cursors.inc |
---|
453,13 → 453,13 |
align 4 |
proc init_cursors |
cmp [SCR_MODE],word 0x13 |
cmp [scr_mode], 0x13 |
jbe .fail |
test word [SCR_MODE], 0x4000 |
test [scr_mode], 0x4000 |
jz .fail |
movzx eax, byte [ScreenBPP] |
mov eax, [ScreenBPP] |
mov ebx, [BytesPerScanLine] |
cmp eax, 32 |
jne @F |
493,7 → 493,7 |
mov [scr_width], ecx |
mov [scr_height], edx |
movzx ebx, byte [ScreenBPP] |
mov ebx, [ScreenBPP] |
cmp ebx, 32 |
jne @F |
598,8 → 598,7 |
mov [_dy], edi |
mul ebx |
lea esi, [ecx+ecx*2] |
add esi, [LFBAddress] |
lea esi, [LFB_BASE+ecx+ecx*2] |
add esi, eax |
mov [cur_saved_base],esi |
710,8 → 709,7 |
mov [_dy], edi |
mul ebx |
lea esi, [eax+ecx*4] |
add esi, [LFBAddress] |
lea esi, [LFB_BASE+eax+ecx*4] |
mov [cur_saved_base],esi |
mov edi, [scr_width] |
/kernel/branches/kolibri_pe/video/vesa12.inc |
---|
63,10 → 63,10 |
set_bank: |
pushfd |
cli |
cmp al,[BANK_RW] |
cmp al, byte [bank_rw] |
je .retsb |
mov [BANK_RW],al |
mov byte [bank_rw],al |
push dx |
mov dx,3D8h |
out dx,al |
84,10 → 84,10 |
set_bank: |
pushfd |
cli |
cmp al,[BANK_RW] |
cmp al, byte [bank_rw] |
je .retsb |
mov [BANK_RW],al |
mov byte [bank_rw],al |
push ax |
push dx |
push cx |
172,10 → 172,10 |
pushfd |
cli |
cmp al,[BANK_RW] |
cmp al, byte [bank_rw] |
je .retsb |
mov [BANK_RW],al |
mov byte [bank_rw],al |
push ax |
push dx |
mov dx,3CEh |
206,10 → 206,10 |
pushfd |
cli |
cmp al,[BANK_RW] |
cmp al, byte [bank_rw] |
je .retsb |
mov [BANK_RW],al |
mov byte [bank_rw],al |
push ax |
push dx |
mov ah,al |
336,7 → 336,7 |
mul ebx |
add eax, esi |
lea eax, [VGABasePtr+eax+esi*2] |
cmp [ScreenBPP],byte 24 |
cmp byte [ScreenBPP], 24 |
jz v12bgl3 |
add eax,esi |
410,7 → 410,7 |
add eax,ecx ; x |
add eax,ecx |
add eax,ecx |
cmp [ScreenBPP],byte 24 ; 24 or 32 bpp ? - x start |
cmp byte [ScreenBPP], 24 ; 24 or 32 bpp ? - x start |
jz dbpi2412 |
add eax,ecx |
425,7 → 425,7 |
mov ecx,eax |
add ecx,eax |
add ecx,eax |
cmp [ScreenBPP],byte 24 ; 24 or 32 bpp ? - x size |
cmp byte [ScreenBPP], 24 ; 24 or 32 bpp ? - x size |
jz dbpi24312 |
add ecx,eax |
463,7 → 463,7 |
dbcblimitlno12: |
cmp [ScreenBPP],byte 24 ; 24 or 32 bpp ? |
cmp byte [ScreenBPP], 24 ; 24 or 32 bpp ? |
jz dbpi24bit12 |
jmp dbpi32bit12 |
776,7 → 776,7 |
add eax,ecx ; x |
add eax,ecx |
add eax,ecx |
cmp [ScreenBPP],byte 24 ; 24 or 32 bpp ? - x start |
cmp byte [ScreenBPP], 24 ; 24 or 32 bpp ? - x start |
jz pi2412 |
add eax,ecx |
817,7 → 817,7 |
dbcblimitlno212: |
cmp [ScreenBPP],byte 24 ; 24 or 32 bpp ? |
cmp byte [ScreenBPP], 24 ; 24 or 32 bpp ? |
jnz pi32bit12 |
pi24bit12: |
974,7 → 974,7 |
vesa12_read_screen_pixel: |
and eax,0x3FFFFF |
cmp [ScreenBPP],byte 24 ; 24 or 32 bpp ? |
cmp byte [ScreenBPP], 24 ; 24 or 32 bpp ? |
jz v12rsp24 |
mov edi,eax |
shl edi,2 |
/kernel/branches/kolibri_pe/video/vesa20.inc |
---|
23,13 → 23,7 |
; If you're planning to write your own video driver I suggest |
; you replace the VESA12.INC file and see those instructions. |
;Screen_Max_X equ 0xfe00 |
;Screen_Max_Y equ 0xfe04 |
;BytesPerScanLine equ 0xfe08 |
;LFBAddress equ 0xfe80 |
;ScreenBPP equ 0xfbf1 |
;************************************************* |
; getpixel |
; |
42,7 → 36,7 |
getpixel: |
push eax ebx edx edi |
call dword [GETPIXEL] |
call [get_pixel] |
pop edi edx ebx eax |
ret |
52,8 → 46,11 |
imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier |
lea edi, [eax+eax*2] ; edi = x*3 |
add edi, ebx ; edi = x*3+(y*y multiplier) |
add edi, [LFBAddress] ; ebx = where pixel is in memory |
mov ecx, [edi] |
if SHADOWFB |
mov ecx, [SHADOWFB+edi] |
else |
mov ecx, [LFB_BASE+edi] |
end if |
and ecx, 0xffffff |
ret |
60,8 → 57,11 |
Vesa20_getpixel32: |
imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier |
lea edi, [ebx+eax*4] ; edi = x*4+(y*y multiplier) |
add edi, [LFBAddress] ; ebx = where pixel is in memory |
mov ecx, [edi] |
if SHADOWFB |
mov ecx, [SHADOWFB+edi] |
else |
mov ecx, [LFB_BASE+edi] |
end if |
and ecx, 0xffffff |
ret |
177,7 → 177,7 |
mov [putimg.winmap_newline], eax |
; screen new line increment |
mov eax, [BytesPerScanLine] |
movzx ebx, byte [ScreenBPP] |
mov ebx, [ScreenBPP] |
shr ebx, 3 |
imul ecx, ebx |
sub eax, ecx |
188,11 → 188,10 |
mov edx, [putimg.abs_cy] |
imul edx, [BytesPerScanLine] |
mov eax, [putimg.abs_cx] |
movzx ebx, byte [ScreenBPP] |
mov ebx, [ScreenBPP] |
shr ebx, 3 |
imul eax, ebx |
add edx, eax |
add edx, [LFBAddress] |
; pointer to pixel map |
mov eax, [putimg.abs_cy] |
imul eax, [Screen_Max_X] |
218,9 → 217,15 |
cmp [ebp], bl |
jne .skip |
; mov eax, [esi] ; eax = RRBBGGRR |
mov [edx], ax |
if SHADOWFB |
mov [SHADOWFB+edx], ax |
end if |
mov [LFB_BASE+edx], ax |
shr eax, 16 |
mov [edx+2], al |
if SHADOWFB |
mov [SHADOWFB+edx+2], al |
end if |
mov [LFB_BASE+edx+2], al |
.skip: |
; add esi, 3 ;[putimg.source_bpp] |
add edx, 3 |
261,7 → 266,10 |
cmp [ebp], bl |
jne .skip |
; mov eax, [esi] ; ecx = RRBBGGRR |
mov [edx], eax |
if SHADOWFB |
mov [SHADOWFB+edx], eax |
end if |
mov [LFB_BASE+edx], eax |
.skip: |
; add esi, [putimg.source_bpp] |
add edx, 4 |
324,7 → 332,7 |
mov [esp+32-8],ecx |
.noneg: |
; OK to set pixel |
call dword [PUTPIXEL] ; call the real put_pixel function |
call [put_pixel] ; call the real put_pixel function |
.exit: |
popad |
ret |
336,11 → 344,15 |
imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier |
lea edi, [eax+eax*2] ; edi = x*3 |
mov eax, [esp+32-8+4] |
add edi, [LFBAddress] |
add edi, ebx ; ebx = where to put pixel in memory |
mov [edi], ax |
if SHADOWFB |
mov [SHADOWFB+ebx+edi], ax |
end if |
mov [LFB_BASE+ebx+edi], ax |
shr eax, 16 |
mov [edi+2], al |
if SHADOWFB |
mov [SHADOWFB+ebx+edi+2], al |
end if |
mov [LFB_BASE+ebx+edi+2], al |
ret |
351,8 → 363,10 |
imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier |
lea edi, [ebx+eax*4] ; edi = x*4+(y*y multiplier) |
mov eax, [esp+32-8+4] ; eax = color |
add edi, [LFBAddress] ; ebx = where to put pixel in memory |
mov [edi], eax |
if SHADOWFB |
mov [SHADOWFB+edi], eax |
end if |
mov [LFB_BASE+edi], eax |
ret |
;************************************************* |
623,7 → 637,7 |
mov [drbar.line_inc_map], eax |
; line_inc_scr |
mov eax, [drbar.real_sx] |
movzx ebx, byte [ScreenBPP] |
mov ebx, [ScreenBPP] |
shr ebx, 3 |
imul eax, ebx |
neg eax |
633,11 → 647,10 |
mov edx, [drbar.abs_cy] |
imul edx, [BytesPerScanLine] |
mov eax, [drbar.abs_cx] |
; movzx ebx, byte [ScreenBPP] |
; mov ebx, [ScreenBPP] |
; shr ebx, 3 |
imul eax, ebx |
add edx, eax |
add edx, [LFBAddress] |
; pointer to pixel map |
mov eax, [drbar.abs_cy] |
imul eax, [Screen_Max_X] |
668,8 → 681,12 |
.new_x: |
cmp byte [ebp], bl |
jne .skip |
mov [edx], bh |
mov [edx + 1], ax |
if SHADOWFB |
mov [SHADOWFB+edx], bh |
mov [SHADOWFB+edx + 1], ax |
end if |
mov [LFB_BASE+edx], bh |
mov [LFB_BASE+edx + 1], ax |
.skip: |
; add pixel |
add edx, 3 |
704,7 → 721,10 |
.new_x: |
cmp byte [ebp], bl |
jne .skip |
mov [edx], eax |
if SHADOWFB |
mov [SHADOWFB+edx], eax |
end if |
mov [LFB_BASE+edx], eax |
.skip: |
; add pixel |
add edx, 4 |
731,60 → 751,7 |
mov [EGA_counter],1 |
ret |
;voodoodbcplimit: |
; ebp:=(y+Ywin)*(ScreenXSize+1)+(x+Xwin)+AddrBuffer |
; pusha |
; xor edx,edx |
; mov eax,ebp |
; mov ebx,[Screen_Max_X] ; Screen_X_size |
; inc ebx ; +1 |
; sub eax,display_data ; -AddrBuffer |
; div ebx ; |
; mov ebx,eax ; ebx:=Y |
; mov eax,edx ; eax:=X |
; call cplimit |
; test ecx,ecx |
; jne dbcpl12 |
; popa |
; clc |
; ret |
; dbcpl12: |
; popa |
; stc |
; ret |
;dbcplimit: |
; pusha |
; xor edx,edx |
; mov ebx,[Screen_Max_X] |
; inc ebx |
; sub eax,display_data |
; div ebx |
; mov ebx,eax |
; mov eax,edx |
; call cplimit |
; test ecx,ecx |
; jne dbcpl1 |
; popa |
; clc |
; ret |
; dbcpl1: |
; popa |
; stc |
; ret |
vesa20_drawbackground_tiled: |
call [disable_mouse] |
pushad |
800,11 → 767,11 |
add ebp, eax |
add ebp, eax |
add ebp, eax |
cmp [ScreenBPP], byte 24 ; 24 or 32 bpp ? - x size |
cmp byte [ScreenBPP], 24 ; 24 or 32 bpp ? - x size |
jz @f |
add ebp, eax |
@@: |
add ebp, [LFBAddress] |
; add ebp, LFB_BASE |
; ebp:=Y*BytesPerScanLine+X*BytesPerPixel+AddrLFB |
call calculate_edi |
xchg edi, ebp |
849,7 → 816,7 |
add esi, 3 |
add edi, 3 |
@@: |
cmp [ScreenBPP], byte 25 ; 24 or 32 bpp? |
cmp byte [ScreenBPP], 25 ; 24 or 32 bpp? |
sbb edi, -1 ; +1 for 32 bpp |
; I do not use 'inc eax' because this is slightly slower then 'add eax,1' |
add ebp, edx |
910,11 → 877,10 |
add ebp, eax |
add ebp, eax |
add ebp, eax |
cmp [ScreenBPP], byte 24 ; 24 or 32 bpp ? - x size |
cmp byte [ScreenBPP], 24 ; 24 or 32 bpp ? - x size |
jz @f |
add ebp, eax |
@@: |
add ebp, [LFBAddress] |
; ebp:=Y*BytesPerScanLine+X*BytesPerPixel+AddrLFB |
call calculate_edi |
xchg edi, ebp |
991,11 → 957,17 |
mov ebx, [bgr_next_line+esi] |
call [overlapping_of_points_ptr] |
.novert: |
mov [edi], ax |
if SHADOWFB |
mov [SHADOWFB+edi], ax |
end if |
mov [LFB_BASE+edi], ax |
shr eax, 16 |
mov [edi+2], al |
if SHADOWFB |
mov [SHADOWFB+edi+2], al |
end if |
mov [LFB_BASE+edi+2], al |
snbgp: |
cmp [ScreenBPP], byte 25 |
cmp byte [ScreenBPP], 25 |
sbb edi, -4 |
add ebp, 1 |
mov eax, [esp+20] |
1019,7 → 991,7 |
sub edi, eax |
sub edi, eax |
sub edi, eax |
cmp [ScreenBPP], byte 24 |
cmp byte [ScreenBPP], 24 |
jz @f |
sub edi, eax |
@@: |
/kernel/branches/kolibri_pe/video/vga.inc |
---|
126,7 → 126,7 |
checkVga_N13: |
cmp [SCR_MODE],dword 0x13 |
cmp [scr_mode], 0x13 |
jne @f |
; cnvl: |
133,7 → 133,7 |
pushad |
cmp [EGA_counter],1 |
je novesal |
mov ecx,[MOUSE_X] |
mov ecx, dword [MOUSE_X] |
cmp ecx,[novesachecksum] |
jne novesal |
popad |
201,7 → 201,7 |
VGA_drawbackground: |
; draw all |
cmp [SCR_MODE],dword 0x12 |
cmp [scr_mode], 0x12 |
jne .end |
pushad |
mov esi,[LFBAddress] |
377,7 → 377,7 |
VGA__putimage: |
; ecx = size [x|y] |
; edx = coordinates [x|y] |
cmp [SCR_MODE],dword 0x12 |
cmp [scr_mode], 0x12 |
jne @f |
pushad |
rol edx,16 |
397,7 → 397,7 |
; ebx cy |
; ecx xe |
; edx ye |
cmp [SCR_MODE],dword 0x12 |
cmp [scr_mode], 0x12 |
jne @f |
pushad |
sub ecx,eax |