diff options
| author | cpplover0 <osdev555@yandex.com> | 2025-09-21 13:42:24 +0300 |
|---|---|---|
| committer | cpplover0 <osdev555@yandex.com> | 2025-09-21 13:42:24 +0300 |
| commit | 90b4d5be9ef383dc33b6d224f0285229012510fd (patch) | |
| tree | 433c07e415646270297cd0e663c58d2c90d6c5a3 | |
| parent | ae63e2646422e64ce5b6ccfc5fbe8d1e5ff6260b (diff) | |
lua,fastfetch,doomgeneric ports
27 files changed, 631 insertions, 34 deletions
diff --git a/GNUmakefile b/GNUmakefile index 4b1bc3a..10587a7 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -3,7 +3,7 @@ MAKEFLAGS += -rR .SUFFIXES: # Default user QEMU flags. These are appended to the QEMU command calls. -QEMUFLAGS := -m 16G -serial stdio -d int -no-reboot -s -M q35 -smp 12 -enable-kvm -device qemu-xhci -device usb-kbd +QEMUFLAGS := -m 16G -serial stdio -d int -no-reboot -s -M q35 -smp 6 -enable-kvm -device qemu-xhci -device usb-kbd override IMAGE_NAME := orange diff --git a/kernel/include/arch/x86_64/scheduling.hpp b/kernel/include/arch/x86_64/scheduling.hpp index bc0a5d7..0d16444 100644 --- a/kernel/include/arch/x86_64/scheduling.hpp +++ b/kernel/include/arch/x86_64/scheduling.hpp @@ -170,6 +170,7 @@ namespace arch { static void futexwake(process_t* proc, int* lock); static void futexwait(process_t* proc, int* lock, int val); static void loadelf(process_t* proc,char* path,char** argv,char** envp); + }; } } diff --git a/kernel/include/arch/x86_64/syscalls/syscalls.hpp b/kernel/include/arch/x86_64/syscalls/syscalls.hpp index 58fc92a..02b1f2e 100644 --- a/kernel/include/arch/x86_64/syscalls/syscalls.hpp +++ b/kernel/include/arch/x86_64/syscalls/syscalls.hpp @@ -163,6 +163,8 @@ syscall_ret_t sys_free_dma(std::uint64_t phys); syscall_ret_t sys_map_phys(std::uint64_t phys, std::uint64_t flags, std::uint64_t size); +syscall_ret_t sys_timestamp(); + /* Futex */ syscall_ret_t sys_futex_wait(int* pointer, int excepted); syscall_ret_t sys_futex_wake(int* pointer); diff --git a/kernel/include/drivers/hpet.hpp b/kernel/include/drivers/hpet.hpp index a361f25..1646928 100644 --- a/kernel/include/drivers/hpet.hpp +++ b/kernel/include/drivers/hpet.hpp @@ -8,5 +8,6 @@ namespace drivers { public: static void init(); static void sleep(std::uint64_t us); + static std::uint64_t nanocurrent(); }; }
\ No newline at end of file diff --git a/kernel/include/drivers/tsc.hpp b/kernel/include/drivers/tsc.hpp index 0d2ad6a..9b3026f 100644 --- a/kernel/include/drivers/tsc.hpp +++ b/kernel/include/drivers/tsc.hpp @@ -10,5 +10,6 @@ namespace drivers { static void init(); static void sleep(std::uint64_t us); static std::uint64_t currentnano(); + static std::uint64_t currentus(); }; };
\ No newline at end of file diff --git a/kernel/include/etc/list.hpp b/kernel/include/etc/list.hpp index d74e960..25e6d98 100644 --- a/kernel/include/etc/list.hpp +++ b/kernel/include/etc/list.hpp @@ -169,7 +169,7 @@ namespace Lists { } else if (ring.bytelen == 8) { ((long long*)out)[len] = ring.objs[*queue].value1; } - (*queue)++; + *queue = *queue + 1; if (*queue == ring.size) { *queue = 0; *cycle = !(*cycle); diff --git a/kernel/include/generic/vfs/fd.hpp b/kernel/include/generic/vfs/fd.hpp index d9efc06..46d5e26 100644 --- a/kernel/include/generic/vfs/fd.hpp +++ b/kernel/include/generic/vfs/fd.hpp @@ -19,7 +19,7 @@ namespace vfs { } if(!current) { - current = new userspace_fd_t; + current = (userspace_fd_t*)memory::pmm::_virtual::alloc(4096); zeromem(current); current->next = proc->fd; proc->fd = current; diff --git a/kernel/include/generic/vfs/vfs.hpp b/kernel/include/generic/vfs/vfs.hpp index c0f53d2..cf6c74b 100644 --- a/kernel/include/generic/vfs/vfs.hpp +++ b/kernel/include/generic/vfs/vfs.hpp @@ -136,7 +136,7 @@ namespace vfs { if(side == PIPE_SIDE_WRITE) { this->connected_to_pipe_write--; - if(this->connected_to_pipe_write <= 1) { + if(this->connected_to_pipe_write == 0) { this->is_received.clear(); this->is_closed.test_and_set(); } diff --git a/kernel/src/arch/x86_64/interrupts/panic.cpp b/kernel/src/arch/x86_64/interrupts/panic.cpp index 13adec2..c43dc66 100644 --- a/kernel/src/arch/x86_64/interrupts/panic.cpp +++ b/kernel/src/arch/x86_64/interrupts/panic.cpp @@ -23,14 +23,14 @@ void panic(int_frame_t* ctx, const char* msg) { memory::paging::enablekernel(); - // arch::x86_64::process_t* proc = arch::x86_64::cpu::data()->temp.proc; - // if(proc) { - // uint64_t cr2; - // asm volatile("mov %%cr2, %0" : "=r"(cr2) : : "memory"); - // Log::SerialDisplay(LEVEL_MESSAGE_FAIL,"process %d fired cpu exception with vec %d, rip 0x%p, cr2 0x%p, error code 0x%p\n",proc->id,ctx->vec,ctx->rip,cr2,ctx->err_code); - // arch::x86_64::scheduling::kill(proc); - // schedulingSchedule(0); - // } + arch::x86_64::process_t* proc = arch::x86_64::cpu::data()->temp.proc; + if(proc) { + uint64_t cr2; + asm volatile("mov %%cr2, %0" : "=r"(cr2) : : "memory"); + Log::SerialDisplay(LEVEL_MESSAGE_FAIL,"process %d fired cpu exception with vec %d, rip 0x%p, cr2 0x%p, error code 0x%p\n",proc->id,ctx->vec,ctx->rip,cr2,ctx->err_code); + arch::x86_64::scheduling::kill(proc); + schedulingSchedule(0); + } extern locks::spinlock log_lock; log_lock.unlock(); diff --git a/kernel/src/arch/x86_64/scheduling.cpp b/kernel/src/arch/x86_64/scheduling.cpp index efce87b..4742648 100644 --- a/kernel/src/arch/x86_64/scheduling.cpp +++ b/kernel/src/arch/x86_64/scheduling.cpp @@ -296,10 +296,6 @@ void arch::x86_64::scheduling::kill(process_t* proc) { proc->lock.nowaitlock(); proc->status = PROCESS_STATE_ZOMBIE; proc->exit_timestamp = time::counter(); - memory::vmm::free(proc); - memory::pmm::_virtual::free(proc->cwd); - memory::pmm::_virtual::free(proc->name); - memory::pmm::_virtual::free(proc->sse_ctx); } void __scheduling_balance_cpus() { diff --git a/kernel/src/arch/x86_64/syscalls/file.cpp b/kernel/src/arch/x86_64/syscalls/file.cpp index 6bf38e7..9b794e1 100644 --- a/kernel/src/arch/x86_64/syscalls/file.cpp +++ b/kernel/src/arch/x86_64/syscalls/file.cpp @@ -221,6 +221,8 @@ syscall_ret_t sys_close(int fd) { if(fd_s->state == USERSPACE_FD_STATE_PIPE) fd_s->pipe->close(fd_s->pipe_side); + else if(fd_s->state == USERSPACE_FD_STATE_FILE || fd_s->state == USERSPACE_FD_STATE_SOCKET) + vfs::vfs::close(fd_s); if(!fd_s->is_a_tty && fd_s->index > 2) fd_s->state = USERSPACE_FD_STATE_UNUSED; diff --git a/kernel/src/arch/x86_64/syscalls/process.cpp b/kernel/src/arch/x86_64/syscalls/process.cpp index 3cd8f8a..4d6de96 100644 --- a/kernel/src/arch/x86_64/syscalls/process.cpp +++ b/kernel/src/arch/x86_64/syscalls/process.cpp @@ -13,8 +13,16 @@ #include <etc/assembly.hpp> #include <etc/logging.hpp> +#include <drivers/cmos.hpp> + +#include <drivers/tsc.hpp> + #include <etc/errno.hpp> +#include <drivers/hpet.hpp> + +#include <drivers/kvmtimer.hpp> + #include <generic/time.hpp> #include <generic/vfs/vfs.hpp> @@ -39,7 +47,24 @@ syscall_ret_t sys_libc_log(const char* msg) { syscall_ret_t sys_exit(int status) { arch::x86_64::process_t* proc = CURRENT_PROC; proc->exit_code = status; + + userspace_fd_t* fd = proc->fd; + while(fd) { + if(fd->state == USERSPACE_FD_STATE_PIPE) + fd->pipe->close(fd->pipe_side); + else if(fd->state == USERSPACE_FD_STATE_FILE || fd->state == USERSPACE_FD_STATE_SOCKET) + vfs::vfs::close(fd); + userspace_fd_t* next = fd->next; + memory::pmm::_virtual::free(fd); + fd = next; + } + arch::x86_64::scheduling::kill(proc); + memory::vmm::free(proc); + memory::pmm::_virtual::free(proc->cwd); + memory::pmm::_virtual::free(proc->name); + memory::pmm::_virtual::free(proc->sse_ctx); + Log::SerialDisplay(LEVEL_MESSAGE_INFO,"Process %d exited with code %d\n",proc->id,proc->exit_code); schedulingScheduleAndChangeStack(arch::x86_64::cpu::data()->timer_ist_stack,0); __builtin_unreachable(); @@ -355,7 +380,7 @@ syscall_ret_t sys_waitpid(int pid) { syscall_ret_t sys_sleep(long us) { SYSCALL_ENABLE_PREEMPT(); - time::sleep(us); + drivers::tsc::sleep(us); return {0,0,0}; } @@ -371,4 +396,8 @@ syscall_ret_t sys_free_dma(std::uint64_t phys) { syscall_ret_t sys_map_phys(std::uint64_t phys, std::uint64_t flags, std::uint64_t size) { arch::x86_64::process_t* proc = CURRENT_PROC; return {1,0,(std::int64_t)memory::vmm::map(proc,phys,size,PTE_PRESENT | PTE_USER | PTE_RW | flags)}; +} + +syscall_ret_t sys_timestamp() { + return {1,0,(std::int64_t)drivers::hpet::nanocurrent()}; }
\ No newline at end of file diff --git a/kernel/src/arch/x86_64/syscalls/sockets.cpp b/kernel/src/arch/x86_64/syscalls/sockets.cpp index fe23309..d172ac8 100644 --- a/kernel/src/arch/x86_64/syscalls/sockets.cpp +++ b/kernel/src/arch/x86_64/syscalls/sockets.cpp @@ -205,13 +205,16 @@ syscall_ret_t sys_bind(int fd, struct sockaddr_un* path, int len) { arch::x86_64::process_t* proc = CURRENT_PROC; userspace_fd_t* fd_s = vfs::fdmanager::search(proc,fd); - - if(!fd_s) - return {0,EBADF,0}; if(!path) return {0,EINVAL,0}; + if(path->sun_family != AF_UNIX) + return {0,ENOSYS,0}; + + if(!fd_s) + return {0,EBADF,0}; + struct sockaddr_un spath; memset(&spath,0,sizeof(spath)); @@ -226,17 +229,19 @@ syscall_ret_t sys_accept(int fd, struct sockaddr_un* path, int len) { arch::x86_64::process_t* proc = CURRENT_PROC; userspace_fd_t* fd_s = vfs::fdmanager::search(proc,fd); - - if(!fd_s) - return {1,EBADF,0}; struct sockaddr_un spath; if(path) { memset(&spath,0,sizeof(spath)); copy_in_userspace(proc,&spath,path,len > sizeof(spath) ? sizeof(spath) : len); + if(spath.sun_family != AF_UNIX) + return {0,ENOSYS,0}; } + if(!fd_s) + return {1,EBADF,0}; + SYSCALL_ENABLE_PREEMPT(); int status = sockets::accept(fd_s,path != 0 ? &spath : 0); SYSCALL_DISABLE_PREEMPT(); @@ -251,6 +256,9 @@ syscall_ret_t sys_socket(int family, int type, int protocol) { arch::x86_64::process_t* proc = CURRENT_PROC; int new_fd = vfs::fdmanager::create(proc); + if(family != AF_UNIX) + return {0,ENOSYS,0}; + userspace_fd_t* new_fd_s = vfs::fdmanager::search(proc,new_fd); memset(new_fd_s->path,0,2048); diff --git a/kernel/src/arch/x86_64/syscalls/syscalls.cpp b/kernel/src/arch/x86_64/syscalls/syscalls.cpp index 0b9f263..df0bff7 100644 --- a/kernel/src/arch/x86_64/syscalls/syscalls.cpp +++ b/kernel/src/arch/x86_64/syscalls/syscalls.cpp @@ -54,7 +54,8 @@ arch::x86_64::syscall_item_t sys_table[] = { {42,(void*)sys_accept}, {43,(void*)sys_bind}, {44,(void*)sys_socket}, - {45,(void*)sys_listen} + {45,(void*)sys_listen}, + {46,(void*)sys_timestamp} }; arch::x86_64::syscall_item_t* __syscall_find(int rax) { @@ -74,14 +75,14 @@ extern "C" void syscall_handler_c(int_frame_t* ctx) { } else if(!item->syscall_func) { return; } - + syscall_ret_t (*sys)(std::uint64_t D, std::uint64_t S, std::uint64_t d, int_frame_t* frame) = (syscall_ret_t (*)(std::uint64_t, std::uint64_t, std::uint64_t, int_frame_t*))item->syscall_func; syscall_ret_t ret = sys(ctx->rdi,ctx->rsi,ctx->rdx,ctx); if(ret.is_rdx_ret) { ctx->rdx = ret.ret_val; } - if(ret.ret != 0) + if(ret.ret != 0 && item->syscall_num != 46) Log::Raw("non zero ret %d from sys %d\n",ret.ret,item->syscall_num); ctx->rax = ret.ret; diff --git a/kernel/src/drivers/hpet.cpp b/kernel/src/drivers/hpet.cpp index dacda86..81e4849 100644 --- a/kernel/src/drivers/hpet.cpp +++ b/kernel/src/drivers/hpet.cpp @@ -20,21 +20,22 @@ std::uint8_t hpet_is_32_bit = 0; #include <etc/etc.hpp> -std::uint64_t __hpet_counter() { +std::uint64_t __hpet_timestamp() { return hpet_is_32_bit ? *(volatile uint32_t*)(hpet_base + 0xf0) : *(volatile uint64_t*)(hpet_base + 0xf0); } +std::uint64_t drivers::hpet::nanocurrent() { + return __hpet_timestamp() * hpet_clock_nano; +} + extern std::uint16_t KERNEL_GOOD_TIMER; void drivers::hpet::init() { uacpi_table hpet; uacpi_status ret = uacpi_table_find_by_signature("HPET",&hpet); if(ret != UACPI_STATUS_OK) { - if(KERNEL_GOOD_TIMER != KVM_TIMER) { - Log::Display(LEVEL_MESSAGE_FAIL,"Can't continue work, orange requires hpet to work (or kvmclock if present)\n"); - while(1) {asm volatile("hlt");} - } - Log::Display(LEVEL_MESSAGE_WARN,"hpet timer doesn't present\n"); + Log::Display(LEVEL_MESSAGE_FAIL,"Can't continue work, orange requires hpet to work"); + while(1) {asm volatile("hlt");} return; } struct acpi_hpet* hpet_table = ((struct acpi_hpet*)hpet.virt_addr); @@ -48,8 +49,8 @@ void drivers::hpet::init() { } void drivers::hpet::sleep(std::uint64_t us) { - std::uint64_t start = __hpet_counter(); + std::uint64_t start = __hpet_timestamp(); std::uint64_t conv = us * 1000; - while((__hpet_counter() - start) * hpet_clock_nano < conv) + while((__hpet_timestamp() - start) * hpet_clock_nano < conv) asm volatile("nop"); } diff --git a/kernel/src/drivers/tsc.cpp b/kernel/src/drivers/tsc.cpp index 2e504fc..32d1038 100644 --- a/kernel/src/drivers/tsc.cpp +++ b/kernel/src/drivers/tsc.cpp @@ -39,4 +39,8 @@ void tsc::sleep(std::uint64_t us) { std::uint64_t tsc::currentnano() { return (__rdtsc() * 1000000000ULL) / arch::x86_64::cpu::data()->tsc.freq; +} + +std::uint64_t tsc::currentus() { + return currentnano() / 1000; }
\ No newline at end of file diff --git a/kernel/src/generic/vfs/devfs.cpp b/kernel/src/generic/vfs/devfs.cpp index eeb66fd..21de176 100644 --- a/kernel/src/generic/vfs/devfs.cpp +++ b/kernel/src/generic/vfs/devfs.cpp @@ -9,6 +9,8 @@ #include <etc/libc.hpp> #include <etc/logging.hpp> +#include <generic/mm/paging.hpp> + #include <drivers/ioapic.hpp> #include <arch/x86_64/interrupts/irq.hpp> diff --git a/kernel/src/generic/vfs/vfs.cpp b/kernel/src/generic/vfs/vfs.cpp index 4c5ceff..12616ce 100644 --- a/kernel/src/generic/vfs/vfs.cpp +++ b/kernel/src/generic/vfs/vfs.cpp @@ -225,6 +225,21 @@ std::int64_t vfs::vfs::ioctl(userspace_fd_t* fd, unsigned long req, void *arg, i return status; } +void vfs::vfs::close(userspace_fd_t* fd) { + vfs_lock->lock(); + vfs_node_t* node = find_node(fd->path); + if(!node) { vfs::vfs::unlock(); + return; } + + char* fs_love_name = fd->path + strlen(node->path) - 1; + if(!node->close) { vfs::vfs::unlock(); + return; } + + node->close(fd,fs_love_name); + vfs_lock->unlock(); + return; +} + void vfs::vfs::unlock() { vfs_lock->unlock(); } diff --git a/tools/pkg/3/doomgeneric/diff/doomgeneric.diff b/tools/pkg/3/doomgeneric/diff/doomgeneric.diff new file mode 100644 index 0000000..b374e0e --- /dev/null +++ b/tools/pkg/3/doomgeneric/diff/doomgeneric.diff @@ -0,0 +1,250 @@ +diff -Naur doomgeneric/doomgeneric/doomgeneric_orange.c doomgeneric-patched/doomgeneric/doomgeneric_orange.c +--- doomgeneric/doomgeneric/doomgeneric_orange.c 1970-01-01 03:00:00.000000000 +0300 ++++ doomgeneric-patched/doomgeneric/doomgeneric_orange.c 2025-06-28 10:04:14.713386809 +0300 +@@ -0,0 +1,178 @@ ++#include <stdio.h> ++#include <stdlib.h> ++#include <fcntl.h> ++#include <linux/fb.h> ++#include <sys/ioctl.h> ++#include <sys/mman.h> ++#include <unistd.h> ++#include <string.h> ++#include <stdint.h> ++#include <termios.h> ++#include <signal.h> ++ ++#include "doomkeys.h" ++ ++#include "doomgeneric.h" ++ ++int fb_fd; ++int kbd_fd; ++ ++struct fb_var_screeninfo vinfo; ++struct fb_fix_screeninfo finfo; ++unsigned char *fb_ptr; ++ ++ ++struct termios back; ++ ++#include <time.h> ++ ++void __restore() { ++ memset(fb_ptr,0,vinfo.yres * vinfo.xres * vinfo.bits_per_pixel / 8); ++ char dummy[1024]; ++ for(int i = 0;i < 128;i++) { ++ read(STDIN_FILENO,dummy,128); ++ } // clear the queue and go to the latest queue ++ tcsetattr(STDIN_FILENO, TCSANOW, &back); ++ ++} ++ ++void DG_Init() { ++ fb_fd = open("/dev/fb0", O_RDWR); ++ kbd_fd = open("/dev/input0", O_RDWR); ++ ++ char dummy[1024]; ++ for(int i = 0;i < 128;i++) { ++ read(kbd_fd,dummy,128); ++ } // clear the queue and go to the latest queue ++ ioctl(fb_fd, FBIOGET_VSCREENINFO, &vinfo); ++ ioctl(fb_fd, FBIOGET_FSCREENINFO, &finfo); ++ ++ fb_ptr = (unsigned char *)mmap(0, vinfo.yres_virtual * vinfo.xres_virtual * vinfo.bits_per_pixel / 8, ++ PROT_READ | PROT_WRITE, MAP_SHARED, fb_fd, 0); ++ ++ struct termios newt; ++ tcgetattr(STDIN_FILENO, &back); ++ tcgetattr(STDIN_FILENO, &newt); ++ newt.c_lflag &= ~(ICANON | ECHO); ++ tcsetattr(STDIN_FILENO, TCSANOW, &newt); ++ atexit(__restore); ++ ++} ++ ++void DG_DrawFrame() { ++ ++ for(int i = 0;i < DOOMGENERIC_RESY;i++) { ++ uint64_t fb = (uint64_t)fb_ptr;fb += (finfo.line_length * i); ++ memcpy((void*)fb,DG_ScreenBuffer + (DOOMGENERIC_RESX * i),DOOMGENERIC_RESX * 4); ++ } ++ return; ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++} ++ ++void DG_SleepMs(uint32_t ms) { ++ usleep(ms * 1000); ++} ++ ++uint32_t DG_GetTicksMs() { ++ struct timespec ts; ++ clock_gettime(0,&ts); ++ long ms = (ts.tv_nsec / 1000) / 1000; ++ return ms + (ts.tv_sec * 1000); ++ // hello ++} ++ ++const char en_layout_translation[] = { ++ '\0', '\e', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-', '=', '\b', '\t', ++ 'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', 'o', 'p', '[', ']', '\n', '\0', 'a', 's', ++ 'd', 'f', 'g', 'h', 'j', 'k', 'l', ';', '\'', '`', '\0', '\\', 'z', 'x', 'c', 'v', ++ 'b', 'n', 'm', ',', '.', '/', '\0', '\0', '\0', ' ' ++}; ++ ++int DG_GetKey(int* pressed, unsigned char* key) { ++ uint8_t key0 = 0; ++ int status = read(kbd_fd,&key0,1); ++ if(status <= 0) ++ return 0; ++ ++ if(key0 & (1 << 7)) { ++ *pressed = 0; ++ key0 &= ~(1 << 7); // clear release bit ++ } else ++ *pressed = 1; ++ ++ uint8_t doom_key; ++ switch(key0) { ++ case 0x1E: ++ doom_key = KEY_LEFTARROW; ++ break; ++ case 0x20: ++ doom_key = KEY_RIGHTARROW; ++ break; ++ case 0x1F: ++ doom_key = KEY_DOWNARROW; ++ break; ++ case 0x11: ++ doom_key = KEY_UPARROW; ++ break; ++ case 0x12: ++ doom_key = KEY_USE; ++ break; ++ case 0x2A: ++ case 0x37: ++ doom_key = KEY_RSHIFT; ++ break; ++ case 0x01: ++ doom_key = KEY_ESCAPE; ++ break; ++ case 0x39: ++ doom_key = KEY_FIRE; ++ break; ++ default: { ++ doom_key = en_layout_translation[key0]; ++ if(doom_key == '\n') ++ doom_key = 13; ++ break; ++ } ++ } ++ *key = doom_key; ++ return 1; ++} ++ ++void DG_SetWindowTitle(const char * title) { ++ ++} ++ ++int main(int argc, char **argv) ++{ ++ doomgeneric_Create(argc, argv); ++ ++ while (1) ++ { ++ doomgeneric_Tick(); ++ } ++ ++ return 0; ++} ++ +diff -Naur doomgeneric/doomgeneric/i_system.c doomgeneric-patched/doomgeneric/i_system.c +--- doomgeneric/doomgeneric/i_system.c 2025-06-19 16:12:59.641729634 +0300 ++++ doomgeneric-patched/doomgeneric/i_system.c 2025-06-20 20:27:17.156598938 +0300 +@@ -257,11 +257,7 @@ + entry = entry->next; + } + +-#if ORIGCODE +- SDL_Quit(); +- + exit(0); +-#endif + } + + #if !defined(_WIN32) && !defined(__MACOSX__) && !defined(__DJGPP__) +@@ -460,16 +456,7 @@ + } + #endif + +- // abort(); +-#if ORIGCODE +- SDL_Quit(); +- + exit(-1); +-#else +- while (true) +- { +- } +-#endif + } + + // +diff -Naur doomgeneric/doomgeneric/Makefile doomgeneric-patched/doomgeneric/Makefile +--- doomgeneric/doomgeneric/Makefile 2025-06-19 16:12:59.634729371 +0300 ++++ doomgeneric-patched/doomgeneric/Makefile 2025-06-20 20:57:21.688983500 +0300 +@@ -12,17 +12,17 @@ + endif + + +-CC=clang # gcc or g++ +-CFLAGS+=-ggdb3 -Os ++CC=x86_64-orange-gcc # gcc or g++ ++CFLAGS+=-ggdb3 -Os -std=gnu17 + LDFLAGS+=-Wl,--gc-sections + CFLAGS+=-ggdb3 -Wall -DNORMALUNIX -DLINUX -DSNDSERV -D_DEFAULT_SOURCE # -DUSEASM +-LIBS+=-lm -lc -lX11 ++LIBS+=-lm -lc + + # subdirectory for objects + OBJDIR=build + OUTPUT=doomgeneric + +-SRC_DOOM = dummy.o am_map.o doomdef.o doomstat.o dstrings.o d_event.o d_items.o d_iwad.o d_loop.o d_main.o d_mode.o d_net.o f_finale.o f_wipe.o g_game.o hu_lib.o hu_stuff.o info.o i_cdmus.o i_endoom.o i_joystick.o i_scale.o i_sound.o i_system.o i_timer.o memio.o m_argv.o m_bbox.o m_cheat.o m_config.o m_controls.o m_fixed.o m_menu.o m_misc.o m_random.o p_ceilng.o p_doors.o p_enemy.o p_floor.o p_inter.o p_lights.o p_map.o p_maputl.o p_mobj.o p_plats.o p_pspr.o p_saveg.o p_setup.o p_sight.o p_spec.o p_switch.o p_telept.o p_tick.o p_user.o r_bsp.o r_data.o r_draw.o r_main.o r_plane.o r_segs.o r_sky.o r_things.o sha1.o sounds.o statdump.o st_lib.o st_stuff.o s_sound.o tables.o v_video.o wi_stuff.o w_checksum.o w_file.o w_main.o w_wad.o z_zone.o w_file_stdc.o i_input.o i_video.o doomgeneric.o doomgeneric_xlib.o ++SRC_DOOM = dummy.o am_map.o doomdef.o doomstat.o dstrings.o d_event.o d_items.o d_iwad.o d_loop.o d_main.o d_mode.o d_net.o f_finale.o f_wipe.o g_game.o hu_lib.o hu_stuff.o info.o i_cdmus.o i_endoom.o i_joystick.o i_scale.o i_sound.o i_system.o i_timer.o memio.o m_argv.o m_bbox.o m_cheat.o m_config.o m_controls.o m_fixed.o m_menu.o m_misc.o m_random.o p_ceilng.o p_doors.o p_enemy.o p_floor.o p_inter.o p_lights.o p_map.o p_maputl.o p_mobj.o p_plats.o p_pspr.o p_saveg.o p_setup.o p_sight.o p_spec.o p_switch.o p_telept.o p_tick.o p_user.o r_bsp.o r_data.o r_draw.o r_main.o r_plane.o r_segs.o r_sky.o r_things.o sha1.o sounds.o statdump.o st_lib.o st_stuff.o s_sound.o tables.o v_video.o wi_stuff.o w_checksum.o w_file.o w_main.o w_wad.o z_zone.o w_file_stdc.o i_input.o i_video.o doomgeneric.o doomgeneric_orange.o + OBJS += $(addprefix $(OBJDIR)/, $(SRC_DOOM)) + + all: $(OUTPUT) +diff -Naur doomgeneric/doomgeneric/.vscode/settings.json doomgeneric-patched/doomgeneric/.vscode/settings.json +--- doomgeneric/doomgeneric/.vscode/settings.json 1970-01-01 03:00:00.000000000 +0300 ++++ doomgeneric-patched/doomgeneric/.vscode/settings.json 2025-06-27 18:48:57.784407657 +0300 +@@ -0,0 +1,6 @@ ++{ ++ "files.associations": { ++ "compare": "c", ++ "cstdint": "c" ++ } ++} +\ В конце файла нет новой строки
\ No newline at end of file diff --git a/tools/pkg/3/doomgeneric/info.txt b/tools/pkg/3/doomgeneric/info.txt new file mode 100644 index 0000000..8f4c7c9 --- /dev/null +++ b/tools/pkg/3/doomgeneric/info.txt @@ -0,0 +1 @@ +doomgeneric
\ No newline at end of file diff --git a/tools/pkg/3/doomgeneric/pkg.sh b/tools/pkg/3/doomgeneric/pkg.sh new file mode 100644 index 0000000..f497dea --- /dev/null +++ b/tools/pkg/3/doomgeneric/pkg.sh @@ -0,0 +1,28 @@ +. ../../pkg-lib.sh + +rm -rf pack + +mkdir -p pack + +cd pack + +echo $1 + +git clone https://github.com/ozkl/doomgeneric.git --depth=1 +cd doomgeneric + +diff_patch ../../diff/doomgeneric.diff +cd doomgeneric +make -j$(nproc) + +rm -rf "$1/usr/bin/doomgeneric" +cp -rf doomgeneric "$1/usr/bin/doomgeneric" + +old="$(pwd)" +cd "$1/usr/share" +curl -O https://ia804501.us.archive.org/24/items/theultimatedoom_doom2_doom.wad/DOOM.WAD%20%28For%20GZDoom%29/DOOM.WAD +cd "$old" + +cd .. + +cd ../
\ No newline at end of file diff --git a/tools/pkg/3/fastfetch/diff/fastfetch.diff b/tools/pkg/3/fastfetch/diff/fastfetch.diff new file mode 100644 index 0000000..8723663 --- /dev/null +++ b/tools/pkg/3/fastfetch/diff/fastfetch.diff @@ -0,0 +1,201 @@ +diff -Naur fastfetch-2.44.0/CMakeLists.txt fastfetch-patched/CMakeLists.txt +--- fastfetch-2.44.0/CMakeLists.txt 2025-05-23 11:10:12.000000000 +0300 ++++ fastfetch-patched/CMakeLists.txt 2025-05-28 20:54:09.868019074 +0300 +@@ -28,6 +28,8 @@ + elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "DragonFly") + set(FreeBSD TRUE CACHE BOOL "..." FORCE) + set(DragonFly TRUE CACHE BOOL "..." FORCE) ++elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Orange") ++ set(Orange TRUE CACHE BOOL "..." FORCE) + elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "SunOS") + set(SunOS TRUE CACHE BOOL "..." FORCE) + elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Haiku") +@@ -1038,6 +1040,85 @@ + src/util/binary_windows.c + src/util/debug_windows.c + ) ++elseif(Orange) ++ list(APPEND LIBFASTFETCH_SRC ++ src/detection/battery/battery_nosupport.c ++ src/detection/bios/bios_nosupport.c ++ src/common/dbus.c ++ src/common/io/io_unix.c ++ src/common/netif/netif_linux.c ++ src/common/networking/networking_linux.c ++ src/common/processing_linux.c ++ src/detection/bluetooth/bluetooth_nosupport.c ++ src/detection/bluetoothradio/bluetoothradio_nosupport.c ++ src/detection/board/board_nosupport.c ++ src/detection/bootmgr/bootmgr_nosupport.c ++ src/detection/brightness/brightness_nosupport.c ++ src/detection/btrfs/btrfs_nosupport.c ++ src/detection/chassis/chassis_nosupport.c ++ src/detection/cpu/cpu_linux.c ++ src/detection/cpucache/cpucache_nosupport.c ++ src/detection/cpuusage/cpuusage_nosupport.c ++ src/detection/cursor/cursor_nosupport.c ++ src/detection/disk/disk_nosupport.c ++ src/detection/dns/dns_linux.c ++ src/detection/physicaldisk/physicaldisk_nosupport.c ++ src/detection/physicalmemory/physicalmemory_nosupport.c ++ src/detection/diskio/diskio_nosupport.c ++ src/detection/font/font_nosupport.c ++ src/detection/host/host_nosupport.c ++ src/detection/initsystem/initsystem_nosupport.c ++ src/detection/keyboard/keyboard_linux.c ++ src/detection/libc/libc_linux.c ++ src/detection/lm/lm_linux.c ++ src/detection/loadavg/loadavg_nosupport.c ++ src/detection/locale/locale_linux.c ++ src/detection/gamepad/gamepad_nosupport.c ++ src/detection/displayserver/linux/displayserver_linux.c ++ src/detection/displayserver/linux/drm.c ++ src/detection/displayserver/linux/wayland/wayland.c ++ src/detection/displayserver/linux/wayland/global-output.c ++ src/detection/displayserver/linux/wayland/zwlr-output.c ++ src/detection/displayserver/linux/wayland/kde-output.c ++ src/detection/displayserver/linux/wayland/wlr-output-management-unstable-v1-protocol.c ++ src/detection/displayserver/linux/wayland/kde-output-device-v2-protocol.c ++ src/detection/displayserver/linux/wayland/kde-output-order-v1-protocol.c ++ src/detection/displayserver/linux/wayland/xdg-output-unstable-v1-protocol.c ++ src/detection/displayserver/linux/wmde.c ++ src/detection/displayserver/linux/xcb.c ++ src/detection/displayserver/linux/xlib.c ++ src/detection/media/media_linux.c ++ src/detection/memory/memory_linux.c ++ src/detection/mouse/mouse_linux.c ++ src/detection/netio/netio_linux.c ++ src/detection/opengl/opengl_linux.c ++ src/detection/packages/packages_linux.c ++ src/detection/poweradapter/poweradapter_linux.c ++ src/detection/processes/processes_linux.c ++ src/detection/gtk_qt/qt.c ++ src/detection/sound/sound_linux.c ++ src/detection/swap/swap_linux.c ++ src/detection/terminalfont/terminalfont_linux.c ++ src/detection/terminalshell/terminalshell_linux.c ++ src/detection/terminalsize/terminalsize_linux.c ++ src/detection/theme/theme_nosupport.c ++ src/detection/tpm/tpm_linux.c ++ src/detection/uptime/uptime_linux.c ++ src/detection/users/users_nosupport.c ++ src/detection/wallpaper/wallpaper_nosupport.c ++ src/detection/wifi/wifi_nosupport.c ++ src/detection/wm/wm_nosupport.c ++ src/detection/de/de_nosupport.c ++ src/detection/wmtheme/wmtheme_nosupport.c ++ src/detection/camera/camera_linux.c ++ src/detection/zpool/zpool_linux.c ++ src/util/platform/FFPlatform_unix.c ++ src/util/binary_linux.c ++ src/detection/gpu/gpu_nosupport.c ++ src/detection/localip/localip_linux.c ++ src/detection/icons/icons_nosupport.c ++ src/detection/os/os_orange.c ++) + elseif(SunOS) + list(APPEND LIBFASTFETCH_SRC + src/common/dbus.c +@@ -1306,6 +1387,8 @@ + target_compile_definitions(libfastfetch PUBLIC __FreeBSD__) + elseif(SunOS) + target_compile_definitions(libfastfetch PUBLIC _GNU_SOURCE _XOPEN_SOURCE __STDC_WANT_LIB_EXT1__ _FILE_OFFSET_BITS=64 __EXTENSIONS__ _POSIX_C_SOURCE) ++elseif(Orange) ++ target_compile_definitions(libfastfetch PUBLIC _GNU_SOURCE) + elseif(NetBSD) + target_compile_definitions(libfastfetch PUBLIC _GNU_SOURCE) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-char-subscripts") +diff -Naur fastfetch-2.44.0/src/detection/os/os_orange.c fastfetch-patched/src/detection/os/os_orange.c +--- fastfetch-2.44.0/src/detection/os/os_orange.c 1970-01-01 03:00:00.000000000 +0300 ++++ fastfetch-patched/src/detection/os/os_orange.c 2025-05-28 20:17:06.870452695 +0300 +@@ -0,0 +1,6 @@ ++#include "os.h" ++ ++void ffDetectOSImpl(FFOSResult* os) { ++ ffStrbufSetStatic(&os->name,"Orange"); ++ ffStrbufSet(&os->version,&instance.state.platform.sysinfo.release); ++} +diff -Naur fastfetch-2.44.0/src/logo/ascii/orange.txt fastfetch-patched/src/logo/ascii/orange.txt +--- fastfetch-2.44.0/src/logo/ascii/orange.txt 1970-01-01 03:00:00.000000000 +0300 ++++ fastfetch-patched/src/logo/ascii/orange.txt 2025-06-19 21:14:02.373065453 +0300 +@@ -0,0 +1,29 @@ ++ ++ ++ ++ $2::: ++ $2-===+++- ++ $2++++++++ ++ $2=+++++** ++ $2 ******* ++ $1--============= $2 *** **+ ++ $1 ---===---==========++ $2 +*- ++ $1 :--=-:-------=====+++++$2** ++ $1 -===----------======+*$2**$1++++ ++ $1 -====:--------========++++++++ ++ $1 ======-----==========++++++++++ ++ $1-====================+++++++++++ ++ $1-===================++++++++++++ ++ $1:=================++++++++++++++ ++ $1 -===============++++++++++++++++ ++ $1 ============++++++++++++++++++* ++ $1 -=====++++++++++++++++++++++*** ++ $1 +++++++++++++++++++++++****** ++ $1 +++++++++++++++++++++**** ++ $1 +++++++++++++++++++*** ++ $1 +++++++++++++***: ++ $1 *+++++= ++ ++ ++ ++ +diff -Naur fastfetch-2.44.0/src/logo/builtin.c fastfetch-patched/src/logo/builtin.c +--- fastfetch-2.44.0/src/logo/builtin.c 2025-05-23 11:10:12.000000000 +0300 ++++ fastfetch-patched/src/logo/builtin.c 2025-06-01 10:28:23.369453298 +0300 +@@ -3552,6 +3552,7 @@ + .colorKeys = FF_COLOR_FG_RED, + .colorTitle = FF_COLOR_FG_WHITE, + }, ++ + // Orchid + { + .names = {"orchid"}, +@@ -3586,6 +3587,15 @@ + FF_COLOR_FG_DEFAULT, + }, + }, ++ // Orange ++ { ++ .names = {"Orange","orange","OrangeOS","orangeos"}, ++ .lines = FASTFETCH_DATATEXT_LOGO_ORANGE, ++ .colors = { ++ FF_COLOR_FG_RGB "255;140;0", ++ FF_COLOR_FG_RGB "0;255;0", ++ } ++ }, + // OS_Elbrus + { + .names = {"OS Elbrus"}, +diff -Naur fastfetch-2.44.0/src/options/general.h fastfetch-patched/src/options/general.h +--- fastfetch-2.44.0/src/options/general.h 2025-05-23 11:10:12.000000000 +0300 ++++ fastfetch-patched/src/options/general.h 2025-05-28 20:18:10.226986954 +0300 +@@ -16,7 +16,7 @@ + bool detectVersion; + + // Module options that cannot be put in module option structure +- #if defined(__linux__) || defined(__FreeBSD__) || defined(__sun) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__HAIKU__) ++ #if defined(__linux__) || defined(__orange__) || defined(__FreeBSD__) || defined(__sun) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__HAIKU__) + FFstrbuf playerName; + FFDsForceDrmType dsForceDrm; + #elif defined(_WIN32) +diff -Naur fastfetch-2.44.0/src/util/platform/FFPlatform_unix.c fastfetch-patched/src/util/platform/FFPlatform_unix.c +--- fastfetch-2.44.0/src/util/platform/FFPlatform_unix.c 2025-05-23 11:10:12.000000000 +0300 ++++ fastfetch-patched/src/util/platform/FFPlatform_unix.c 2025-05-28 20:56:35.826635192 +0300 +@@ -22,7 +22,7 @@ + static void getExePath(FFPlatform* platform) + { + char exePath[PATH_MAX + 1]; +- #ifdef __linux__ ++ #if defined(__linux__) || defined(__orange__) + ssize_t exePathLen = readlink("/proc/self/exe", exePath, sizeof(exePath) - 1); + if (exePathLen >= 0) + exePath[exePathLen] = '\0';
\ No newline at end of file diff --git a/tools/pkg/3/fastfetch/info.txt b/tools/pkg/3/fastfetch/info.txt new file mode 100644 index 0000000..7758cf8 --- /dev/null +++ b/tools/pkg/3/fastfetch/info.txt @@ -0,0 +1 @@ +fastfetch
\ No newline at end of file diff --git a/tools/pkg/3/fastfetch/pkg.sh b/tools/pkg/3/fastfetch/pkg.sh new file mode 100644 index 0000000..26308b0 --- /dev/null +++ b/tools/pkg/3/fastfetch/pkg.sh @@ -0,0 +1,26 @@ +. ../../pkg-lib.sh + +rm -rf pack + +mkdir -p pack + +cd pack + +echo $1 + +wget https://github.com/fastfetch-cli/fastfetch/archive/refs/tags/2.44.0.tar.gz + +tar -xvf 2.44.0.tar.gz + +cd fastfetch-2.44.0 +diff_patch ../../diff/fastfetch.diff +cd .. + +mkdir -p fastfetch-build +cd fastfetch-build +cmake ../fastfetch-2.44.0 -DCMAKE_TOOLCHAIN_FILE=$(realpath ../../../../toolchain.cmake) -DCMAKE_INSTALL_PREFIX="$1/usr" + +make -j$(nproc) +make install + +cd ..
\ No newline at end of file diff --git a/tools/pkg/3/lua/info.txt b/tools/pkg/3/lua/info.txt new file mode 100644 index 0000000..9ad5171 --- /dev/null +++ b/tools/pkg/3/lua/info.txt @@ -0,0 +1 @@ +lua
\ No newline at end of file diff --git a/tools/pkg/3/lua/pkg.sh b/tools/pkg/3/lua/pkg.sh new file mode 100644 index 0000000..72cc8db --- /dev/null +++ b/tools/pkg/3/lua/pkg.sh @@ -0,0 +1,17 @@ +. ../../pkg-lib.sh + +rm -rf pack +mkdir -p pack + +cd pack + +wget https://www.lua.org/ftp/lua-5.4.7.tar.gz + +tar -xvf lua-5.4.7.tar.gz +cd lua-5.4.7 + +make CC=x86_64-orange-gcc LD=x86_64-orange-ld generic -j$(nproc) +cp -rf src/lua "$1/usr/bin" +cp -rf src/luac "$1/usr/bin" + +cd ..
\ No newline at end of file diff --git a/tools/pkg/toolchain.cmake b/tools/pkg/toolchain.cmake new file mode 100644 index 0000000..2d1d55f --- /dev/null +++ b/tools/pkg/toolchain.cmake @@ -0,0 +1,9 @@ + +set(CMAKE_SYSTEM_NAME Orange) +set(CMAKE_SYSTEM_PROCESSOR x86_64) + +set(CMAKE_C_COMPILER x86_64-orange-gcc) +set(CMAKE_LINKER x86_64-orange-ld) + +set(CMAKE_CXX_EXTENSIONS ON) +set(CMAKE_C_EXTENSIONS ON)
\ No newline at end of file |
