In the PCI driver's device enumeration function, there was a mistake
where a register that is being used in that function wasn't preserved
as it should've been. It didn't cause any errors (at least yet), but
it's better to fix such stuff once found.
The driver manager's function for initializing all builtin drivers is
now being called in the 'stage2_protected_entry'-function, a function
that is called once the GDT is set up and calls all other functions
to get the system to boot.
The first one was a stray letter 'Z' somewhere in the source.
The second one was an error due to some changes being half-done; an
assembly label that did not yet exist was used.
Those two errors are fixed now.
The ACPI driver is not required yet, but some stubs have already been
added to the sources; only to test the driver initialization function
of the driver manager.
In the GDT, the direction in which the stack grows in x86 has been
ignored; for reserving space on the stack, the ESP register was added
to and for cleaning up that space, ESP was subtracted from. That is
obviously wrong and is fixed with this commit.
The newly added function only searchs the "RSD PTR "-signature in the
Main BIOS Area, not in the *Extended* BIOS Area. That should be fixed,
but right now, it's of little relevance.
As legacy BIOS isn't as straightforward to develop using a modern
system, modern emulators/VMs and virtual machine firmware, it was
decided to start work on an UEFI version of the Nightloader.
This commit leaves the not-yet boot-capable, but as far as it's
there already assembling and working legacy BIOS code behind for
later work on this edition.
The implementation of the A20 wraparound check was off in some way,
which is why the new implementation was copied from osdev.org, just
using minor modifications to the label naming.
The value of the GDTR register was set to be 8 bytes too small, with
the effect that an accurate emulation software would error out because
of trying to read over the buffer size, as was noticed when using KVM.
This was due to the perception that the 0th index wouldn't be taken
into account; for that reason, the length of the GDTR was one index
short of what it should've been.
With this change, the driver's setup function only has to be added
to the 'driver_init_functions'-array and it will be called once
'setup_drivers' is called.
The driver setup, which in turn calls all the drivers' setup functions
wasn't being called until now. Now, it is included and being called.
The test text which was used to test some display functions in older
revisions is also gone now.
The setup_drivers routine existed locally for some time now, so now
it also exists in the repository. It has gone through two iterations:
1. The drivers are all listed in a null-terminated array of function
pointers to initialization functions (this didn't work and the time
for debugging just wasn't there).
2. All drivers (currently, only the PCI driver, because that's the
only one that exists) are initialized after each other; their
initialization functions are called manually.
It might be possible that the bug from the first iteration was due to
the memory space being offset by 128 or 256 bytes; it might be useful
to use that concept again because then, it will be easier to add new
drivers. That's not of high importance now, though.
The newly added utility routine reads the content of a known PCI
device's register given the index assigned to the device during
enumeration and the index of the register (and the PCI driver area,
but that is implied).
Because the calculation of the byte offset within the framebuffer was
wrong, the framebuffer could only be written to on the first line.
That is now fixed.
The function which is added with this commit writes a caller-supplied
hexadecimal string of a caller-supplied length to the display, nibble
by nibble, leaving the background black and making the text white.
The error in the GDT caused the whole memory space to be offset by
128B or 256B (It's not entirely sure which one of those). This was
only made visible by later changes, but now it's fixed.
This commit changes the final jump from the bootsector to the second
stage (the partition which gets loaded completely) to be a near jump.
That's important to keep consistency with protected mode.
This commit deletes the gdt.asm for the i386 architecture as it was
quite buggy in that state. In a short while, the real GDT code which
works is going to be committed.
This commit adds a README.md file for the loader partition in the i386
architecture version. The README contains basic information about what
the loader partition has to do and to some degree on how it should be
accomplishing those tasks.
It is just general information which can be useful to have for looking
information up after some time.
This commit adds a build script for the loader partition. Currently,
it is very simplistic, but it works for assembling the entry.asm,
which in turn includes all other files.
This commit adds the entry point for the second stage of the loader.
It currently doesn't contain a lot of code, but it will have to expand
in the next bit of time.
This commit adds the well known primitive memory functions:
- Copy Memory
- Compare Memory for being equal
- Set Memory to a value
It also adds a math utility file at the according location.
This commit adds a check for whether the A20 line is usable; checking
whether more than one megabyte of RAM can be used. If it isn't usable,
it currently isn't activated, but rather, the boot process is stopped.
This commit adds a basic .gitignore which only contains machine code
file endings; files which shouldn't be committed as they're better to
be distributed in other ways.