Giter Site home page Giter Site logo

eylon-44 / buzz-os Goto Github PK

View Code? Open in Web Editor NEW
6.0 6.0 2.0 1.56 MB

A small x86 32-bit operating system.

License: MIT License

Makefile 2.78% Assembly 8.10% C 85.20% Python 3.92%
assembly basic-operating-system c gas gas-assembly i386 kernel nasm nasm-assembly operating-system os osdev x86 x86-32

buzz-os's People

Contributors

eylon-44 avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

buzz-os's Issues

Kernel size can't be above 0x6c00 bytes/54 sectors

Problem

Currently, the kernel is being loaded as a flat binary by the bootsector at physcial address 0x1000.
The problem is that the kernel size is limited that way.

Because the BIOS loads the bootsector at 0x7c00, and the kernel is being loaded at physcial address 0x1000, we only have 0x7c00-0x1000 memory space for the kernel, i.e. 0x6c00 bytes i.e. 54 sectors.

Loading over 54 sectors will override the bootsector while it's still running, meaning the kernel won't start.

Fix

To fix, the kernel must be loaded above 0x7e00 (the end of the bootsector).
The prefered phyical address to load the kernel in is 0x100000 (1MB).

In order to do that we must load the kernel outside of Real-Mode, as it is limited to 1MB in memory.
The bootsector should switch to Protected-Mode and jump to a C script that loads the kernel at 1MB using ATA PIO.

Unable to use gdb's "ni" command in higher half kernel on call instructions

Problem

Note

This problem is debugger related only, as the program executes as intended on its own but only has issues with gdb.

After jumping to the higher half kernel (0xC0000000), when using gdb's ni (next instruction) command on a call instruction gdb seems to freeze.

This does not occur when

  • I don't load the higher half kernel symbol table (add-symbol-table bin/symbols/kernel.elf 0xC0001000)
  • using the n (next) on C code, or si (step instruction) commands.
  • executed on a jmp instruction (not call)

Fix

Note

I am not sure exactly what is wrong with the symbol table, but even if I am lazy and won't fix this it should be fine as it does not affect the actuall kernel, only a small part of the debugging process that can be replaced with the si command.

Due to the fact that the problem won't occur when not loading the symbol table, and only happens when trying to skip a call instruction, meaning the debugger has to know where the called function starts and ends in order to be able to execute and skip it, the problem must be in the symbol table.

Assumptions

  • I currently link the kernel twice, once for the kernel binary and once for the kernel ELF which I use as a symbol table. It's very possible that somewhere down that path something went wrong. I plan to load the kernel as an ELF and not binary in the future, it may solve it becuse there is really no reason for it to mess up if it uses the same ELF both for execute an debugging.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.