forked from KolibriOS/kolibrios
Kolibri-F:
- Added sprintf to the kernel. - Added a notification from @notify when there are exceptions in the application. - Added debug files to bochs git-svn-id: svn://kolibrios.org@9051 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
e9c913f9db
commit
3ee8369ec6
@ -1,47 +0,0 @@
|
|||||||
FASM=fasm
|
|
||||||
FLAGS=-m 65536
|
|
||||||
languages=en|ru|ge|et|sp
|
|
||||||
|
|
||||||
.PHONY: all kernel bootloader clean
|
|
||||||
|
|
||||||
all: kernel bootloader bootbios
|
|
||||||
|
|
||||||
kernel: check_lang bootbios
|
|
||||||
@echo "*** building kernel with language '$(lang)' ..."
|
|
||||||
@mkdir -p bin
|
|
||||||
@echo "lang fix $(lang)" > lang.inc
|
|
||||||
@echo "--- building 'bin/kernel.mnt' ..."
|
|
||||||
@$(FASM) $(FLAGS) kernel.asm bin/kernel.mnt
|
|
||||||
@$(FASM) $(FLAGS) -dUEFI=1 kernel.asm bin/kernel.bin
|
|
||||||
@rm -f lang.inc
|
|
||||||
|
|
||||||
bootbios: check_lang
|
|
||||||
@echo "*** building bootbios.bin with language '$(lang)' ..."
|
|
||||||
@mkdir -p bin
|
|
||||||
@echo "lang fix $(lang)" > lang.inc
|
|
||||||
@echo "--- building 'bootbios.bin' ..."
|
|
||||||
@$(FASM) $(FLAGS) bootbios.asm bootbios.bin
|
|
||||||
@rm -f lang.inc
|
|
||||||
|
|
||||||
bootloader: check_lang
|
|
||||||
@echo "*** building bootloader with language '$(lang)' ..."
|
|
||||||
@mkdir -p bin
|
|
||||||
@echo "lang fix $(lang)" > lang.inc
|
|
||||||
@echo "--- building 'bin/boot_fat12.bin' ..."
|
|
||||||
@$(FASM) $(FLAGS) bootloader/boot_fat12.asm bin/boot_fat12.bin
|
|
||||||
@rm -f lang.inc
|
|
||||||
|
|
||||||
|
|
||||||
check_lang:
|
|
||||||
@case "$(lang)" in \
|
|
||||||
$(languages)) \
|
|
||||||
;; \
|
|
||||||
*) \
|
|
||||||
echo "*** error: language is incorrect or not specified"; \
|
|
||||||
exit 1; \
|
|
||||||
;; \
|
|
||||||
esac
|
|
||||||
|
|
||||||
clean:
|
|
||||||
rm -rf bin
|
|
||||||
rm -f lang.inc
|
|
@ -1,7 +0,0 @@
|
|||||||
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({"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 65536 %f %o -dextended_primary_loader=1" .. tup.getconfig("KERPACK_CMD"), "kernel.mnt.ext_loader")
|
|
||||||
tup.rule({"kernel.asm", extra_inputs = {"lang.inc"}}, "fasm -m 65536 %f %o -dUEFI=1 -dextended_primary_loader=1", "kolibri.krn")
|
|
@ -1,39 +0,0 @@
|
|||||||
@echo off
|
|
||||||
cls
|
|
||||||
|
|
||||||
call :Target_kernel
|
|
||||||
|
|
||||||
if ERRORLEVEL 0 goto Exit_OK
|
|
||||||
|
|
||||||
echo There was an error executing script.
|
|
||||||
echo For any help, please send a report.
|
|
||||||
pause
|
|
||||||
goto :eof
|
|
||||||
|
|
||||||
:Target_kernel
|
|
||||||
rem valid languages: en ru ge et sp
|
|
||||||
set lang=en
|
|
||||||
|
|
||||||
echo *** building kernel with language '%lang%' ...
|
|
||||||
|
|
||||||
echo lang fix %lang% > lang.inc
|
|
||||||
fasm -m 65536 bootbios.asm bootbios.bin
|
|
||||||
fasm -m 65536 kernel.asm kernel.mnt
|
|
||||||
fasm -m 65536 kernel.asm kernel.bin -dUEFI=1
|
|
||||||
if not %errorlevel%==0 goto :Error_FasmFailed
|
|
||||||
erase lang.inc
|
|
||||||
goto :eof
|
|
||||||
|
|
||||||
|
|
||||||
:Error_FasmFailed
|
|
||||||
echo error: fasm execution failed
|
|
||||||
erase lang.inc >nul 2>&1
|
|
||||||
echo.
|
|
||||||
pause
|
|
||||||
exit 1
|
|
||||||
|
|
||||||
:Exit_OK
|
|
||||||
echo.
|
|
||||||
echo all operations have been done
|
|
||||||
pause
|
|
||||||
exit 0
|
|
@ -1,22 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
# Compile the KolibriOS kernel on Linux
|
|
||||||
# 2017, The KolibriOS team
|
|
||||||
|
|
||||||
KERPACK=$HOME/kolibrios/programs/other/kpack/kerpack_linux/kerpack
|
|
||||||
KOLIBRI_IMG=$HOME/nightly/kolibri.img
|
|
||||||
|
|
||||||
replace=0; # Replace kernel in the image file?
|
|
||||||
echo 'lang fix en' > lang.inc
|
|
||||||
fasm -m 65536 bootbios.asm bootbios.bin
|
|
||||||
fasm -m 65536 kernel.asm kernel.mnt
|
|
||||||
$KERPACK kernel.mnt kernel.mnt
|
|
||||||
|
|
||||||
[[ $replace -eq 1 ]] && {
|
|
||||||
mntpt=$(mktemp -d)
|
|
||||||
|
|
||||||
sudo mount -o loop $KOLIBRI_IMG $mntpt
|
|
||||||
sudo mount -o remount,rw $mntpt
|
|
||||||
sudo cp kernel.mnt ${mntpt}/KERNEL.MNT
|
|
||||||
sudo umount $mntpt
|
|
||||||
rmdir $mntpt
|
|
||||||
}
|
|
21
kernel/branches/Kolibri-F/build_test.sh
Executable file
21
kernel/branches/Kolibri-F/build_test.sh
Executable file
@ -0,0 +1,21 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
set -e
|
||||||
|
KERPACK=kerpack
|
||||||
|
KOLIBRI_IMG=kolibri.img
|
||||||
|
|
||||||
|
gcc -m32 -c -nostdinc -I../../../programs/develop/ktcc/trunk/libc.obj/source/ -I../../../programs/develop/ktcc/trunk/libc.obj/include -DGNUC -D_BUILD_LIBC -fno-common -Os -fno-builtin -fno-leading-underscore -fno-stack-protector -fno-pie libc/libc.c -o libc/libc.o
|
||||||
|
ld -m elf_i386 -nostdlib -s -Map libc/libc.map -T libc/bin.x libc/libc.o -o libc/libc.bin
|
||||||
|
|
||||||
|
echo 'lang fix en' > lang.inc
|
||||||
|
fasm -m 65536 bootbios.asm bootbios.bin
|
||||||
|
fasm -m 65536 -s debug_bochs/kernel.fas kernel.asm kernel.mnt
|
||||||
|
wine debug_bochs/symbols.exe debug_bochs/kernel.fas debug_bochs/kernel.txt
|
||||||
|
python3 debug_bochs/fastxt2bochs_map.py debug_bochs/kernel.txt
|
||||||
|
|
||||||
|
$KERPACK kernel.mnt kernel.mnt
|
||||||
|
wget http://builds.kolibrios.org/eng/latest-img.7z
|
||||||
|
7z x -y latest-img.7z
|
||||||
|
rm -f latest-img.7z
|
||||||
|
mcopy -D o -i $KOLIBRI_IMG kernel.mnt ::kernel.mnt
|
||||||
|
qemu-system-i386 -m 256 -fda kolibri.img -boot a -enable-kvm
|
||||||
|
|
@ -75,7 +75,6 @@ iglobal
|
|||||||
msg_sel_ker db "kernel", 0
|
msg_sel_ker db "kernel", 0
|
||||||
msg_sel_app db "application", 0
|
msg_sel_app db "application", 0
|
||||||
end if
|
end if
|
||||||
|
|
||||||
endg
|
endg
|
||||||
|
|
||||||
macro save_ring3_context {
|
macro save_ring3_context {
|
||||||
@ -228,6 +227,15 @@ show_error_parameters:
|
|||||||
mov bl, 0x09
|
mov bl, 0x09
|
||||||
.l1:
|
.l1:
|
||||||
mov eax, [msg_fault_sel+ebx*4 - 0x08*4]
|
mov eax, [msg_fault_sel+ebx*4 - 0x08*4]
|
||||||
|
|
||||||
|
; Notify show exeption message
|
||||||
|
pushad
|
||||||
|
ccall LIBC_SPRINTF, except_notify_msg, except_notify_fstr, [current_slot], [edx+TASKDATA.pid], eax
|
||||||
|
mov ebx, except_notify_msg ; exception message for @notify
|
||||||
|
mov ebp, notifyapp ; @notify bin file path
|
||||||
|
call fs_execute_from_sysdir_param ; Execute a @notify to display an exception
|
||||||
|
popad
|
||||||
|
|
||||||
DEBUGF 1, "K : %s\n", eax
|
DEBUGF 1, "K : %s\n", eax
|
||||||
mov eax, [reg_cs3+4]
|
mov eax, [reg_cs3+4]
|
||||||
mov edi, msg_sel_app
|
mov edi, msg_sel_app
|
||||||
@ -335,7 +343,6 @@ show_error_parameters:
|
|||||||
restore reg_esi
|
restore reg_esi
|
||||||
restore reg_edi
|
restore reg_edi
|
||||||
|
|
||||||
|
|
||||||
align 4
|
align 4
|
||||||
lock_application_table:
|
lock_application_table:
|
||||||
push eax ecx edx
|
push eax ecx edx
|
||||||
|
@ -168,6 +168,9 @@ ud_user_message db 'Error: unsupported processor instruction',0
|
|||||||
mtrr_user_message db '"There is a problem with MTRR configuration.\nPerformance can be low" -dW',0
|
mtrr_user_message db '"There is a problem with MTRR configuration.\nPerformance can be low" -dW',0
|
||||||
end if
|
end if
|
||||||
|
|
||||||
|
except_notify_fstr db "'%s (pid %d): %s!' -E", 0 ; String format to write to notify exception message
|
||||||
|
except_notify_msg rb 64 ; The message displayed by notify when an application exception occurs
|
||||||
|
|
||||||
kernel_file_load:
|
kernel_file_load:
|
||||||
; load kernel.mnt to _CLEAN_ZONE
|
; load kernel.mnt to _CLEAN_ZONE
|
||||||
dd 0 ; subfunction
|
dd 0 ; subfunction
|
||||||
|
54
kernel/branches/Kolibri-F/debug_bochs/bochs.bxrc
Normal file
54
kernel/branches/Kolibri-F/debug_bochs/bochs.bxrc
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
plugin_ctrl: unmapped=true, biosdev=true, speaker=true, extfpuirq=true, parallel=true, serial=true
|
||||||
|
config_interface: textconfig
|
||||||
|
display_library: x, options = "gui_debug"
|
||||||
|
memory: host=128, guest=128
|
||||||
|
romimage: file="/usr/share/bochs/BIOS-bochs-latest", address=0x00000000, options=none
|
||||||
|
vgaromimage: file="/usr/share/bochs/VGABIOS-lgpl-latest"
|
||||||
|
boot: floppy
|
||||||
|
floppy_bootsig_check: disabled=0
|
||||||
|
floppya: type=1_44, 1_44="kolibri.img", status=inserted, write_protected=0
|
||||||
|
# no floppyb
|
||||||
|
ata0: enabled=true, ioaddr1=0x1f0, ioaddr2=0x3f0, irq=14
|
||||||
|
ata0-master: type=none
|
||||||
|
ata0-slave: type=none
|
||||||
|
ata1: enabled=true, ioaddr1=0x170, ioaddr2=0x370, irq=15
|
||||||
|
ata1-master: type=cdrom
|
||||||
|
ata1-slave: type=none
|
||||||
|
ata2: enabled=false
|
||||||
|
ata3: enabled=false
|
||||||
|
optromimage1: file=none
|
||||||
|
optromimage2: file=none
|
||||||
|
optromimage3: file=none
|
||||||
|
optromimage4: file=none
|
||||||
|
optramimage1: file=none
|
||||||
|
optramimage2: file=none
|
||||||
|
optramimage3: file=none
|
||||||
|
optramimage4: file=none
|
||||||
|
pci: enabled=1, chipset=i440fx
|
||||||
|
vga: extension=vbe, update_freq=60, realtime=1
|
||||||
|
cpu: count=1:2:1, ips=4000000, quantum=16, model=bx_generic, reset_on_triple_fault=1, cpuid_limit_winnt=0, ignore_bad_msrs=1, mwait_is_nop=0
|
||||||
|
cpuid: level=6, stepping=3, model=3, family=6, vendor_string="AuthenticAMD", brand_string="AMD Athlon(tm) processor"
|
||||||
|
cpuid: mmx=true, apic=xapic, simd=sse2, sse4a=false, misaligned_sse=false, sep=true
|
||||||
|
cpuid: movbe=false, adx=false, aes=false, sha=false, xsave=false, xsaveopt=false, avx_f16c=false
|
||||||
|
cpuid: avx_fma=false, bmi=0, xop=false, fma4=false, tbm=false, x86_64=true, 1g_pages=false
|
||||||
|
cpuid: pcid=false, fsgsbase=false, smep=false, smap=false, mwait=true
|
||||||
|
print_timestamps: enabled=0
|
||||||
|
port_e9_hack: enabled=0
|
||||||
|
private_colormap: enabled=0
|
||||||
|
clock: sync=none, time0=local, rtc_sync=1
|
||||||
|
# no cmosimage
|
||||||
|
log: -
|
||||||
|
logprefix: %t%e%d
|
||||||
|
debug: action=ignore
|
||||||
|
info: action=report
|
||||||
|
error: action=report
|
||||||
|
panic: action=ask
|
||||||
|
keyboard: type=mf, serial_delay=200, paste_delay=100000, user_shortcut=none
|
||||||
|
mouse: type=ps2, enabled=false, toggle=ctrl+f10
|
||||||
|
speaker: enabled=true, mode=sound
|
||||||
|
parport1: enabled=true, file=none
|
||||||
|
parport2: enabled=false
|
||||||
|
com1: enabled=true, mode=null
|
||||||
|
com2: enabled=false
|
||||||
|
com3: enabled=false
|
||||||
|
com4: enabled=false
|
20
kernel/branches/Kolibri-F/debug_bochs/fastxt2bochs_map.py
Normal file
20
kernel/branches/Kolibri-F/debug_bochs/fastxt2bochs_map.py
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
import re
|
||||||
|
import sys
|
||||||
|
if len(sys.argv) < 2 or sys.argv[1].strip() == '':
|
||||||
|
print('error: no input file\nusage: {:s} <file>'.format(sys.argv[0]))
|
||||||
|
exit(-1)
|
||||||
|
inp_path = sys.argv[1].strip()
|
||||||
|
out_path = inp_path + '.map'
|
||||||
|
inp = open(inp_path,'r')
|
||||||
|
inp_text = inp.read()
|
||||||
|
inp.close()
|
||||||
|
regex1 = re.compile(r"[\S]+\:\s0x[\da-fA-F]*")
|
||||||
|
res = re.findall(regex1, inp_text)
|
||||||
|
#print(res)
|
||||||
|
out = open(out_path, 'w')
|
||||||
|
for ln in res:
|
||||||
|
splt = ln.split()
|
||||||
|
sym_addr = int(splt[1],16)
|
||||||
|
sym_name = splt[0][:-1]
|
||||||
|
out.write('{:016x} {:s}\n'.format(sym_addr, sym_name))
|
||||||
|
out.close()
|
BIN
kernel/branches/Kolibri-F/debug_bochs/symbols.exe
Executable file
BIN
kernel/branches/Kolibri-F/debug_bochs/symbols.exe
Executable file
Binary file not shown.
@ -7,6 +7,8 @@
|
|||||||
|
|
||||||
$Revision$
|
$Revision$
|
||||||
|
|
||||||
|
include "libc/libc.inc"
|
||||||
|
|
||||||
include "core/sync.inc" ; macros for synhronization objects
|
include "core/sync.inc" ; macros for synhronization objects
|
||||||
include "core/sys32.inc" ; process management
|
include "core/sys32.inc" ; process management
|
||||||
include "core/sched.inc" ; process scheduling
|
include "core/sched.inc" ; process scheduling
|
||||||
|
19
kernel/branches/Kolibri-F/libc/bin.x
Normal file
19
kernel/branches/Kolibri-F/libc/bin.x
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
OUTPUT_FORMAT(binary)
|
||||||
|
|
||||||
|
LIBC_BASE = 0x800145ef;
|
||||||
|
|
||||||
|
SECTIONS
|
||||||
|
{
|
||||||
|
. = LIBC_BASE;
|
||||||
|
.text :
|
||||||
|
{
|
||||||
|
*(.text);
|
||||||
|
}
|
||||||
|
.data :
|
||||||
|
{
|
||||||
|
*(.data);
|
||||||
|
*(.bss);
|
||||||
|
*(.rodata);
|
||||||
|
}
|
||||||
|
_heap = ALIGN(4);
|
||||||
|
}
|
8
kernel/branches/Kolibri-F/libc/libc.c
Normal file
8
kernel/branches/Kolibri-F/libc/libc.c
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
#include "libtcc/libtcc1.c"
|
||||||
|
#include "stdio/format_print.c"
|
||||||
|
#include "stdio/sprintf.c"
|
||||||
|
#include "stdlib/___chkstk_ms.c"
|
||||||
|
|
||||||
|
__asm__(
|
||||||
|
".include \"math/pow10.s\"\n\t"
|
||||||
|
);
|
6
kernel/branches/Kolibri-F/libc/libc.inc
Normal file
6
kernel/branches/Kolibri-F/libc/libc.inc
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
LIBC_BASE = 0x800145ef
|
||||||
|
LIBC_SPRINTF = LIBC_BASE+0x1568
|
||||||
|
|
||||||
|
assert libc_ptr = LIBC_BASE
|
||||||
|
|
||||||
|
libc_ptr: file 'libc.bin'
|
Loading…
Reference in New Issue
Block a user