Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
dadigang
Ventoy
Commits
69da3a59
Commit
69da3a59
authored
May 03, 2022
by
longpanda
Browse files
Reduce the required low memory.
parent
75c6c725
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
8 deletions
+28
-8
GRUB2/MOD_SRC/grub-2.04/grub-core/kern/efi/mm.c
GRUB2/MOD_SRC/grub-2.04/grub-core/kern/efi/mm.c
+21
-4
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_cmd.c
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_cmd.c
+7
-4
No files found.
GRUB2/MOD_SRC/grub-2.04/grub-core/kern/efi/mm.c
View file @
69da3a59
...
@@ -49,8 +49,11 @@ static grub_efi_uintn_t finish_desc_size;
...
@@ -49,8 +49,11 @@ static grub_efi_uintn_t finish_desc_size;
static
grub_efi_uint32_t
finish_desc_version
;
static
grub_efi_uint32_t
finish_desc_version
;
int
grub_efi_is_finished
=
0
;
int
grub_efi_is_finished
=
0
;
/* 160MB 160 * 1024 * 1024 / 4096 */
#define VTOY_CHAIN_MIN_PAGES (160 * 256)
static
grub_efi_uint64_t
g_total_pages
;
static
grub_efi_uint64_t
g_total_pages
;
static
grub_efi_uint64_t
g_required_pages
;
static
grub_efi_uint64_t
g_org_required_pages
;
static
grub_efi_uint64_t
g_new_required_pages
;
/*
/*
* We need to roll back EFI allocations on exit. Remember allocations that
* We need to roll back EFI allocations on exit. Remember allocations that
...
@@ -617,8 +620,21 @@ grub_efi_mm_init (void)
...
@@ -617,8 +620,21 @@ grub_efi_mm_init (void)
else
if
(
required_pages
>
BYTES_TO_PAGES
(
MAX_HEAP_SIZE
))
else
if
(
required_pages
>
BYTES_TO_PAGES
(
MAX_HEAP_SIZE
))
required_pages
=
BYTES_TO_PAGES
(
MAX_HEAP_SIZE
);
required_pages
=
BYTES_TO_PAGES
(
MAX_HEAP_SIZE
);
g_org_required_pages
=
required_pages
;
if
(((
total_pages
-
required_pages
)
>>
2
)
<
VTOY_CHAIN_MIN_PAGES
)
{
if
(
total_pages
>
(
VTOY_CHAIN_MIN_PAGES
<<
2
))
{
g_new_required_pages
=
total_pages
-
(
VTOY_CHAIN_MIN_PAGES
<<
2
);
if
(
g_new_required_pages
>=
8192
)
{
required_pages
=
g_new_required_pages
;
}
}
}
g_total_pages
=
total_pages
;
g_total_pages
=
total_pages
;
g_required_pages
=
required_pages
;
g_
new_
required_pages
=
required_pages
;
/* Sort the filtered descriptors, so that GRUB can allocate pages
/* Sort the filtered descriptors, so that GRUB can allocate pages
from smaller regions. */
from smaller regions. */
...
@@ -677,9 +693,10 @@ grub_efi_get_ram_base(grub_addr_t *base_addr)
...
@@ -677,9 +693,10 @@ grub_efi_get_ram_base(grub_addr_t *base_addr)
}
}
#endif
#endif
void
grub_efi_get_reserved_page_num
(
grub_uint64_t
*
total
,
grub_uint64_t
*
required
)
void
grub_efi_get_reserved_page_num
(
grub_uint64_t
*
total
,
grub_uint64_t
*
org_required
,
grub_uint64_t
*
new_
required
)
{
{
*
total
=
g_total_pages
;
*
total
=
g_total_pages
;
*
required
=
g_required_pages
;
*
org_required
=
g_org_required_pages
;
*
new_required
=
g_new_required_pages
;
}
}
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_cmd.c
View file @
69da3a59
...
@@ -5571,19 +5571,22 @@ static grub_err_t ventoy_cmd_fn_mutex_lock(grub_extcmd_context_t ctxt, int argc,
...
@@ -5571,19 +5571,22 @@ static grub_err_t ventoy_cmd_fn_mutex_lock(grub_extcmd_context_t ctxt, int argc,
static
grub_err_t
ventoy_cmd_dump_rsv_page
(
grub_extcmd_context_t
ctxt
,
int
argc
,
char
**
args
)
static
grub_err_t
ventoy_cmd_dump_rsv_page
(
grub_extcmd_context_t
ctxt
,
int
argc
,
char
**
args
)
{
{
grub_uint64_t
total
;
grub_uint64_t
total
;
grub_uint64_t
required
;
grub_uint64_t
org_required
;
grub_uint64_t
new_required
;
(
void
)
ctxt
;
(
void
)
ctxt
;
(
void
)
argc
;
(
void
)
argc
;
(
void
)
args
;
(
void
)
args
;
#ifdef GRUB_MACHINE_EFI
#ifdef GRUB_MACHINE_EFI
grub_efi_get_reserved_page_num
(
&
total
,
&
required
);
grub_efi_get_reserved_page_num
(
&
total
,
&
org_required
,
&
new_
required
);
grub_printf
(
"Total pages: %llu
\n
"
,
(
unsigned
long
long
)
total
);
grub_printf
(
"Total pages: %llu
\n
"
,
(
unsigned
long
long
)
total
);
grub_printf
(
"Required pages: %llu
\n
"
,
(
unsigned
long
long
)
required
);
grub_printf
(
"OrgReq pages: %llu
\n
"
,
(
unsigned
long
long
)
org_required
);
grub_printf
(
"NewReq pages: %llu
\n
"
,
(
unsigned
long
long
)
new_required
);
#else
#else
(
void
)
total
;
(
void
)
total
;
(
void
)
required
;
(
void
)
org_required
;
(
void
)
new_required
;
grub_printf
(
"Non EFI mode!
\n
"
);
grub_printf
(
"Non EFI mode!
\n
"
);
#endif
#endif
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment