/kernel/trunk/bus/pci/pci32.inc |
---|
101,17 → 101,17 |
pci_fn_0: |
; PCI function 0: get pci version (AH.AL) |
movzx eax, word [BOOT_VAR+0x9022] |
movzx eax, word [BOOT_VARS+0x9022] |
ret |
pci_fn_1: |
; PCI function 1: get last bus in AL |
mov al, [BOOT_VAR+0x9021] |
mov al, [BOOT_VARS+0x9021] |
ret |
pci_fn_2: |
; PCI function 2: get pci access mechanism |
mov al, [BOOT_VAR+0x9020] |
mov al, [BOOT_VARS+0x9020] |
ret |
pci_service_not_supported: |
156,7 → 156,7 |
pci_read_reg: |
push ebx esi |
cmp byte [BOOT_VAR+0x9020], 2;what mechanism will we use? |
cmp byte [BOOT_VARS+0x9020], 2;what mechanism will we use? |
je pci_read_reg_2 |
; mechanism 1 |
287,7 → 287,7 |
pci_write_reg: |
push esi ebx |
cmp byte [BOOT_VAR+0x9020], 2;what mechanism will we use? |
cmp byte [BOOT_VARS+0x9020], 2;what mechanism will we use? |
je pci_write_reg_2 |
; mechanism 1 |
570,9 → 570,9 |
cmp ebp, 1 ; PCI_FUNCTION_ID |
jnz .not_PCI_BIOS_PRESENT |
mov edx, 'PCI ' |
mov al, [BOOT_VAR + 0x9020] |
mov bx, [BOOT_VAR + 0x9022] |
mov cl, [BOOT_VAR + 0x9021] |
mov al, [BOOT_VARS + 0x9020] |
mov bx, [BOOT_VARS + 0x9022] |
mov cl, [BOOT_VARS + 0x9021] |
xor ah, ah |
jmp .return_abcd |
715,7 → 715,7 |
.next_func: |
inc dword [.devfn] |
mov ah, [.bus] |
cmp ah, [BOOT_VAR+0x9021] |
cmp ah, [BOOT_VARS+0x9021] |
jbe .loop |
.nomemory: |
leave |
/kernel/trunk/const.inc |
---|
192,8 → 192,12 |
TASK_DATA equ (OS_BASE+0x0003020) |
TASK_EVENT equ (OS_BASE+0x0003020) |
CDDataBuf equ (OS_BASE+0x0007000) |
FLOPPY_BUFF equ (OS_BASE+0x0008000) ;18*512 |
CDDataBuf equ (OS_BASE+0x0005000) |
;unused 0x6000 - 0x8fff |
BOOT_VARS equ (OS_BASE) ;0x9000 |
idts equ (OS_BASE+0x000B100) |
WIN_STACK equ (OS_BASE+0x000C000) |
WIN_POS equ (OS_BASE+0x000C400) |
222,33 → 226,13 |
VGABasePtr equ (OS_BASE+0x00A0000) |
;RAMDISK equ (OS_BASE+0x0100000) |
;RAMDISK_FAT equ (OS_BASE+0x0280000) |
;FLOPPY_FAT equ (OS_BASE+0x0282000) |
;CLEAN_ZONE equ 0x284000 |
;IDE_DMA equ 0x284000 |
CLEAN_ZONE equ (_CLEAN_ZONE-OS_BASE) |
IDE_DMA equ (_IDE_DMA-OS_BASE) |
;BgrAuxTable equ (OS_BASE+0x0298000) |
; unused? |
SB16Buffer equ (OS_BASE+0x02A0000) |
SB16_Status equ (OS_BASE+0x02B0000) |
;BUTTON_INFO equ (OS_BASE+0x02B3FEE) |
;BPSLine_calc_area equ (OS_BASE+0x02C4000) |
;d_width_calc_area equ (OS_BASE+0x02CA000) |
;RESERVED_PORTS equ (OS_BASE+0x02D0000) |
;BOOT_VAR equ (OS_BASE+0x02E0000) |
;draw_data equ (OS_BASE+0x0320000) |
;sys_pgmap equ (OS_BASE+0x0324000) |
UPPER_KERNEL_PAGES equ (OS_BASE+0x0400000) |
virtual at (OS_BASE+0x05FFF80) |
/kernel/trunk/core/memory.inc |
---|
358,7 → 358,7 |
cmp dword [LFBAddress], -1 |
jne @f |
mov [BOOT_VAR+BOOT_MTRR], byte 2 |
mov [BOOT_VARS+BOOT_MTRR], byte 2 |
; max VGA=640*480*4=1228800 bytes |
; + 32*640*4=81920 bytes for mouse pointer |
stdcall alloc_pages, ((1228800+81920)/4096) |
378,7 → 378,7 |
@@: |
test [SCR_MODE], word 0100000000000000b |
jnz @f |
mov [BOOT_VAR+BOOT_MTRR], byte 2 |
mov [BOOT_VARS+BOOT_MTRR], byte 2 |
ret |
@@: |
call init_mtrr |
1361,7 → 1361,7 |
align 4 |
proc init_mtrr |
cmp [BOOT_VAR+BOOT_MTRR], byte 2 |
cmp [BOOT_VARS+BOOT_MTRR], byte 2 |
je .exit |
bt [cpu_caps], CAPS_MTRR |
/kernel/trunk/data32.inc |
---|
382,6 → 382,7 |
REDRAW_BACKGROUND rb 4 |
align 4 |
draw_data: rb 16*256 |
BPSLine_calc_area rd 1440 |
d_width_calc_area rd 1140 |
402,6 → 403,7 |
BTN_DOWN: rb 4 |
align 4 |
def_cursor rd 1 |
def_cursor_clock rd 1 |
current_cursor rd 1 |
535,17 → 537,21 |
cache_ide3_appl_search_start rd 1 |
debug_step_pointer rd 1 |
lba_read_enabled rd 1 ; 0 = disabled , 1 = enabled |
pci_access_enabled rd 1 ; 0 = disabled , 1 = enabled |
hdd_appl_data rb 1 ; 0 = system cache, 1 - application cache |
cd_appl_data rb 1 ; 0 = system cache, 1 - application cache |
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) |
BiosDiskPartitions rd 80h |
align 16 |
DRIVE_DATA: rb DRIVE_DATA_SIZE |
570,5 → 576,6 |
BgrAuxTable rb 32768 |
BUTTON_INFO rb 64*1024 |
RESERVED_PORTS: rb 64*1024 |
BOOT_VAR: rb 64*1024 |
FLOPPY_BUFF: rb 18*512 ;one track |
sys_pgmap: rb 1024*1024/8 |
/kernel/trunk/init.inc |
---|
15,7 → 15,7 |
align 4 |
proc mem_test |
; if we have BIOS with fn E820, skip the test |
cmp dword [BOOT_VAR-OS_BASE + 0x9100], 0 |
cmp dword [BOOT_VARS-OS_BASE + 0x9100], 0 |
jnz .ret |
mov eax, cr0 |
35,12 → 35,12 |
and eax, not (CR0_CD+CR0_NW) ;enable caching |
mov cr0, eax |
inc dword [BOOT_VAR-OS_BASE + 0x9100] |
inc dword [BOOT_VARS-OS_BASE + 0x9100] |
xor eax, eax |
mov [BOOT_VAR-OS_BASE + 0x9104], eax |
mov [BOOT_VAR-OS_BASE + 0x9108], eax |
mov [BOOT_VAR-OS_BASE + 0x910C], edi |
mov [BOOT_VAR-OS_BASE + 0x9110], eax |
mov [BOOT_VARS-OS_BASE + 0x9104], eax |
mov [BOOT_VARS-OS_BASE + 0x9108], eax |
mov [BOOT_VARS-OS_BASE + 0x910C], edi |
mov [BOOT_VARS-OS_BASE + 0x9110], eax |
.ret: |
ret |
endp |
48,7 → 48,7 |
align 4 |
proc init_mem |
; calculate maximum allocatable address and number of allocatable pages |
mov edi, BOOT_VAR-OS_BASE + 0x9104 |
mov edi, BOOT_VARS-OS_BASE + 0x9104 |
mov ecx, [edi-4] |
xor esi, esi; esi will hold total amount of memory |
xor edx, edx; edx will hold maximum allocatable address |
195,7 → 195,7 |
rep stosd |
; scan through memory map and mark free areas as available |
mov ebx, BOOT_VAR-OS_BASE + 0x9104 |
mov ebx, BOOT_VARS-OS_BASE + 0x9104 |
mov edx, [ebx-4] |
.scanmap: |
cmp [ebx+16], byte 1 |
453,6 → 453,9 |
acpi_dev_size rd 1 |
acpi_rsdt_base rd 1 |
acpi_fadt_base rd 1 |
acpi_dsdt_base rd 1 |
acpi_dsdt_size rd 1 |
acpi_madt_base rd 1 |
acpi_ioapic_base rd 1 |
464,6 → 467,7 |
ACPI_HI_RSDP_WINDOW_END equ 0x00100000 |
ACPI_RSDP_CHECKSUM_LENGTH equ 20 |
ACPI_MADT_SIGN equ 0x43495041 |
ACPI_FADT_SIGN equ 0x50434146 |
acpi_locate: |
535,10 → 539,23 |
jz .done |
mov ecx, [eax+16] |
mov edx, ACPI_MADT_SIGN |
mov edx, 0x50434146 |
mov [acpi_rsdt_base-OS_BASE], ecx |
call rsdt_find |
mov [acpi_fadt_base-OS_BASE], eax |
test eax, eax |
jz @f |
mov eax, [eax+40] |
mov [acpi_dsdt_base-OS_BASE], eax |
mov eax, [eax+4] |
mov [acpi_dsdt_size-OS_BASE], eax |
@@: |
mov edx, ACPI_MADT_SIGN |
mov ecx, [acpi_rsdt_base-OS_BASE] |
call rsdt_find |
test eax, eax |
jz .done |
mov [acpi_madt_base-OS_BASE], eax |
/kernel/trunk/kernel.asm |
---|
265,13 → 265,12 |
; SAVE & CLEAR 0-0xffff |
xor esi, esi |
mov edi, (BOOT_VAR-OS_BASE) |
mov ecx, 0x10000 / 4 |
rep movsd |
mov edi, 0x1000 |
mov ecx, 0xf000 / 4 |
mov ecx, 0x8000 / 4 |
rep stosd |
mov edi, 0xa000 |
mov ecx, 0x6000 / 4 |
rep stosd |
call test_cpu |
bts [cpu_caps-OS_BASE], CAPS_TSC ;force use rdtsc |
359,11 → 358,11 |
; SAVE REAL MODE VARIABLES |
xor eax, eax |
mov ax, [BOOT_VAR + BOOT_IDE_PI_16] |
mov ax, [BOOT_VARS + BOOT_IDE_PI_16] |
mov [IDEContrProgrammingInterface], ax |
mov ax, [BOOT_VAR + BOOT_IDE_BASE_ADDR] |
mov ax, [BOOT_VARS + BOOT_IDE_BASE_ADDR] |
mov [IDEContrRegsBaseAddr], ax |
mov ax, [BOOT_VAR + BOOT_IDE_BAR0_16] |
mov ax, [BOOT_VARS + BOOT_IDE_BAR0_16] |
mov [IDE_BAR0_val], ax |
cmp ax, 0 |
375,9 → 374,9 |
mov [hd_address_table], eax |
mov [hd_address_table+8], eax |
@@: |
mov ax, [BOOT_VAR + BOOT_IDE_BAR1_16] |
mov ax, [BOOT_VARS + BOOT_IDE_BAR1_16] |
mov [IDE_BAR1_val], ax |
mov ax, [BOOT_VAR + BOOT_IDE_BAR2_16] |
mov ax, [BOOT_VARS + BOOT_IDE_BAR2_16] |
mov [IDE_BAR2_val], ax |
cmp ax, 0 |
389,18 → 388,18 |
mov [hd_address_table+16], eax |
mov [hd_address_table+24], eax |
@@: |
mov ax, [BOOT_VAR + BOOT_IDE_BAR3_16] |
mov ax, [BOOT_VARS + BOOT_IDE_BAR3_16] |
mov [IDE_BAR3_val], ax |
; --------------- APM --------------------- |
; init selectors |
mov ebx, [BOOT_VAR+BOOT_APM_ENTRY] ; offset of APM entry point |
movzx eax, word [BOOT_VAR+BOOT_APM_CODE_32] ; real-mode segment base address of |
mov ebx, [BOOT_VARS+BOOT_APM_ENTRY] ; offset of APM entry point |
movzx eax, word [BOOT_VARS+BOOT_APM_CODE_32] ; real-mode segment base address of |
; protected-mode 32-bit code segment |
movzx ecx, word [BOOT_VAR+BOOT_APM_CODE_16]; real-mode segment base address of |
movzx ecx, word [BOOT_VARS+BOOT_APM_CODE_16]; real-mode segment base address of |
; protected-mode 16-bit code segment |
movzx edx, word [BOOT_VAR+BOOT_APM_DATA_16]; real-mode segment base address of |
movzx edx, word [BOOT_VARS+BOOT_APM_DATA_16]; real-mode segment base address of |
; protected-mode 16-bit data segment |
shl eax, 4 |
421,28 → 420,28 |
mov dword[apm_entry], ebx |
mov word [apm_entry + 4], apm_code_32 - gdts |
mov eax, [BOOT_VAR + BOOT_APM_VERSION] ; version & flags |
mov eax, [BOOT_VARS + BOOT_APM_VERSION] ; version & flags |
mov [apm_vf], eax |
; ----------------------------------------- |
mov al, [BOOT_VAR+BOOT_DMA] ; DMA access |
mov al, [BOOT_VARS+BOOT_DMA] ; DMA access |
mov [allow_dma_access], al |
movzx eax, byte [BOOT_VAR+BOOT_BPP] ; bpp |
movzx eax, byte [BOOT_VARS+BOOT_BPP] ; bpp |
mov [_display.bpp], eax |
mov [_display.vrefresh], 60 |
movzx eax, word [BOOT_VAR+BOOT_X_RES]; X max |
movzx eax, word [BOOT_VARS+BOOT_X_RES]; X max |
mov [_display.width], eax |
mov [display_width_standard], eax |
dec eax |
mov [Screen_Max_X], eax |
mov [screen_workarea.right], eax |
movzx eax, word [BOOT_VAR+BOOT_Y_RES]; Y max |
movzx eax, word [BOOT_VARS+BOOT_Y_RES]; Y max |
mov [_display.height], eax |
mov [display_height_standard], eax |
dec eax |
mov [Screen_Max_Y], eax |
mov [screen_workarea.bottom], eax |
movzx eax, word [BOOT_VAR+BOOT_VESA_MODE] ; screen mode |
movzx eax, word [BOOT_VARS+BOOT_VESA_MODE] ; screen mode |
mov dword [SCR_MODE], eax |
; mov eax, [BOOT_VAR+0x9014] ; Vesa 1.2 bnk sw add |
; mov [BANK_SWITCH], eax |
451,7 → 450,7 |
je @f |
cmp [SCR_MODE], word 0x12 ; VGA 640x480 |
je @f |
movzx eax, word[BOOT_VAR+BOOT_PITCH] ; for other modes |
movzx eax, word[BOOT_VARS+BOOT_PITCH] ; for other modes |
@@: |
mov [_display.pitch], eax |
mov eax, [_display.width] |
464,7 → 463,7 |
; equal to [_display.width] * [ScreenBPP] / 8 |
call calculate_fast_getting_offset_for_LFB |
mov esi, BOOT_VAR+0x9080 |
mov esi, BOOT_VARS+0x9080 |
movzx ecx, byte [esi-1] |
mov [NumBiosDisks], ecx |
mov edi, BiosDisksData |
472,7 → 471,7 |
; GRAPHICS ADDRESSES |
mov eax, [BOOT_VAR+BOOT_LFB] |
mov eax, [BOOT_VARS+BOOT_LFB] |
mov [LFBAddress], eax |
cmp [SCR_MODE], word 0100000000000000b |
917,22 → 916,8 |
; LOAD FIRST APPLICATION |
cli |
; cmp byte [BOOT_VAR+0x9030],1 |
; jne no_load_vrr_m |
; mov ebp, vrr_m |
; call fs_execute_from_sysdir |
; |
;; cmp eax,2 ; if vrr_m app found (PID=2) |
; sub eax,2 |
; jz first_app_found |
; |
;no_load_vrr_m: |
mov ebp, firstapp |
call fs_execute_from_sysdir |
; cmp eax,2 ; continue if a process has been loaded |
test eax, eax |
jns first_app_found |
1284,10 → 1269,10 |
loop .fl60 |
push eax |
mov ax, [BOOT_VAR+BOOT_Y_RES] |
mov ax, [BOOT_VARS+BOOT_Y_RES] |
shr ax, 1 |
shl eax, 16 |
mov ax, [BOOT_VAR+BOOT_X_RES] |
mov ax, [BOOT_VARS+BOOT_X_RES] |
shr ax, 1 |
mov [MOUSE_X], eax |
call wakeup_osloop |
2174,7 → 2159,7 |
jl exit_for_anyone |
cmp ecx, 4 |
jg exit_for_anyone |
mov [BOOT_VAR+0x9030], cl |
mov [BOOT_VARS+0x9030], cl |
mov eax, [TASK_COUNT] |
mov [SYS_SHUTDOWN], al |
5628,7 → 5613,7 |
align 4 |
system_shutdown: ; shut down the system |
cmp byte [BOOT_VAR+0x9030], 1 |
cmp byte [BOOT_VARS+0x9030], 1 |
jne @F |
ret |
@@: |
5653,11 → 5638,11 |
rep movsb |
end if |
mov esi, BOOT_VAR ; restore 0x0 - 0xffff |
mov edi, OS_BASE |
mov ecx, 0x10000/4 |
cld |
rep movsd |
; mov esi, BOOT_VAR ; restore 0x0 - 0xffff |
; mov edi, OS_BASE |
; mov ecx, 0x10000/4 |
; cld |
; rep movsd |
call restorefatchain |