Giter Club home page Giter Club logo

Comments (5)

PerditionC avatar PerditionC commented on August 26, 2024
  • update sys and boot code so sys can extract all necessary offsets without hard coding, possibly by scanning for magic bytes or having the boot sectors have an additional trailer chunk
  • possible update is to have sys move files so PC/MS DOS kernel files first two directory entries and physically on disk [not sure if worth the bloat, since can ensure this by sys to a blank disk]
  • see if possible to update FAT32 boot code to support both LBA and CHS with same boot sector, may require using more than one sector

from kernel.

PerditionC avatar PerditionC commented on August 26, 2024

merge all changes from kernel sys and boot sectors into sys repo and then make it a submodule of the kernel like share, etc.

from kernel.

ecm-pushbx avatar ecm-pushbx commented on August 26, 2024
  • update sys and boot code so sys can extract all necessary offsets without hard coding, possibly by scanning for magic bytes or having the boot sectors have an additional trailer chunk

The current 512-Bytes files per boot sector loader are more compatible and easier to use for other programs, eg my instsect or with dd to write to an image. Albeit, it would be a nice(r) approach to append some trailer. I also did this in #78 for the new exeflat stubs, the stubs have trailing data to point exeflat to where to patch them. But in that case there was no compatibility with other programs to consider.

The unit selection code (/FORCE:BSDRV or /FORCE:BIOSDRV) can be scanned very easily, I do that in instsect already. The FAT12/FAT16 LBA detection (/FORCE:LBA or /FORCE:CHS or /FORCE:AUTO) is also easily scanned.

The loadsegoff is fairly simple to scan for too, just check for a dword matching 60_0000h or 70_0000h and also you can check that there is a jmp far indirect that references the same dword. The check for segment 70h is for boot sector loaders that are modified with the EDR-DOS SYS/boot patches, which changed the default segment too. Eg in https://pushbx.org/ecm/download/edrdos/freedos/drsys35s.zip boot.asm and boot32.asm have the default segment as 70h, but not boot32lb.asm. (It doesn't really matter to SYS because it writes opts->kernel.loadaddr to the variable unconditionally.)

In the OEM boot sector loaders, just scanning for jmp 70h:0 or jmp 70h:200h should be sufficient to find the far branch to the next stage.

The kernel name is okay to leave as a magic offset I think. In instsect I chose to scan for potentially multiple filenames (up to 4 are supported by default) just using a heuristic for valid filenames, which works nicely, but isn't really needed for SYS.

  • see if possible to update FAT32 boot code to support both LBA and CHS with same boot sector, may require using more than one sector

lDOS boot32 does this, it is a combined LBA and CHS, 8086-clean loader. It uses its "FSIBOOT4" stage in the FSINFO sector's large reserved area, which I believe has never been used by anyone else. The current revision has a _COMPAT_FREEDOS mode which allows to load kernel.sys. The addressing and relocation differs from the kernel's current loaders, but the protocol matches what I consider essential to FreeDOS load. The exact same FSIBOOT4 stage can be used by different loader first stages, to load RxDOS.3, lDOS/lDebug, MS-DOS v7.10, or PC-DOS v7.10, all changes for these protocols are confined to the first stage. That includes the addresses to load at and transfer control to, as well as the filenames to search for.

from kernel.

ecm-pushbx avatar ecm-pushbx commented on August 26, 2024

Ah, I think in the PR I forgot that not all of the boot loader sources use the appropriate cpu 8086 or cpu 386 NASM directives. So add that to the pile.

from kernel.

ecm-pushbx avatar ecm-pushbx commented on August 26, 2024

Also relevant: #94

from kernel.

Related Issues (20)

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.