SHA256
1
0
forked from pool/elilo
elilo/elilo-high_base_mem.diff
Marcus Meissner 3e5d681a2e Accepting request 1189763 from home:fkastl:gcc14
- Add elilo-c99.patch so that the package conforms to the C99
  standard and builds on i586 with GCC 14.

If the request is OK, please forward it to factory soon-ish so that
we can switch the default compiler.

OBS-URL: https://build.opensuse.org/request/show/1189763
OBS-URL: https://build.opensuse.org/package/show/Base:System/elilo?expand=0&rev=26
2024-08-01 19:46:31 +00:00

67 lines
1.7 KiB
Diff

---
x86_64/system.c | 31 +++++++++++++++++++++++++++++++
1 file changed, 31 insertions(+)
--- a/x86_64/system.c
+++ b/x86_64/system.c
@@ -44,7 +44,9 @@
#include "loader.h"
#include "rmswitch.h"
+#ifndef DEBUG_CREATE_BOOT_PARAMS
#define DEBUG_CREATE_BOOT_PARAMS 0
+#endif
#if DEBUG_CREATE_BOOT_PARAMS
#define DPR(a) do { if (elilo_opt.debug) { Print a; } } while ( 0 )
#else
@@ -100,6 +102,7 @@ UINTN sizeof_init_gdt = sizeof init_gdt;
*/
UINTN high_base_mem = 0x90000;
+VOID *high_base_mem_address = NULL;
/*
* Highest available extended memory address.
@@ -128,6 +131,30 @@ sysdeps_init(EFI_HANDLE dev)
{
DBG_PRT((L"sysdeps_init()\n"));
+ DBG_PRT((L"fix high_base_mem and gdt_addr\n"));
+ while (!high_base_mem_address) {
+ high_base_mem_address = alloc_pages(5, EfiLoaderData,
+ AllocateAddress,
+ (void *)high_base_mem);
+ if (!high_base_mem_address) {
+ if (high_base_mem > (1 << 16)) {
+ high_base_mem -= (1 << 16);
+ } else {
+ /* fall back to previous behavior */
+ high_base_mem = 0x90000;
+ break;
+ }
+ }
+ }
+ if (high_base_mem_address) {
+ VERB_PRT(3, Print(L"high_base_mem="PTR_FMT"\n",
+ high_base_mem_address));
+ gdt_addr.base = high_base_mem + 0x4000;
+ } else {
+ ERR_PRT((L"Failed to allocate high_base_mem, "
+ "stomping over heritage 0x90000.\n"));
+ }
+
/*
* Register our loader(s)...
*/
@@ -624,6 +651,10 @@ sysdeps_create_boot_params(
ERR_PRT((L"bp="PTR_FMT" cmdline="PTR_FMT" initrd="PTR_FMT" cookie="PTR_FMT"",
bp, cmdline, initrd, cookie));
+ if (high_base_mem_address != NULL) {
+ free(high_base_mem_address);
+ high_base_mem_address = NULL;
+ }
if (param_start != NULL) {
free(param_start);
param_start = NULL;