Skip to content
This repository has been archived by the owner on Jun 3, 2024. It is now read-only.

Commit

Permalink
imp - Enter contextual reflection upon booting
Browse files Browse the repository at this point in the history
---

We need to actually make the load contexts useful.

---

Type: imp
Breaking: False
Doc Required: False
Part: 1/1
  • Loading branch information
AptiviCEO committed Mar 10, 2024
1 parent 84de368 commit 1d0c50a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions GRILO.Bootloader/Boot/Apps/BootAppInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
//

using GRILO.Boot;
using GRILO.Bootloader.Boot.Apps.Marshaling;
using GRILO.Bootloader.Boot.Diagnostics;

namespace GRILO.Bootloader.Boot.Apps
Expand All @@ -27,6 +28,9 @@ namespace GRILO.Bootloader.Boot.Apps
/// </summary>
public class BootAppInfo
{
#if NET6_0_OR_GREATER
internal BootLoadContext context;
#endif

/// <summary>
/// Bootable file path
Expand Down
1 change: 1 addition & 0 deletions GRILO.Bootloader/Boot/Apps/BootManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ public static void PopulateBootApps()
bootOverrideTitle = metadata["OverrideTitle"]?.ToString() ?? bootable.Title ?? asm.GetName().Name;
bootArgs = metadata["Arguments"]?.ToObject<string[]>() ?? Array.Empty<string>();
bootApp = new(bootFile, bootOverrideTitle, bootArgs, bootable);
bootApp.context = bootContext;
bootApps.Add(bootOverrideTitle, bootApp);
}
}
Expand Down
7 changes: 7 additions & 0 deletions GRILO.Bootloader/Common/BootloaderMain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,14 @@ Controls defined by custom boot style
ScreenTools.Render();
bootloaderScreen.RequireRefresh();
bootloaderScreen.RemoveBufferedPart("Post-Bootloader Screen");
#if NET6_0_OR_GREATER
using (chosenBootApp.context.EnterContextualReflection())
{
chosenBootApp.Bootable.Boot(chosenBootApp.Arguments);
}
#else
chosenBootApp.Bootable.Boot(chosenBootApp.Arguments);
#endif

shutdownRequested = chosenBootApp.Bootable.ShutdownRequested;
DiagnosticsWriter.WriteDiag(DiagnosticsLevel.Info, "Boot app done and shutdown requested is {0}", shutdownRequested);
Expand Down

0 comments on commit 1d0c50a

Please sign in to comment.