You are browsing as a guest. Sign up (or log in) to start making projects!

Assembly os x64 custom kernel and bootloader

  • 54 Devlogs
  • 403 Total hours

Os in assembly custom kernel , shell and 2 stage bootloader Will be Tsted on my PC and custom LLM chat engine in assembly like llama.cpp tokenizer concetxt vector calculator etc.

Open comments for this post

6h 44m 28s logged

Ok i have successfully made detokenizator which goes trough the token id book that many times as a token because token id =id book entries untill the token, and also i have made matrix–vector dot product calculator which goes through all token ids and translates them into a big amount of vectors which then in another step i will be doing comparison hbuf with all these vectors to find a token with lovest diff and that will be our output token, but big but it still isn’t tested i will be testing it when i will have the full command done for now i just want to live in an illusion that my code is error free

0
0
16
Open comments for this post

10h 43m 34s logged

Today i got help from my great teacher and was able to do more than usual, today i did hbuf setuper it basically just calls fcon 576 times to translate the values from 16 bit quantization to 32 then i have written a function RMSNorm which uses hbuf and weights you give it and calculates rescaled feuture vector

3
0
133
Open comments for this post

9h 25m 26s logged

Today i am a bit better so i did the harder part that is needed to be done, i have made tensor info gatherer, basically each layer has 9 tensor info, so for my model 9*30 tensor infos, also the string i am comparing in the function needs to be like [blk.][number of current layer in decimal(use bintrn)][specification string], it still doesn’t work but it will be something like infinite inc loop to memory or division basically smth that generates general protection, also because I was smart i saved my previous error where i used tensor info praser so i didn’t Neded to reerite it.

0
0
17
Open comments for this post

13h 59m 52s logged

Ok so uuh those 5l of Kofola wasn’t a great ide today i got a fever or flu or whatever the thing that makes you feel hot but i made some progress even though it was hard cuz i had a headache and couldn’t do anything so what i did i made a f16 to 32 translation and you might say hmm but this doesn’t seem too vomplex first of all i had to split registers inro 3 sections do calculation on them and the glue them together to xmm0 but what you might not know is if you don’t allow xmm is 32 bit mode it will throw gp an fuck the whole code and you cant know why it crashed because whole runtime in crash log looks absolutely normal for some reason also I don’t actually care about the time anymore i just want to get this working so i can get a laptop to not code on my phone

2
0
41
Open comments for this post

10h 10m logged

Tokenizer done now for vector context calculator . The tokenizer was somwhat refusing to work but one rewrite later it subdued to my power it is split into teo parts the text decoder and encoder decoder formats the words for encoder and encoder finds tokens for the words

0
0
46
Open comments for this post

9h 20m 41s logged

Ok bigg devlog todat i decided to speedrun this so i can ship this project as fast as possible also changed the model to a smaller native f16 quantization and It works which is a proof that anyone can put their model into sofaos and run it rn it just loops troug metadata to find general architecture

0
0
15
Open comments for this post

5h 16m 17s logged

Hello good news today have started on setting up the data from GGUF rn it is just getting version metadata entryes and tensor entry, I Also started a loop for the metadata entryes but just started this one was easy cuz it has prefixed everything 4 bytes gguf magic 4 version 8 metadata entryes and 8 tensor info entry which makes 24 bytes in total

0
0
16
Open comments for this post

6h 56m logged

Ok I give up on writing it, cuz GGUF file structure is ass and I can’t write it in fucking the way it should be I am going to pull a cheap trick by putting a control string at the end of the file to know when the file is ending below is structure of how the whole file should look like

0
0
13
Open comments for this post

8h 28m 27s logged

Ok I was figuring out how to load the gguf file which I think I got right but I can’t find a way to know how many sectors to pull out of disk because the metadata in gguf aren’t always the same nor size of the entries are the same so there is now way to know when they end and I need them to find the size of the file in picture you can see how the metadata is structured

0
0
23
Open comments for this post

6h 55m 7s logged

Ok so uuuh….. Somehow secr fucked itself up and I had to fix it the thing is that from 0xffffff… Somehow one of the f magically dissapeared and I had to basically trace whole Drs sector to find what was wrong also waking aps for some reason isn’t working even I am using textbook code to wake it up I now have no idea why is it not working mameybie I will gat back to it at the end and now do the special function because everyone on stardance for some reason started doing X64 os so I had to come up with something radical, I am going to make a full local assembly llm chat engine like llama.cpp fully in assembly for sofaos all things from scratch tokenizer network loading calculation and other stuff I have nothing really to show so just enjoy some random pic from my gallery

0
0
18
Open comments for this post

9h 51m 34s logged

Spent I don’t even know how much time I lost track of time doing this shit I did it whole night I am happy that I am going to sleep at 12:33 the error was that I wasn’t sending enough sipis so the aps didn’t actually wake up but I didn’t knew that so I was tracing the whole os to find the error then I actually checked on internet how should it be done and that’s when I was finally able to fix this simple ass problem

0
0
11
Open comments for this post

9h 25m 59s logged

Finished the core wakeup now I can wakeup any numver of cores that I have and now I am going to make some serious multitasking i still need to do the trampoline to launch the cores to 64 bit mode but they will be fast also the limit of cores for legacy PCs is 255 but it is still engouh to wake up and epyc

0
0
16
Open comments for this post

7h 44m 19s logged

Ok I have found the number of cores which is a huge milestone now I need to find what is the bsp to not wakeup already woken up core number of cores is in a memory buffer 256 bytes big cous the CPU doesn’t have enough IDs for more than 255 cores so even In future it will be ok

0
0
10
Open comments for this post

8h 2m 12s logged

PCI bus enumeration, done by brute-force — loop over every bus, device, and function number, write a config address to IO port 0xCF8, read whatever comes back from 0xCFC. All ones means nothing’s there; anything else gets recorded. Once every device on the bus is found, it scans the results for a class code matching AHCI (SATA storage), grabs that device’s BAR5, and starts bringing the controller up — reset bit set, poll until it clears, enable global host control. This is what opens up actual disk read/write instead of relying on BIOS

0
0
9
Open comments for this post

12h 29m 13s logged

I added so when the user types it automatically moves screen to VGA buffer so it doesn’t overwrite bad memmory and implemented this thing for cpritn too so if you are near end of the screen it automatically moves up (number of rewrites this function took 3) in pic you can see how cpritn automatically moved up

0
0
6
Open comments for this post

9h 52m 27s logged

Added translate which translates number from hex to dec and also the other way and command to see what in memory I had to make a new function to accept hex and Dec and figure out which one is which than grab byte from memory not 8 bytes was stuck on that then output which was easy cus I already have function for that then added translate which just uses hexbin function for Dec and bin for hex and outputs in the other format also I don’t have much time to code because I am a slave on a construction now and I get paid absolute minimum

0
0
8
Open comments for this post

7h 38m 40s logged

Ok so today I have made saythis command which is basically echo (system says what you tell it to) and whatincr which basically spits out what is in control registers which might be useful for some repairman or whatever but I had to make new functions like bintrn which turns normal pc number into decimal ASCII string but I had the loop wrong it started at wrong point but now it should work

0
0
12
Open comments for this post

14h 4m 17s logged

Limited coding time cuz i am on vacation in Berlin but made progress on scrolling — the screen now scrolls down properly when text overflows the bottom. Scroll up still doesn’t exist the first attempt bookkeeping was so tangled it wasn’t worth saving, so that one got scrapped rather than patched.

0
0
13
Open comments for this post

9h 18m 23s logged

Completed the command system — a compare routine (cmper) checks whatever’s typed against a table of known command strings and jumps straight to that command’s handler on a match. First command wired up was cls, mostly because the screen clearer routine already existed. Everything else gets added the same way from here.

0
0
12
Open comments for this post

5h 10m 7s logged

Terminal UI is functional now — Enter does something, and extended interrupts (arrow keys) get decoded properly instead of coming through as garbage. Also added a distinct sys response visual state versus just characters The color choices right now are rough — need to actually look into color theory instead of guessing.

0
0
28
Open comments for this post

3h 10m 44s logged

Forgot to say this last time, but there’s now a basic (not working) concept of user input reaching the system layer — just the shape of how it should work, not the real thing yet. Finishing that up next so it actually looks like a terminal. Worth sayi the cursor (curzor) tracking and the cls screen-clear command both went in a little earlier and are what everything since has been built on top of.

4
0
83
Open comments for this post

4h 22m 3s logged

Keyboard handler is fixed. Can freely type now. thought: there’s currently nothing stopping unrestricted writes from going past where they should, which means someone could in theory type their way into overwriting parts of the running system. Needs boundaries before this goes further.

0
0
13
Open comments for this post

6h 30m 1s logged

Finally transitioned into 64-bit mode, so the actual OS can start getting written now. Not going to explain every step in detail since it’s always the same , but simple: built page tables using 2MB pages so the fourth paging level (the 4KB page table) could be skipped entirely, set up the stack, and did the rest of the long-mode setup (PAE, the EFER long-mode-enable bit, then paging itself) before the far jump into 64-bit code.

0
0
11
Open comments for this post

6h 10m 40s logged

Big milestone — got it running on an actual physical machine instead of just QEMU. Had to go back into stage 1 and loosen a couple of assumptions that only held up in an emulator; real BIOSes are pickier than QEMU’s about a few things. Nothing structural changed, just less forgiving case to handle.

0
0
9
Open comments for this post

14h 59m 58s logged

Pulled an all-nighter and finally got a boot working — turned out QEMU was set to -nographic, so my VGA output was being generated correctly but never actually displayed. Once I fixed that, i found a new problem up: once in 32-bit mode, my code started printing from the top of the screen and overwriting text the BIOS had already written. Progress, but a new bug was right behind the old one. Still it doesn’t want to move forward it should print k at the end so something is wrong I am going to investigate It.

0
0
9
Open comments for this post

16h 11m 47s logged

I hate this stupid code , literally the only thing I do is find an error, find what could possibly cause it, fix it, and it still doesn’t work. Do that a hundred times, and it turns out the BIOS — which promises not to touch DL — corrupts it anyway during interrupt 0x16. Whatever. Still not fully working, but at least I’ve got the core structure for moving into 32-bit mode. I hate this — why do all x64 processors have to wake up going “uhm I think I’m an IBM processor from 1967” instead of just dropping into 64-bit like ARM does? Also my PC screen broke, so now I’m SSH’d in through Termux to code this thing. I hate assembly but low-key need a new PC — that old Compaq 6510b with 2GHz and two cores isn’t cutting it anymore.

0
0
9
Open comments for this post

3h 51m 57s logged

Getting close to 32-bit mode. Added a memory tester using INT 0x15, EAX=0xE820 so the OS actually knows how much RAM exists and where, instead of assuming. Also built two different A20 gate openers — the fast method through port 0x92 first, and a manual read/write test on mirrored addresses as a fallback if that doesn’t take. If one fails, the other starts

0
0
13
Open comments for this post

5h 57m 57s logged

Went back and leaned stage 1 more heavily on the shared print routine (cpritn) instead of duplicating printing logic, and tightened up the handoff into stage 2. Stage 2 now loads the kernel using a precomputed Disk Address Packet instead of recalculating the sector count and offset from scratch every single time it runs.

0
0
15
Open comments for this post

2h 0m 3s logged

Added LBA (logical block addressing) table implementation — sadly no love for old hard drives that don’t support it. Also added a test so if the computer’s too old to do extended reads, it just refuses to boot instead of silently corrupting stuff. Auto-retry if something goes wrong, and it jumps to address 0x7E00, where the end of the 2# stage starts.

0
0
17

Delete project?

Are you sure you want to permanently delete this project? This action cannot be undone.

All devlogs, followers, and associated data will be removed.

Followers

Loading…