🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: alt.os.development
Article #6

Re: [OSDev] How to switch to long mode in x86 CPUs?

#6
From: Dan Cross
Date: Sat, 21 Nov 2026 19:34
51 lines
3365 bytes
In article <11dsnag$8mf6$1@solani.org>, vantix  <vantix@veloos.invalid> wrote:
>Dan Cross <cross@spitfire.i.gajendra.net> wrote:
>> I'm not sure that follows.  The kernel that does the hardware
>> initialization is not necessarily the same as the one that you
>> actually run in steady state, thus there is no guarantee that
>> the drivers are the same.
>>
>> The critical observation with e.g. LinuxBoot is that having a
>> Real(TM) kernel in the DXE layer means that you are out of the
>> world of buggy proprietary UEFI stacks.  It's also a lot faster
>> because the overall archictecture of UEFI is almost deliberately
>> slow.  Regardless, it is still reliant on UEFI's PEI layer to
>> set up the fabric.
>
>Fair point -- especially on still being tied to PEI for early silicon
>and memory init, which only pushes the proprietary black box one stage
>earlier rather than eliminating it.
>
>> For example, you have to send an RPC to MPIO pointing to the
>> configuration of how you'd like to set up PHYs and PCIe lane
>> pairs; MPIO then does the timing training and so forth.  If you
>> don't have some idea of what the RPCs are (and last time I
>> checked, AMD had replaced the relevant constants with
>> `SIL_RESERVED_12345`-type names in OpenSIL) then it's hard to
>> figure out exactly what is going on.
>
>Seeing `SIL_RESERVED_*` all over OpenSIL was exactly what made me wonder
>how viable clean-room or hobbyist early init actually is on modern Zen
>platforms without vendor NDA docs. Turning PHY and lane configuration
>into opaque firmware RPCs effectively shifts the old BIOS complexity
>into the management cores.
>
>> An interesting consequence of our design is that the kernel
>> image is treated exactly like a "normal" ELF binary, and is
>> loaded at its linked addresses; we invoke `_start` directly in
>> 64-bit mode (with virtual memory enabled) via a normal `CALLQ`
>> instruction.
>
>Thanks for the pointers into phbl and `zen_fabric.c` -- jumping straight
>into a linked 64-bit ELF `_start` with virtual memory already up is a
>really clean cut compared to carrying legacy boot protocols around.
>
>Since phbl already sets up virtual memory before that `CALLQ`, how
>minimal do you keep the initial page tables in the loader before the
>kernel takes over and rebuilds its own mappings?

Sorry, was this generated by an LLM?  It sounds almost entirely
artificial.

	- Dan C.
Technical Details
Message-ID: <11dsrnd$1p2$1@reader2.panix.com>
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!weretis.net!feeder9.news.weretis.net!panix!.POSTED.spitfire.i.gajendra.net!not-for-mail
References: <871pvje5yq.fsf@onesoftnet.eu.org> <11dqmct$73j6$1@solani.org> <11ds7f4$ckd$1@reader2.panix.com> <11dsnag$8mf6$1@solani.org>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!weretis.net!feeder9.news.weretis.net!panix!.POSTED.spitfire.i.gajendra.net!not-for-mail
From: cross@spitfire.i.gajendra.net (Dan Cross)
Newsgroups: alt.os.development
Subject: Re: [OSDev] How to switch to long mode in x86 CPUs?
Date: Sat, 21 Nov 2026 19:34:05 -0000 (UTC)
Organization: PANIX Public Access Internet and UNIX, NYC
Message-ID: <11dsrnd$1p2$1@reader2.panix.com>
References: <871pvje5yq.fsf@onesoftnet.eu.org> <11dqmct$73j6$1@solani.org> <11ds7f4$ckd$1@reader2.panix.com> <11dsnag$8mf6$1@solani.org>
Injection-Date: Sat, 21 Nov 2026 19:34:05 -0000 (UTC)
Injection-Info: reader2.panix.com; posting-host="spitfire.i.gajendra.net:166.84.136.80";
	logging-data="1826"; mail-complaints-to="abuse@panix.com"
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
Originator: cross@spitfire.i.gajendra.net (Dan Cross)