/kernel/trunk/bootbios.asm |
---|
File deleted |
Property changes: |
Deleted: svn:eol-style |
-native |
\ No newline at end of property |
/kernel/trunk/Tupfile.lua |
---|
1,9 → 1,5 |
if tup.getconfig("NO_FASM") ~= "" then return end |
tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en" or tup.getconfig("LANG")) .. " > %o", {"lang.inc"}) |
tup.rule({"bootbios.asm", extra_inputs = {"lang.inc"}}, "fasm %f %o ", "bootbios.bin") |
tup.rule({"bootbios.asm", extra_inputs = {"lang.inc"}}, "fasm %f %o -dextended_primary_loader=1", "bootbios.bin.ext_loader") |
tup.rule({"bootbios.asm", extra_inputs = {"lang.inc"}}, "fasm %f %o -dpretest_build=1", "bootbios.bin.pretest") |
tup.rule({"kernel.asm", extra_inputs = {"bootbios.bin", "lang.inc"}}, "fasm -m 65536 %f %o " .. tup.getconfig("KERPACK_CMD"), "kernel.mnt") |
tup.rule({"kernel.asm", extra_inputs = {"bootbios.bin.ext_loader", "lang.inc"}}, "fasm -m 131072 %f %o -s %o.fas -dextended_primary_loader=1" .. tup.getconfig("KERPACK_CMD"), {"kernel.mnt.ext_loader", extra_outputs = {"kernel.mnt.ext_loader.fas"}}) |
tup.rule({"kernel.asm", extra_inputs = {"bootbios.bin.pretest", "lang.inc"}}, "fasm -m 65536 %f %o -dpretest_build=1 -ddebug_com_base=0xe9", "kernel.mnt.pretest") |
tup.rule({"kernel.asm", extra_inputs = {"lang.inc"}}, "fasm -m 65536 %f %o -dUEFI=1 -dextended_primary_loader=1", "kolibri.krn") |
tup.rule({"kernel.asm", extra_inputs = {"lang.inc"}}, "fasm -m 131072 %f %o " .. tup.getconfig("KERPACK_CMD"), "kernel.mnt") |
tup.rule({"kernel.asm", extra_inputs = {"lang.inc"}}, "fasm -m 131072 %f %o -dextended_primary_loader=1" .. tup.getconfig("KERPACK_CMD"), "kernel.mnt.ext_loader") |
tup.rule({"kernel.asm", extra_inputs = {"lang.inc"}}, "fasm -m 131072 %f %o -dpretest_build=1 -ddebug_com_base=0xe9", "kernel.mnt.pretest") |
/kernel/trunk/boot/bootcode.inc |
---|
480,6 → 480,40 |
apm_end: |
_setcursor d80x25_top_num, 0 |
; --------------- ACPI --------------------- |
ACPI_LO_RSDP_WINDOW_END = 0x000A0000 |
ACPI_HI_RSDP_WINDOW_START = 0x000E0000 |
acpi: |
xor eax, eax |
mov [es:BOOT_LO.devicesdat_data], eax |
mov [es:BOOT_LO.devicesdat_size], eax |
mov [es:BOOT_LO.acpi_rsdp], eax |
push ds |
mov ds, ax |
mov ax, word [40Eh] |
add ax, 64 |
.check: |
mov ds, ax |
cmp [ds:0], dword 'RSD ' |
jne .next |
cmp [ds:4], dword 'PTR ' |
jne .next |
shl eax, 4 |
mov [es:BOOT_LO.acpi_rsdp], eax |
jmp .end |
.next: |
inc ax |
; skip VRAM and ROM area A0000h to E0000h |
cmp ax, (ACPI_LO_RSDP_WINDOW_END shr 4) |
jne @f |
add ax, ((ACPI_HI_RSDP_WINDOW_START - ACPI_LO_RSDP_WINDOW_END) shr 4) |
@@: ; end of 1Mb? |
or ax, ax |
jnz .check |
.end: |
pop ds |
if ~ defined extended_primary_loader |
;CHECK current of code |
cmp [cfgmanager.loader_block], -1 |
/kernel/trunk/boot/bootstr.inc |
---|
31,9 → 31,18 |
} |
d80x25_top: |
line_full_top |
cur_line_pos = 72 |
; this signature will be replaced with revision number (in kernel.asm) |
store dword '****' at d80x25_top + cur_line_pos |
if __REV__ > 0 |
cur_line_pos = 75 |
store byte ' ' at d80x25_top+cur_line_pos+1 |
rev_var = __REV__ |
while rev_var > 0 |
store byte rev_var mod 10 + '0' at d80x25_top+cur_line_pos |
cur_line_pos = cur_line_pos - 1 |
rev_var = rev_var / 10 |
end while |
store byte ' ' at d80x25_top+cur_line_pos |
store dword ' SVN' at d80x25_top+cur_line_pos-4 |
end if |
space_msg: |
line_space |
42,7 → 51,7 |
; version string |
db 186,32 |
repeat 78 |
load a byte from version+%-1 |
load a byte from kernel_header.signature+%-1 |
if a = 13 |
break |
end if |
/kernel/trunk/bootbios.inc |
---|
0,0 → 1,120 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
;; ;; |
;; Copyright (C) KolibriOS team 2004-2024. All rights reserved. ;; |
;; Distributed under terms of the GNU General Public License ;; |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
$Revision$ |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
;; ;; |
;; 16 BIT ENTRY FROM BOOTSECTOR ;; |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
os_code = code_l - tmp_gdt |
if defined pretest_build |
PREBOOT_TIMEOUT = 0 ; seconds |
else |
PREBOOT_TIMEOUT = 5 |
end if |
use16 |
org 0 |
; struct kernel_header |
jmp start_of_code ; jump |
db 'KolibriOS ' ; signature |
db 'v0.7.7.0+ ',13,10,13,10,0 ; version |
dd B32-KERNEL_BASE ; offset of the kernel's 32-bit entry point |
include "boot/bootstr.inc" ; language-independent boot messages |
include "boot/preboot.inc" |
if lang eq ge |
include "boot/bootge.inc" ; german system boot messages |
else if lang eq sp |
include "boot/bootsp.inc" ; spanish system boot messages |
else if lang eq ru |
include "boot/bootru.inc" ; russian system boot messages |
include "boot/ru.inc" ; Russian font |
else if lang eq et |
include "boot/bootet.inc" ; estonian system boot messages |
include "boot/et.inc" ; Estonian font |
else |
include "boot/booten.inc" ; english system boot messages |
end if |
include "boot/bootcode.inc" ; 16 bit system boot code |
include "bus/pci/pci16.inc" |
include "detect/biosdisk.inc" |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
;; ;; |
;; SWITCH TO 32 BIT PROTECTED MODE ;; |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
; CR0 Flags - Protected mode and Paging |
mov ecx, CR0_PE+CR0_AM |
; Enabling 32 bit protected mode |
sidt [cs:old_ints_h] |
cli ; disable all irqs |
cld |
mov al, 255 ; mask all irqs |
out 0xa1, al |
out 0x21, al |
l.5: |
in al, 0x64 ; Enable A20 |
test al, 2 |
jnz l.5 |
mov al, 0xD1 |
out 0x64, al |
l.6: |
in al, 0x64 |
test al, 2 |
jnz l.6 |
mov al, 0xDF |
out 0x60, al |
l.7: |
in al, 0x64 |
test al, 2 |
jnz l.7 |
mov al, 0xFF |
out 0x64, al |
lgdt [cs:tmp_gdt] ; Load GDT |
mov eax, cr0 ; protected mode |
or eax, ecx |
and eax, 10011111b *65536*256 + 0xffffff ; caching enabled |
mov cr0, eax |
jmp pword os_code:B32 ; jmp to enable 32 bit mode |
align 8 |
tmp_gdt: |
dw 23 |
dd tmp_gdt+KERNEL_BASE |
dw 0 |
code_l: |
dw 0xffff |
dw 0x0000 |
db 0x00 |
dw 11011111b *256 +10011010b |
db 0x00 |
dw 0xffff |
dw 0x0000 |
db 0x00 |
dw 11011111b *256 +10010010b |
db 0x00 |
include "data16.inc" |
if ~ lang eq sp |
diff16 "end of bootcode",0,$+KERNEL_BASE |
end if |
Property changes: |
Added: svn:eol-style |
+native |
\ No newline at end of property |
/kernel/trunk/bootloader/uefi4kos/uefi32kos.asm |
---|
1,6 → 1,6 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
;; ;; |
;; Copyright (C) KolibriOS team 2020-2021. All rights reserved. ;; |
;; Copyright (C) KolibriOS team 2020-2024. All rights reserved. ;; |
;; Distributed under terms of the GNU General Public License ;; |
;; Version 2, or (at your option) any later version. ;; |
;; ;; |
24,8 → 24,6 |
LIP_BUFFER_SIZE = 0x100 |
FILE_BUFFER_SIZE = 0x1000 |
KERNEL_BASE = 0x10000 |
RAMDISK_BASE = 0x100000 |
MAX_FILE_SIZE = 0x10000000 |
CODE_32_SELECTOR = 8 |
650,7 → 648,10 |
and eax, not CR4_PAE |
mov cr4, eax |
push KERNEL_BASE |
mov eax, KERNEL_BASE |
; add the 32-bit entry point |
add eax, [eax+kernel_header.b32_offset] |
push eax |
retn |
.error: |
/kernel/trunk/bootloader/uefi4kos/uefi64kos.asm |
---|
1,6 → 1,6 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
;; ;; |
;; Copyright (C) KolibriOS team 2020-2021. All rights reserved. ;; |
;; Copyright (C) KolibriOS team 2020-2024. All rights reserved. ;; |
;; Distributed under terms of the GNU General Public License ;; |
;; Version 2, or (at your option) any later version. ;; |
;; ;; |
28,8 → 28,6 |
FILE_BUFFER_SIZE = 0x1000 |
KERNEL_TRAMPOLINE = 0x8f80 ; just before BOOT_LO |
KERNEL_BASE = 0x10000 |
RAMDISK_BASE = 0x100000 |
MAX_FILE_SIZE = 0x10000000 |
CODE_32_SELECTOR = 8 |
1010,7 → 1008,10 |
and eax, not CR4_PAE |
mov cr4, eax |
push KERNEL_BASE |
mov eax, KERNEL_BASE |
; add the 32-bit entry point |
add eax, [eax+kernel_header.b32_offset] |
push eax |
retn |
align 16 |
/kernel/trunk/const.inc |
---|
1,6 → 1,6 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
;; ;; |
;; Copyright (C) KolibriOS team 2004-2023. All rights reserved. ;; |
;; Copyright (C) KolibriOS team 2004-2024. All rights reserved. ;; |
;; Distributed under terms of the GNU General Public License ;; |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
218,6 → 218,17 |
_io_map_1 rb 4096 |
ends |
struct kernel_header |
jump rb 3 ; jmp start_of_code |
signature rb 10 ; 'KolibriOS ' |
version rb 19 ; ASCII string |
b32_offset dd ? ; offset of the 32-bit entry point in kernel binary |
; uefi4kos adds the kernel's load address to the offset above and jumps directly |
; to 32-bit entry point, skipping the real mode code part. This way the same |
; KERNEL.MNT file can be booted on BIOS as well as on UEFI. |
ends |
DRIVE_DATA_SIZE = 16 |
OS_BASE = 0x80000000 |
225,9 → 236,9 |
window_data = OS_BASE + 0x0001000 |
background_window = window_data + sizeof.WDATA |
;CDDataBuf = OS_BASE + 0x0005000 |
BOOT_VARS = 0x9000 |
KERNEL_BASE = 0x10000 |
RAMDISK_BASE = 0x100000 |
idts = OS_BASE + 0x000B100 |
WIN_STACK = OS_BASE + 0x000C000 |
248,11 → 259,11 |
SYS_SHUTDOWN = OS_BASE + 0x000FF00 |
TMP_STACK_TOP = 0x007CC00 |
TMP_STACK_TOP = 0x008CC00 |
sys_proc = OS_BASE + 0x007E000 |
sys_proc = OS_BASE + 0x008E000 |
SLOT_BASE = OS_BASE + 0x0080000 |
SLOT_BASE = OS_BASE + 0x0090000 |
VGABasePtr = OS_BASE + 0x00A0000 |
/kernel/trunk/core/apic.inc |
---|
55,8 → 55,7 |
cmp [acpi_lapic_base], 0 |
jz .no_apic |
; non-UEFI loaders don't load DEVICES.DAT and don't initialize [acpi_dev_size] |
if defined UEFI |
; non-UEFI loaders don't load DEVICES.DAT but they zero out [acpi_dev_size] |
cmp [acpi_dev_size], 0 |
jz @f |
stdcall map_io_mem, [acpi_dev_data], [acpi_dev_size], PG_SWR |
63,7 → 62,6 |
mov [acpi_dev_data], eax |
jmp .loaded |
@@: |
end if |
stdcall load_file, dev_data_path |
test eax, eax |
/kernel/trunk/data32.inc |
---|
519,9 → 519,9 |
end if |
; check if kernel fits memmap |
assert $-OS_BASE+0x1000 < TMP_STACK_TOP |
assert $-OS_BASE+PAGE_SIZE < TMP_STACK_TOP |
org (OS_BASE+0x0100000) |
org (OS_BASE + RAMDISK_BASE) |
; Currently size of memory allocated for the ramdisk is fixed. |
; This should be revisited when/if memory map would become more dynamic. |
/kernel/trunk/init.inc |
---|
410,8 → 410,6 |
ret |
endp |
ACPI_HI_RSDP_WINDOW_START = 0x000E0000 |
ACPI_HI_RSDP_WINDOW_END = 0x00100000 |
ACPI_RSDP_CHECKSUM_LENGTH = 20 |
proc acpi_locate_tables uses ebx esi edi |
475,27 → 473,11 |
push ebx |
push edi |
if defined UEFI |
; UEFI loader knows where RSDP is |
mov ebx, [BOOT_LO.acpi_rsdp] |
test ebx, ebx |
jz .done |
mov edi, ebx |
call .check |
else |
movzx ebx, word [0x40E] |
shl ebx, 4 |
lea ecx, [ebx+1024] |
call .check |
test ebx, ebx |
jz @F |
jmp .done |
@@: |
mov ebx, ACPI_HI_RSDP_WINDOW_START |
mov edi, ACPI_HI_RSDP_WINDOW_END |
call .check |
end if |
.done: |
mov [acpi_rsdp_base - OS_BASE], ebx |
test ebx, ebx |
/kernel/trunk/kernel.asm |
---|
1,6 → 1,6 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
;; |
;; Copyright (C) KolibriOS team 2004-2022. All rights reserved. |
;; Copyright (C) KolibriOS team 2004-2024. All rights reserved. |
;; Kernel programmers are acknowledged in CREDITS.TXT |
;; |
;; Data in this file was originally part of MenuetOS project which is |
36,7 → 36,8 |
VESA_1_2_VIDEO = 0 ; enable vesa 1.2 bank switch functions |
; Enabling the next line will enable serial output console |
;debug_com_base = 0x3f8 ; 0x3f8 is com1, 0x2f8 is com2, 0x3e8 is com3, 0x2e8 is com4, no irq's are used |
;debug_com_base = 0x3f8 ; 0x3f8 is com1, 0x2f8 is com2, 0x3e8 is com3, |
; 0x2e8 is com4, no irq's are used |
include "proc32.inc" |
include "kglobals.inc" |
89,49 → 90,12 |
;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
; In bios boot mode the kernel code below is appended to bootbios.bin file. |
; That is a loading and initialization code that also draws the blue screen |
; menu with svn revision number near top right corner of the screen. This fasm |
; preprocessor code searches for '****' signature inside bootbios.bin and |
; places revision number there. |
if ~ defined UEFI |
bootbios: |
if defined extended_primary_loader |
file 'bootbios.bin.ext_loader' |
else if defined pretest_build |
file 'bootbios.bin.pretest' |
else |
file 'bootbios.bin' |
end if |
if __REV__ > 0 |
cur_pos = 0 |
cnt = 0 |
repeat $ - bootbios |
load a byte from % |
if a = '*' |
cnt = cnt + 1 |
else |
cnt = 0 |
end if |
if cnt = 4 |
cur_pos = % - 1 |
break |
end if |
end repeat |
store byte ' ' at cur_pos + 1 |
rev_var = __REV__ |
while rev_var > 0 |
store byte rev_var mod 10 + '0' at cur_pos |
cur_pos = cur_pos - 1 |
rev_var = rev_var / 10 |
end while |
store byte ' ' at cur_pos |
store dword ' SVN' at cur_pos - 4 |
end if |
end if |
; menu with svn revision number near top right corner of the screen. |
include "bootbios.inc" |
use32 |
org $+0x10000 |
org $+KERNEL_BASE |
align 4 |
B32: |
/kernel/trunk/video/cursors.inc |
---|
1389,7 → 1389,6 |
mov [edi + display_t.cr_list.next], ecx |
mov [edi + display_t.cr_list.prev], ecx |
if ~defined UEFI |
cmp [SCR_MODE], word 0x12 |
jne .not_vga |
; TODO |
1409,7 → 1408,6 |
jmp .set |
.not_ega: |
end if |
mov ebx, restore_32 |
mov ecx, move_cursor_32 |
mov edx, Vesa20_putpixel32_new |