I am gonna be departed to Belorussia in 1 day. I have only 1 day left to do bdz *crying emoji*

This commit is contained in:
Андреев Григорий 2026-04-02 23:44:34 +03:00
parent bc793634cb
commit 4ef561edf5
16 changed files with 83 additions and 3 deletions

2
.gitignore vendored
View File

@ -11,5 +11,7 @@ user/*
user/*.o user/*.o
.idea .idea
cmake-build-debug
CMakeLists.txt
__pycache__ __pycache__
res.txt res.txt

View File

@ -19,7 +19,7 @@ endif
CFLAGS = -fno-pic -ffreestanding -static -fno-builtin -fno-strict-aliasing \ CFLAGS = -fno-pic -ffreestanding -static -fno-builtin -fno-strict-aliasing \
-mno-sse \ -mno-sse \
-I. \ -I. \
-Wall -ggdb -m32 -Werror -fno-omit-frame-pointer -Os -Wall -Wno-unused-result -ggdb -m32 -Werror -fno-omit-frame-pointer -Os
CFLAGS += $(shell $(CC) -fno-stack-protector -E -x c /dev/null >/dev/null 2>&1 && echo -fno-stack-protector) CFLAGS += $(shell $(CC) -fno-stack-protector -E -x c /dev/null >/dev/null 2>&1 && echo -fno-stack-protector)
ASMFLAGS = -m32 -ffreestanding -c -g -I. ASMFLAGS = -m32 -ffreestanding -c -g -I.
@ -141,4 +141,4 @@ clean:
rm -f *.elf *.img *.bin *.raw *.o */*.o tools/mkfs ejudge.sh rm -f *.elf *.img *.bin *.raw *.o */*.o tools/mkfs ejudge.sh
tools/%: tools/%.c tools/%: tools/%.c
gcc -Wall -Werror -g $^ -o $@ gcc -Wall -Wno-unused-result -Werror -g $^ -o $@

View File

@ -20,6 +20,7 @@ static inline void port_word_out(unsigned short port, unsigned short data) {
asm volatile("outw %%ax, %%dx" : : "a" (data), "d" (port)); asm volatile("outw %%ax, %%dx" : : "a" (data), "d" (port));
} }
/* assembler-long, not c-long */
static inline void port_long_out(unsigned short port, unsigned int data) { static inline void port_long_out(unsigned short port, unsigned int data) {
asm volatile("outl %%eax, %%dx" : : "a" (data), "d" (port)); asm volatile("outl %%eax, %%dx" : : "a" (data), "d" (port));
} }

View File

@ -37,6 +37,7 @@ uartputc(char c)
if (!uart) if (!uart)
return; return;
/* What is that *skeleton emoji*? */
for (i = 0; i < 128 && !(port_byte_in(COM1+5) & 0x20); i++) { for (i = 0; i < 128 && !(port_byte_in(COM1+5) & 0x20); i++) {
asm("pause"); asm("pause");
} }

View File

@ -4,7 +4,7 @@
static char* const video_memory = (char*) (KERNBASE + 0xb8000); static char* const video_memory = (char*) (KERNBASE + 0xb8000);
enum colors16 { enum colors16 : unsigned char {
black = 0, black = 0,
blue, blue,
green, green,

View File

@ -31,6 +31,7 @@ struct dirent {
char name[20]; char name[20];
}; };
/* This way we have 512 bytes (1 sector) per dir */
struct dir { struct dir {
char reserved[32]; char reserved[32];
struct dirent entries[ents_in_dir]; struct dirent entries[ents_in_dir];

21
lib/bribki.h Normal file
View File

@ -0,0 +1,21 @@
#pragma once
#include <stdint.h>
/* Bribki are stored here */
typedef struct {
char chars[5];
} DebugBribka;
DebugBribka byte_to_string_bribka(uint8_t byte) {
DebugBribka res = {.chars = {' ', ' ', ' ', ' ', 0}};
int p = 3;
while (byte > 0) {
uint8_t d = byte % 10;
byte /= 10;
res.chars[p] = (char)(d) + '0';
p--;
}
return res;
}

1
mbr.S
View File

@ -11,6 +11,7 @@ _start:
mov %cr0, %eax mov %cr0, %eax
or $1, %eax // 3. enable protected mode or $1, %eax // 3. enable protected mode
mov %eax, %cr0 mov %eax, %cr0
ljmp $SEG_KCODE << 3, $init_32bit // 4. far jump ljmp $SEG_KCODE << 3, $init_32bit // 4. far jump

View File

@ -0,0 +1,53 @@
67FE
63FE
5FFE
5BFE
57FE
53FE
4FFE
4BFE
47FE
43FE
3FFE
3BFE
37FE
33FE
2FFE
2BFE
27FE
23FE
1FFE
1BFE
17FE
13FE
0FFE
0BFE
07FE
03FF
6680
6280
5E80
5A80
5680
5280
4E80
4A80
4680
4280
3E80
3A80
3680
3280
2E80
2A80
2680
2280
1E80
1A80
1680
1280
0E80
0A80
0680
0340
019F

BIN
tasks/float_basic/fp16/solution Executable file

Binary file not shown.

BIN
tasks/float_basic/okay-1/solution Executable file

Binary file not shown.

BIN
tasks/x86_review/anagram/solution Executable file

Binary file not shown.

BIN
tasks/x86_review/count/solution Executable file

Binary file not shown.

BIN
tasks/x86_review/ppm-magic/a.out Executable file

Binary file not shown.

Binary file not shown.

Binary file not shown.