Live data from Hacker News

Writing a BIOS bootloader for 64-bit mode from scratch

thasso.xyz

81–82 of 82 posts

Re: Writing a BIOS bootloader for 64-bit mode from scratch

#81
post #66

Earlier quoted context omitted.

As much as DOS allowed multiple processes, even if only one was executed at the time and there was no multitasking outside of ill-fated MS-DOS 4.0 and various Concurrent DOS products.

You were not there. Multitasking? Xenix. Multitasking DOS? DOS Merge. Pre-emptive multitasking? AmigaOS. DOS 4.0M was task switching. OS/2 2.0? I'm being extremely facetious. Give me a date, and I will tell you what existed. Nothing mainstream existed until windows 3.1. at least on x86/32 There also was OLEC on windows 2, that did run in real mode, but the only thing that took advantage of it was the demos, and sampl…

DOS still allowed you to run child processes, and TSRs were a thing that sometimes caused funny behaviours.

My point was that running your own chosen process as PID1 (or, to be more practical, a minimal init or maybe system v init with single entry for process to run) matches the requirements of running small set of processes just as well as DOS (if you need more, it's IMO more worthwhile to start getting a build of some RTOS for your platform)

Re: Writing a BIOS bootloader for 64-bit mode from scratch

#82
post #4

note that you can switch to long mode directly, without going into protected mode first, with way less code: https://wiki.osdev.org/Entering_Long_Mode_Directly i've had a bootloader for a small 64-bit kernel based on this that fit comfortably into the bootsector, including loading the kernel from disk and setting up vesa modes, no stage2 required.

Oh, cool. I never knew that was possible. Showing my ignorance here, but assuming we're just trying to get to long mode, why would we tour through protected mode at all?

i may be misremembering, but it's likely that intel/amd never documented this one-hop procedure, and it was discovered by the community through a combination of rules-lawyering and experimentation.
Post reply on HN