/kernel/branches/Kolibri-A/trunk/boot/bootcode.inc |
---|
1,13 → 1,13 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
;; ;; |
;; Copyright (C) KolibriOS team 2004-2011. All rights reserved. ;; |
;; Copyright (C) KolibriOS team 2004-2010. All rights reserved. ;; |
;; Copyright (C) MenuetOS 2000-2004 Ville Mikael Turjanmaa ;; |
;; Distributed under terms of the GNU General Public License ;; |
;; ;; |
;; BOOTCODE.INC ;; |
;; ;; |
;; Kolibri-A auxiliary 16-bit code, ;; |
;; based on bootcode for KolibriOS ;; |
;; KolibriOS 16-bit loader, ;; |
;; based on bootcode for MenuetOS ;; |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
119,7 → 119,18 |
push cs |
pop es |
if 0 |
; set videomode |
mov ax, 3 |
int 0x10 |
; draw frames |
push 0xb800 |
pop es |
xor di, di |
mov ah, 1*16+15 |
end if |
cpugood: |
push 0 |
287,7 → 298,13 |
dec al |
mov [boot_dev], al |
; GET MEMORY MAP |
include 'detect/biosmem.inc' |
; READ DISKETTE TO MEMORY |
; SET GRAPHICS |
xor ax, ax |
/kernel/branches/Kolibri-A/trunk/bus/USER/special.inc |
---|
File deleted |
\ No newline at end of file |
/kernel/branches/Kolibri-A/trunk/bus/USER |
---|
Property changes: |
Deleted: bugtraq:number |
-true |
\ No newline at end of property |
Deleted: tsvn:logminsize |
-5 |
\ No newline at end of property |
/kernel/branches/Kolibri-A/trunk/const.inc |
---|
335,11 → 335,10 |
end virtual |
HEAP_BASE equ (OS_BASE+0x0800000) |
HEAP_MIN_SIZE equ 0x02000000 |
HEAP_MIN_SIZE equ 0x01000000 |
PCIe_CONFIG_SPACE equ 0xF0000000 |
USER_DMA_BUFFER equ 0xFD000000 ; linear addr. |
USER_DMA_SIZE equ 0x00800000 |
page_tabs equ 0xFDC00000 |
app_page_tabs equ 0xFDC00000 |
/kernel/branches/Kolibri-A/trunk/core/memory.inc |
---|
337,7 → 337,7 |
align 4 |
proc init_LFB |
stdcall set_mtrr, [LFBAddress],[LFBSize],MEM_WC |
call init_mtrr |
mov edx, LFB_BASE |
mov esi, [LFBAddress] |
364,16 → 364,16 |
align 4 |
init_userDMA: |
stdcall set_mtrr, [UserDMAaddr], USER_DMA_SIZE, MEM_UC ; <<<<<<<<<<+++++++++++++++++++++++++++++++++ |
mov eax, [UserDMAaddr] ; phys. addr, 8M-aligned |
or eax, PG_GLOBAL+PG_LARGE + PG_UW + PG_NOCACHE |
stdcall alloc_pages, 4096 ; 16M <<<<<<<<<<+++++++++++++++++++++++++++++++++ |
add eax, 0x007FFFF0 ; terrible mess, sorry ... |
and eax, 0xFF800000 ; align at 8M boundary |
mov [UserDMAaddr], eax |
or eax, PG_LARGE + PG_UW + PG_NOCACHE |
mov ebx, sys_pgdir + (USER_DMA_BUFFER shr 20) |
mov [ebx], eax |
add ebx, 4 |
add eax, 0x00400000 |
mov [ebx], eax |
mov eax, cr3 ;flush TLB |
mov cr3, eax |
ret |
1249,6 → 1249,75 |
align 4 |
proc init_mtrr |
cmp [BOOT_VAR+0x901c],byte 2 |
je .exit |
bt [cpu_caps], CAPS_MTRR |
jnc .exit |
mov eax, cr0 |
or eax, 0x60000000 ;disable caching |
mov cr0, eax |
wbinvd ;invalidate cache |
mov ecx, 0x2FF |
rdmsr ; |
; has BIOS already initialized MTRRs? |
test ah, 8 |
jnz .skip_init |
; rarely needed, so mainly placeholder |
; main memory - cached |
push eax |
mov eax, [MEM_AMOUNT] |
; round eax up to next power of 2 |
dec eax |
bsr ecx, eax |
mov ebx, 2 |
shl ebx, cl |
dec ebx |
; base of memory range = 0, type of memory range = MEM_WB |
xor edx, edx |
mov eax, MEM_WB |
mov ecx, 0x200 |
wrmsr |
; mask of memory range = 0xFFFFFFFFF - (size - 1), ebx = size - 1 |
mov eax, 0xFFFFFFFF |
mov edx, 0x0000000F |
sub eax, ebx |
sbb edx, 0 |
or eax, 0x800 |
inc ecx |
wrmsr |
; clear unused MTRRs |
xor eax, eax |
xor edx, edx |
@@: |
wrmsr |
inc ecx |
cmp ecx, 0x210 |
jb @b |
; enable MTRRs |
pop eax |
or ah, 8 |
and al, 0xF0 ; default memtype = UC |
mov ecx, 0x2FF |
wrmsr |
.skip_init: |
stdcall set_mtrr, [LFBAddress],[LFBSize],MEM_WC |
wbinvd ;again invalidate |
mov eax, cr0 |
and eax, not 0x60000000 |
mov cr0, eax ; enable caching |
.exit: |
ret |
endp |
align 4 |
proc set_mtrr stdcall, base:dword,size:dword,mem_type:dword |
; find unused register |
mov ecx, 0x201 |
1268,11 → 1337,7 |
.ret: |
ret |
.found: |
mov eax, cr0 |
or eax, 0x60000000 ;disable caching |
mov cr0, eax |
wbinvd ;invalidate cache |
; found, write values |
xor edx, edx |
mov eax, [base] |
or eax, [mem_type] |
1287,12 → 1352,6 |
or eax, 0x800 |
inc ecx |
wrmsr |
wbinvd ;again invalidate |
mov eax, cr0 |
and eax, not 0x60000000 |
mov cr0, eax ; enable caching |
ret |
endp |
/kernel/branches/Kolibri-A/trunk/core/syscall.inc |
---|
46,10 → 46,8 |
syscall_entry: |
; sti |
push ecx |
xor ecx, ecx |
mov cl, al |
and cl, 7 |
call dword [servetable3 + ecx * 4] |
and eax, 3 |
call dword [servetable3 + eax * 4] |
pop ecx |
sysret |
158,13 → 156,8 |
servetable3: ; Kolibri-A special service |
dd sys_rdmsr ; 0 = read MSR |
dd sys_map1 ; 1 = get sys data (test only) |
dd sys_map1 ; 1 = map any page (test only) |
dd paleholder ; 2 |
dd paleholder ; 3 |
dd paleholder ; 4 |
dd paleholder ; 5 |
dd paleholder ; 6 |
dd special_srv ; 7 = special service |
dd sys_end ; last |
endg |
/kernel/branches/Kolibri-A/trunk/data32.inc |
---|
255,7 → 255,6 |
gdte: |
align 16 |
diff16 "cur_saved_data (data32.inc) ", 0, $ |
cur_saved_data rb 4096 |
fpu_data: rb 512 |
283,7 → 282,6 |
irq_tab rd 16 |
diff16 "mem_block_map (data32.inc) ", 0, $ |
mem_block_map rb 512 |
mem_block_list rd 64 |
large_block_list rd 31 |
290,8 → 288,6 |
mem_block_mask rd 2 |
large_block_mask rd 1 |
diff16 "mem_used (data32.inc) ", 0, $ |
mem_used.fd rd 1 |
mem_used.bk rd 1 |
306,7 → 302,6 |
free_blocks rd 1 |
mst MEM_STATE |
diff16 "page_start (data32.inc) ", 0, $ |
page_start rd 1 |
page_end rd 1 |
336,8 → 331,6 |
;img_screen_y rd 1 |
align 64 |
diff16 "_WinMapAddress (data32.inc) ", 0, $ |
;_WinMapWidth rd 1 |
;_WinMapHeight rd 1 |
_WinMapAddress rd 1 |
370,8 → 363,6 |
tmp_task_pdir rd 1 |
tmp_task_ptab rd 1 |
diff16 "default_io_map (data32.inc) ", 0, $ |
default_io_map rd 1 |
LFBSize rd 1 |
/kernel/branches/Kolibri-A/trunk/kernel.asm |
---|
499,10 → 499,10 |
mov [graph_data_l+4],al |
mov [graph_data_l+7],ah |
; or [KERNEL_ALLOC_FLAG], dword PG_NOCACHE ;<<<<<<<<<<<<<<<< |
; or [KERNEL_ALLOC_FLAG], dword PG_NOCACHE |
stdcall kernel_alloc, [_WinMapSize] |
mov [_WinMapAddress], eax |
; xor [KERNEL_ALLOC_FLAG], dword PG_NOCACHE ;<<<<<<<<<<<<<<<< |
; xor [KERNEL_ALLOC_FLAG], dword PG_NOCACHE |
xor eax,eax |
inc eax |
/kernel/branches/Kolibri-A/trunk/kernel32.inc |
---|
248,7 → 248,6 |
;include "bus/pci/PCIe.inc" |
include "bus/HT.inc" ; AMD HyperTransport bus control |
include "bus/SB/SB.inc" |
include "bus/user/special.inc" |
; Floppy drive controller |
/kernel/branches/Kolibri-A/trunk/init.inc |
---|
53,32 → 53,11 |
align 4 |
proc init_mem |
mov ecx, 0xC001001A ; Top of Memory MSR |
xor edi, edi |
rdmsr |
mov esi, eax ; esi = total amount of memory |
mov ecx, 0x0200 |
.read_mtrr: |
rdmsr |
and eax, 0xFFF00000 ; not just bitcleaning |
jz .next_mtrr ; ignore the main memory and free MTRRs |
cmp esi, eax |
jb .next_mtrr ; ignore MMIO blocks |
mov esi, eax |
.next_mtrr: |
add cl, 2 |
cmp cl, 0x10 |
jb .read_mtrr |
mov esi, (PCIe_CONFIG_SPACE-OS_BASE) ; esi will hold total amount of memory |
mov edx, esi ; edx will hold maximum allocatable address |
mov eax, USER_DMA_SIZE |
sub esi, eax ; exclude the Global DMA block... |
and esi, 0xFF800000 ; ...and the hole above it |
mov eax, esi |
mov [MEM_AMOUNT-OS_BASE], eax |
mov [pg_data.mem_amount-OS_BASE], eax ; the true MEMTOP |
mov [UserDMAaddr-OS_BASE], eax |
mov edx, esi ; edx will hold maximum allocatable address |
mov [MEM_AMOUNT-OS_BASE], esi |
mov [pg_data.mem_amount-OS_BASE], esi |
shr esi, 12 |
mov [pg_data.pages_count-OS_BASE], esi ; max number of PTEs ? |
/kernel/branches/Kolibri-A/trunk/unpacker.inc |
---|
515,7 → 515,6 |
uglobal |
align 4 |
diff16 "unpacker.inc structures", 0, $ |
;unpack.p rd unpack.LZMA_BASE_SIZE + (unpack.LZMA_LIT_SIZE shl (unpack.lc+unpack.lp)) |
unpack.p dd ? |
unpack.code_ dd ? |
/kernel/branches/Kolibri-A/trunk/detect/biosmem.inc |
---|
0,0 → 1,43 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
;; ;; |
;; Copyright (C) KolibriOS team 2009. All rights reserved. ;; |
;; Distributed under terms of the GNU General Public License ;; |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
; Query physical memory map from BIOS. |
; diamond, 2009 |
push ds |
; first call to fn E820 |
mov eax, 0xE820 |
xor ebx, ebx |
mov es, bx |
mov ds, bx |
mov di, 0x9104 |
mov [di-4], ebx ; no blocks yet |
mov ecx, 20 |
mov edx, 0x534D4150 |
int 15h |
jc no_E820 |
cmp eax, 0x534D4150 |
jnz no_E820 |
e820_mem_loop: |
cmp byte [di+16], 1 ; ignore non-free areas |
jnz e820_mem_next |
inc byte [0x9100] |
add di, 20 |
e820_mem_next: |
; consequent calls to fn E820 |
test ebx, ebx |
jz e820_test_done |
cmp byte [0x9100], 32 |
jae e820_test_done |
mov eax, 0xE820 |
int 15h |
jc e820_test_done |
jmp e820_mem_loop |
no_E820: |
; let's hope for mem_test from init.inc |
e820_test_done: |
pop ds |