mirror of
https://github.com/kkk2z/CatOS.git
synced 2024-12-22 02:35:29 +00:00
a
This commit is contained in:
parent
35ef3ad4af
commit
37458067a9
23
Makefile
Normal file
23
Makefile
Normal file
|
@ -0,0 +1,23 @@
|
|||
# Makefile
|
||||
C_SOURCES = $(wildcard kernel/*.c apps/*.c)
|
||||
HEADERS = $(wildcard include/*.h)
|
||||
OBJ = ${C_SOURCES:.c=.o}
|
||||
|
||||
CC = gcc
|
||||
CFLAGS = -m32 -g -ffreestanding -Wall -Wextra
|
||||
|
||||
kernel.bin: boot/boot.o ${OBJ}
|
||||
ld -m elf_i386 -Ttext 0x1000 $^ -o $@ --oformat binary
|
||||
|
||||
%.o: %.c ${HEADERS}
|
||||
${CC} ${CFLAGS} -c $< -o $@
|
||||
|
||||
boot/boot.o: boot/boot.s
|
||||
nasm -f elf32 $< -o $@
|
||||
|
||||
os-image.bin: kernel.bin
|
||||
dd if=/dev/zero bs=512 count=2048 of=os-image.bin
|
||||
dd if=kernel.bin of=os-image.bin conv=notrunc
|
||||
|
||||
clean:
|
||||
rm -f boot/*.o kernel/*.o apps/*.o kernel.bin os-image.bin
|
5
apps/basic_interpreter.c
Normal file
5
apps/basic_interpreter.c
Normal file
|
@ -0,0 +1,5 @@
|
|||
#include "basic.h"
|
||||
|
||||
void execute_basic_program(const char* program) {
|
||||
// BASICプログラム実行コード
|
||||
}
|
5
apps/python_interpreter.c
Normal file
5
apps/python_interpreter.c
Normal file
|
@ -0,0 +1,5 @@
|
|||
#include "python.h"
|
||||
|
||||
void execute_python_script(const char* script) {
|
||||
// Pythonスクリプト実行コード
|
||||
}
|
5
apps/text_editor.c
Normal file
5
apps/text_editor.c
Normal file
|
@ -0,0 +1,5 @@
|
|||
#include "file_system.h"
|
||||
|
||||
void edit_file(const char* filename) {
|
||||
// ファイル編集コード
|
||||
}
|
73
boot/boot.s
Normal file
73
boot/boot.s
Normal file
|
@ -0,0 +1,73 @@
|
|||
; boot.s: A minimal bootloader in assembly for 16-bit real mode
|
||||
BITS 16
|
||||
ORG 0x7C00
|
||||
|
||||
START:
|
||||
; Set up the stack
|
||||
mov ax, 0x07C0
|
||||
mov ss, ax
|
||||
mov sp, 0xFFFF
|
||||
|
||||
; Set up the data segment
|
||||
mov ax, 0x07C0
|
||||
mov ds, ax
|
||||
mov es, ax
|
||||
|
||||
; Set up the GDT
|
||||
cli
|
||||
lgdt [gdt_descriptor]
|
||||
mov eax, cr0
|
||||
or eax, 1
|
||||
mov cr0, eax
|
||||
jmp 08h:code_segment
|
||||
|
||||
BITS 32
|
||||
code_segment:
|
||||
; Set up the segment registers
|
||||
mov ax, data_segment
|
||||
mov ds, ax
|
||||
mov es, ax
|
||||
mov fs, ax
|
||||
mov gs, ax
|
||||
mov ss, ax
|
||||
|
||||
; Set up the stack pointer
|
||||
mov esp, 0x9FC00
|
||||
|
||||
; Call kernel main function
|
||||
call kernel_main
|
||||
|
||||
hang:
|
||||
; Hang the system
|
||||
jmp hang
|
||||
|
||||
; Define the GDT
|
||||
gdt_start:
|
||||
; Null descriptor
|
||||
dd 0
|
||||
dd 0
|
||||
|
||||
; Code segment descriptor
|
||||
dw 0xFFFF
|
||||
dw 0x0000
|
||||
db 0x00
|
||||
db 0x9A
|
||||
db 0xCF
|
||||
db 0x00
|
||||
|
||||
; Data segment descriptor
|
||||
dw 0xFFFF
|
||||
dw 0x0000
|
||||
db 0x00
|
||||
db 0x92
|
||||
db 0xCF
|
||||
db 0x00
|
||||
|
||||
gdt_end:
|
||||
|
||||
gdt_descriptor:
|
||||
dw gdt_end - gdt_start - 1
|
||||
dd gdt_start
|
||||
|
||||
TIMES 510 - ($ - $$) db 0
|
||||
DW 0xAA55
|
7
include/account.h
Normal file
7
include/account.h
Normal file
|
@ -0,0 +1,7 @@
|
|||
#ifndef ACCOUNT_H
|
||||
#define ACCOUNT_H
|
||||
|
||||
void create_account(const char* username, const char* password);
|
||||
void authenticate_user(const char* username, const char* password);
|
||||
|
||||
#endif
|
6
include/basic.h
Normal file
6
include/basic.h
Normal file
|
@ -0,0 +1,6 @@
|
|||
#ifndef BASIC_H
|
||||
#define BASIC_H
|
||||
|
||||
void run_basic_program(const char* program);
|
||||
|
||||
#endif
|
7
include/file_system.h
Normal file
7
include/file_system.h
Normal file
|
@ -0,0 +1,7 @@
|
|||
#ifndef FILE_SYSTEM_H
|
||||
#define FILE_SYSTEM_H
|
||||
|
||||
void init_file_system(void);
|
||||
void read_file(const char* filename);
|
||||
|
||||
#endif
|
8
include/kernel.h
Normal file
8
include/kernel.h
Normal file
|
@ -0,0 +1,8 @@
|
|||
#ifndef KERNEL_H
|
||||
#define KERNEL_H
|
||||
|
||||
void kernel_main(void);
|
||||
void terminal_initialize(void);
|
||||
void terminal_writestring(const char* data);
|
||||
|
||||
#endif
|
7
include/network.h
Normal file
7
include/network.h
Normal file
|
@ -0,0 +1,7 @@
|
|||
#ifndef NETWORK_H
|
||||
#define NETWORK_H
|
||||
|
||||
void init_network(void);
|
||||
void send_http_request(const char* url);
|
||||
|
||||
#endif
|
6
include/python.h
Normal file
6
include/python.h
Normal file
|
@ -0,0 +1,6 @@
|
|||
#ifndef PYTHON_H
|
||||
#define PYTHON_H
|
||||
|
||||
void run_python_script(const char* script);
|
||||
|
||||
#endif
|
7
include/terminal.h
Normal file
7
include/terminal.h
Normal file
|
@ -0,0 +1,7 @@
|
|||
#ifndef TERMINAL_H
|
||||
#define TERMINAL_H
|
||||
|
||||
void terminal_initialize(void);
|
||||
void terminal_writestring(const char* data);
|
||||
|
||||
#endif
|
7
include/vpn.h
Normal file
7
include/vpn.h
Normal file
|
@ -0,0 +1,7 @@
|
|||
#ifndef VPN_H
|
||||
#define VPN_H
|
||||
|
||||
void init_vpn(void);
|
||||
void connect_vpn(const char* server);
|
||||
|
||||
#endif
|
6
include/web.h
Normal file
6
include/web.h
Normal file
|
@ -0,0 +1,6 @@
|
|||
#ifndef WEB_H
|
||||
#define WEB_H
|
||||
|
||||
void fetch_web_page(const char* url);
|
||||
|
||||
#endif
|
9
kernel/account.c
Normal file
9
kernel/account.c
Normal file
|
@ -0,0 +1,9 @@
|
|||
#include "account.h"
|
||||
|
||||
void create_account(const char* username, const char* password) {
|
||||
// アカウント作成コード
|
||||
}
|
||||
|
||||
void authenticate_user(const char* username, const char* password) {
|
||||
// ユーザ認証コード
|
||||
}
|
5
kernel/basic.c
Normal file
5
kernel/basic.c
Normal file
|
@ -0,0 +1,5 @@
|
|||
#include "basic.h"
|
||||
|
||||
void run_basic_program(const char* program) {
|
||||
// BASICプログラム実行コード
|
||||
}
|
9
kernel/file_system.c
Normal file
9
kernel/file_system.c
Normal file
|
@ -0,0 +1,9 @@
|
|||
#include "file_system.h"
|
||||
|
||||
void init_file_system() {
|
||||
// ファイルシステム初期化コード
|
||||
}
|
||||
|
||||
void read_file(const char* filename) {
|
||||
// ファイル読み取りコード
|
||||
}
|
5
kernel/interrupts.c
Normal file
5
kernel/interrupts.c
Normal file
|
@ -0,0 +1,5 @@
|
|||
#include "kernel.h"
|
||||
|
||||
void irq_handler() {
|
||||
// 割り込み処理コード
|
||||
}
|
7
kernel/kernel.c
Normal file
7
kernel/kernel.c
Normal file
|
@ -0,0 +1,7 @@
|
|||
#include "kernel.h"
|
||||
|
||||
void kernel_main(void) {
|
||||
terminal_initialize();
|
||||
terminal_writestring("Hello, kernel World!\n");
|
||||
// 他の初期化コードや機能の呼び出し
|
||||
}
|
5
kernel/keyboard.c
Normal file
5
kernel/keyboard.c
Normal file
|
@ -0,0 +1,5 @@
|
|||
#include "kernel.h"
|
||||
|
||||
void keyboard_handler() {
|
||||
// キーボード入力処理コード
|
||||
}
|
9
kernel/network.c
Normal file
9
kernel/network.c
Normal file
|
@ -0,0 +1,9 @@
|
|||
#include "network.h"
|
||||
|
||||
void init_network() {
|
||||
// ネットワーク初期化コード
|
||||
}
|
||||
|
||||
void send_http_request(const char* url) {
|
||||
// HTTPリクエスト送信コード
|
||||
}
|
5
kernel/python.c
Normal file
5
kernel/python.c
Normal file
|
@ -0,0 +1,5 @@
|
|||
#include "python.h"
|
||||
|
||||
void run_python_script(const char* script) {
|
||||
// Pythonスクリプト実行コード
|
||||
}
|
9
kernel/terminal.c
Normal file
9
kernel/terminal.c
Normal file
|
@ -0,0 +1,9 @@
|
|||
#include "terminal.h"
|
||||
|
||||
void terminal_initialize() {
|
||||
// ターミナル初期化コード
|
||||
}
|
||||
|
||||
void terminal_writestring(const char* data) {
|
||||
// 文字列出力コード
|
||||
}
|
9
kernel/vpn.c
Normal file
9
kernel/vpn.c
Normal file
|
@ -0,0 +1,9 @@
|
|||
#include "vpn.h"
|
||||
|
||||
void init_vpn() {
|
||||
// VPN初期化コード
|
||||
}
|
||||
|
||||
void connect_vpn(const char* server) {
|
||||
// VPN接続コード
|
||||
}
|
5
kernel/web.c
Normal file
5
kernel/web.c
Normal file
|
@ -0,0 +1,5 @@
|
|||
#include "web.h"
|
||||
|
||||
void fetch_web_page(const char* url) {
|
||||
// Webページ取得コード
|
||||
}
|
Loading…
Reference in a new issue