Skip to content

Commit

Permalink
Документация: добавление новой информации (#121)
Browse files Browse the repository at this point in the history
Документация: добавление новой информации
  • Loading branch information
pimnik98 authored Jan 20, 2024
2 parents 809c689 + 25bfd8a commit 6cea06f
Show file tree
Hide file tree
Showing 7 changed files with 1,621 additions and 410 deletions.
54 changes: 47 additions & 7 deletions boot.org
Original file line number Diff line number Diff line change
Expand Up @@ -444,10 +444,10 @@ $(OBJ_DIRECTORY)/%.o : %.cpp | $(OBJ_DIRECTORY)
kernel/src/toys/gfxbench.c \
kernel/src/toys/miniplay.c \
kernel/src/drv/rtl8139.c \
kernel/src/drv/network/virtio_network.c \
kernel/src/fmt/tga.c \
kernel/src/lib/sprintf.c \
kernel/src/debug/ubsan.c \
kernel/src/fmt/tga_extract.c \
kernel/src/drv/disk/floppy.c \
kernel/src/drv/disk/ata_dma.c \
kernel/src/drv/audio/ac97.c \
Expand All @@ -468,24 +468,25 @@ $(OBJ_DIRECTORY)/%.o : %.cpp | $(OBJ_DIRECTORY)
kernel/src/toys/mala.c \
kernel/src/debug/memmeter.c \
kernel/src/drv/disk/ahci.c \
kernel/src/drv/disk/ndpm.c \
kernel/src/drv/disk/ata_pio.c \
kernel/src/toys/minesweeper.c \
kernel/src/toys/calendar.c \
kernel/src/toys/diskctl.c \
kernel/src/lib/utf_conversion.c \
kernel/src/lib/base64.c \
kernel/src/kernel.c \
kernel/src/sys/file_descriptors.c \
kernel/src/net/stack.c \
kernel/src/toys/pavi.c \
$(GAMEBOY) \
# kernel/src/toys/pavi.c \
kernel/src/lib/duktape.c \
kernel/src/lib/kernel.c \
# kernel/src/toys/ducktape.c \
kernel/src/toys/piano.c \
$(wildcard kernel/src/compress/zlib/*.c) \
kernel/src/toys/dino.c \
kernel/src/lib/tui.c \
kernel/src/extra/texplorer.c \
kernel/src/drv/disk/mbr.c \
kernel/src/fs/fat12.c \
kernel/src/fs/smfs.c \
kernel/src/toys/pavi.c \
#+END_SRC

Теперь нам нужен еще "GAMEBOY" (я не знаю зачем нужна его поддежка в ядре):
Expand All @@ -501,13 +502,52 @@ $(OBJ_DIRECTORY)/%.o : %.cpp | $(OBJ_DIRECTORY)
GAMEBOY_OBJS = $(GAMEBOY:.c=.o)
#+END_SRC

И надо определить DIRECTORIES:

#+NAME: make_dirs_var
#+BEGIN_SRC makefile :padline yes
DIRECTORIES = objects/kernel/src \
objects/kernel/asm \
objects/kernel/src/lib \
objects/kernel/src/lib/libstring/src \
objects/kernel/src/lib/libvector/src \
objects/kernel/src/lib/php \
objects/kernel/src/lib/elk \
objects/kernel/src/lib/elk/ext \
objects/kernel/src/lib/freeada \
objects/kernel/src/extra \
objects/kernel/src/sys \
objects/kernel/src/io \
objects/kernel/src/net \
objects/kernel/src/drv \
objects/kernel/src/drv/disk \
objects/kernel/src/debug \
objects/kernel/src/fmt \
objects/kernel/src/drv/audio \
objects/kernel/src/drv/video \
objects/kernel/src/drv/input \
objects/kernel/src/drv/network \
objects/kernel/src/fs \
objects/kernel/src/lib/math \
objects/kernel/src/toys \
objects/kernel/src/gui \
objects/kernel/src/desktop \
objects/kernel/src/user \
objects/kernel/src/ports/gameboy \
objects/kernel/src/mem \
objects/kernel/src/arch/x86 \
# objects/kernel/src/compress/zlib \
#+END_SRC

* Сборка Makefile :noexport:

#+BEGIN_SRC makefile :noweb tangle :tangle MyMakefile :padline yes
all:
@-mkdir -p $(OBJ_DIRECTORY) $(DIRECTORIES)
@$(MAKE) $(KERNEL)

<<make_dirs_var>>

<<make_gameboy_var>>

<<make_sources_var>>
Expand Down
Binary file removed iso/boot/ramdisk
Binary file not shown.
34 changes: 17 additions & 17 deletions kernel/asm/init.s
Original file line number Diff line number Diff line change
Expand Up @@ -25,37 +25,37 @@
.long 800, 600, 32 # Ширина, длина, глубина

.section .bss
.align 16
stack_bottom:
.skip STACK_SIZE
stack_top:
.align 16
stack_bottom:
.skip STACK_SIZE
stack_top:

.section .text

.global __pre_init

__pre_init:
cli
cli

# init FPU
fninit
fldcw (conword)
# init FPU
fninit
fldcw (conword)

call sse_enable
call sse_enable

mov $stack_top, %esp
mov $stack_top, %esp

push %esp
push %ebx
push %esp
push %ebx

xor %ebp, %ebp
xor %ebp, %ebp

call kernel
call kernel

hlt
hlt

conword:
.word 0x37f
.word 0x37f

loop:
jmp loop
jmp loop
32 changes: 16 additions & 16 deletions kernel/asm/link.ld
Original file line number Diff line number Diff line change
Expand Up @@ -11,49 +11,49 @@ SECTIONS
*(.mboot)

CODE_start = .;

*(.text*)

CODE_end = .;
CODE_end = .;
}

.data ALIGN (0x1000) :
{
DATA_start = .;
DATA_start = .;

*(.data*)

DATA_end = .;
DATA_end = .;
}

.rodata ALIGN (0x1000) :
{
RODATA_start = .;
*(.rodata*)
RODATA_start = .;

*(.rodata*)

RODATA_end = .;
RODATA_end = .;
}

.bss ALIGN (0x1000) :
{
*(COMMON)
*(COMMON)

BSS_start = .;

BSS_start = .;

*(.bss*)

BSS_end = .;
BSS_end = .;
}

.debug_symbols ALIGN(0x1000) : {
*(.debug_symbols*)
*(.debug_symbols*)
}

.user ALIGN(0x1000) : {
USER_start = .;
*(.user*)
USER_end = .;
USER_start = .;
*(.user*)
USER_end = .;
}

KERNEL_END_pos = .;
Expand Down
10 changes: 5 additions & 5 deletions kernel/asm/sse.s
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
.section .text
.global sse_check
.global sse_check

sse_check:
mov $0x1, %eax

cpuid

test $(1 << 25), %edx
mov $0x1, %eax

jnz good

xor %eax, %eax
good:
ret
Expand All @@ -24,7 +24,7 @@ sse_enable:
and $~0x04, %ax
or $0x2, %ax
mov %eax, %cr0

mov %cr4, %eax
or $(3 << 9), %ax
mov %eax, %cr4
Expand Down
Loading

0 comments on commit 6cea06f

Please sign in to comment.