# xnix **Repository Path**: intirain/xnix ## Basic Information - **Project Name**: xnix - **Description**: xnix系统内核 - **Primary Language**: Unknown - **License**: GPL-3.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 4 - **Forks**: 0 - **Created**: 2021-06-09 - **Last Updated**: 2022-01-18 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README ## XNIX kernel ### Overview XNIX is a UNIX-like operating system uses the GPLv3 license. It is a free and open source software, you can get its source code from . ### Change Log 0.066u-boot:     upload `boot.asm` -- it puts 'Loading System' on screen, and die.
    see 'How XNIX and other operating systems startup' if you are
    interested in it. 0.228u-boot:     update `boot.asm`: it reads the second sector of boot-driver (loader) and jumps to it.
    `loader.asm` puts a message 'Starting Loader' on screen, and die. 0.431u-boot:     `loader.asm` switching to long mode. And it set page map to address 0x00000000. It mapped 4MB memories. 0.427u-init:     `boot.asm` read 64 sectors to `0x00007e00`, and `loader.asm` jumps to it after switching to long-mode.
    then, `head.S` displays a message on screen. 0.437u-init:     `head.S` 'return' to init(void), then `init` put a message on screen and return to `head.S`.
    and then `head.S` check return value of init, if not zero, it will put a message on screen.
    if no error, it will halted the CPU. 1.611s-modules:     first stable version!
    copy some files from Cunix, now XNIX can put a formated message on screen. 1.640u-modules:     add support for `%b`, `%w`, `%l`, `%q` support for put hex numbers. 1.706u-int:     initial IDT in `head.S`, it set all handlers at `defualt_int_handler` 1.854u-int:     new `int.c` intial `idt_table[0x80]`, and set handler to `syscall`. it put a message and die. 2.015u-traps:     add handler for divide-error (always divide by zero). `do_divide_error` write in C, it pucs a message and return.
    `divide_error` is an assembly function. it saves all registers, and call `do_divide_error`. then it recover all registers and iretq. 2.156u-modules:     now we can support colouring printf, and I think it's beautifuller than VGA (well...).
    ...and, loader loaded kernel to 0x100000 (1MB). 2.040u-modules:     now we use graphic.c to display PSF font on VGA 320x200 screen. (but it just can display upper characters, can't display some lower character) 2.035u-init:     `fd` also need a `inode_descriptor`, but we forgot it. update it again. 2.154u-boot:     now this boot routine can run on my computer successfully (16GB u-disk). but it can't run on old-PCs which uses floppy. 2.164u-int:     now interrupt handlers and head.S can use print now. 2.325u-modules:     now we can use 1024x768 VBE and vsprintf. this is a big change.
    NOTE that interrupts can also work now, but only divide-error and syscall. 2.327u-int:     write interrupt handlers again. 3.455u-int:     now we support all 20 traps and IRQ. 3.831u-mm:     we can use `alloc_page` and `free_page` to allocate/free memory.
    and don't forget to call `mm_init` first. 3.913u-pci:     I only wrote one function that called `pci_read_config`, and I think PCI is only for this (read device's config). 4.678u-mm:     setup TSS and memory pool. now we can use `kmalloc()` and `kfree()` to allocate memory, not `alloc_page()`. 4.682u-mm:     `alloc_page` returns a wrong address that isn't that it get from `mapping()`. 5.011u-sched:     now `task_init()`, `ktask_create()`, `do_fork()` and `switch_to()` can work: create a new task and switch to it. 5.039u-sched:     write `do_fork()` again and do it easier (and also fixed a bug of kmalloc() - didn't be zero before used). default
    stack size is 64KB. 5.063u-graphic:     using more colors (very beautiful! ) :-) 7.073u-boot:     using CFS to be start-up device, not a binary device (without any file systems).
    now cfs can creat/lsdir/mkdir/rw (but only starts at the start of file).
    and boot jumps to 0x7e60 (0x7e00 + sizeof(struct superblock)), not 0x7e00 (the second sector).
7.110u-boot:     loader uses assembly code to read the root-directory, and search the file 'ksetup'.
    and we just search in the first block of the root-directory.
7.301u-boot:     now loader reads the 'ksetup' to 0x9000 (not 0x8000 in the past), and jump to it.
    it works on my 16G disk (real-machine) and under, but failed on the 1TB disk (real and virtual machine).
    maybe that is too large?
    and, main didn't work on the real-machine. :-( 7.274u-tty:     now we use the vga-text, not that graphic mode because it's buggy :-(. now we can roll that fing screen (I tried to do this for many times)
    and we can put it in colors. 7.411u-sched:     `switch_to` is now working. it can switch in A and B. (but it is not a `schedule()`) :-) 7.660u-keyboard:     now we use a fifo-buffer, to store key scan codes. (but we don't put it to screen) 7.689u-sched:     `switch_to` is now working! it can switch in A and B. (but it is not a `schedule()`) :-), and
    registers will not change! and we are using the array, not the list now because this is simpiler.
    the max tasks is default to be 128, but you can make it bigger anyway (because it's a `**` pointer, not a
    `struct task *` pointer. so it saves the address, and `struct task` allocates when `do_fork()`, not the `task_init()`
7.783u-sched:     `schedule()` is now working! 7.937u-keyboard:     now we can input characters, by `put_keycode()`. 7.968u-pci:     add the function `pci_lspci()` to scan all devices. 8.153u-user:     now we can run in the user-mode. 8.229u-user:     add syscall `sys_print` (will remove it later), and now user can call it
    to put a message on the screen. 8.463u-tty:     move the `tty.c` from module, to the main kernel because we need it, and
    it's not a device. 8.990u-mods:     ahci driver is not working. drunk, do it later. 9.106s-init:     get the time from cmos, and make it to unix time-stamp.    &Nbsp;and this version looks work. 9.085u-mods:     ahci driver is not working... drunk, i'll not fix it. 9.389u-mods:     ahci driver is not working............ 9.808u-mods:     now ide driver is working, and we fixed a bug about the irq:     that the slave-irq's EOI not send. 9.640u-int:     now we use another mode to `register_irq`: a new api that `set_irq`.     `set_irq` just need 2 arguments, it's simplier, and faster. 9.380u-mods:     move the ahci-driver to the dev branch, because it's unworkable (well...). 9.742u-mods:     add support for beep (in pit). 9.742u-mods:     add support for beep (in pit). 9.966u-mods:     add support for serial port: it creates a new tty 'tty1' (COM0). 10.024u-mods:     now `print` can use `com0` and `console` to put, not only one. 9.590u-init:     we now removed all schk. 9.399u-arch:     there's a big problem: it exists when this project creates :-). the     the macros in /include/arch/x86/paging.h and /include/boot/paging.asm     are WRONG. :-(