Skip to content

Commit

Permalink
Fix constants for secureloader sizes
Browse files Browse the repository at this point in the history
  • Loading branch information
lxylxy123456 committed Oct 12, 2022
1 parent 54c53c8 commit 19e0c15
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions xmhf/src/xmhf-core/xmhf-bootloader/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -938,8 +938,8 @@ void cstartup(multiboot_info_t *mbi){

//fill in "sl" parameter block
{
//"sl" parameter block is at hypervisor_image_baseaddress + 0x10000
slpb = (SL_PARAMETER_BLOCK *)((u32)hypervisor_image_baseaddress + 0x10000);
//"sl" parameter block is at hypervisor_image_baseaddress + 0x20000
slpb = (SL_PARAMETER_BLOCK *)((u32)hypervisor_image_baseaddress + 0x20000);
HALT_ON_ERRORCOND(slpb->magic == SL_PARAMETER_BLOCK_MAGIC);
slpb->errorHandler = 0;
slpb->isEarlyInit = 1; //this is an "early" init
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ our C main*/
xorq %rdx, %rdx

/* Setup ESP to top of 64K (it will already be there on AMD)*/
movl $0x10000, %esp /* XXX TODO Get rid of magic number*/
movl $0x20000, %esp /* XXX TODO Get rid of magic number*/

#ifndef PERF_CRIT
/*get cycle count using rdtsc; useful to evaluate how long DRTM
Expand Down Expand Up @@ -372,7 +372,7 @@ sl_cpu_common:
----------------------------------------------------------------------*/

/* sl stack, this is just a placeholder and ensures that the linker
actually "allocates" the stack up until 0x10000*/
actually "allocates" the stack up until 0x20000*/
.section .sl_stack
.fill 2048, 1, 0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ sl_startnew:
movw %bx, %gs

/* Setup ESP to top of 64K (it will already be there on AMD)*/
movl $0x10000, %esp /* XXX TODO Get rid of magic number*/
movl $0x20000, %esp /* XXX TODO Get rid of magic number*/

/*#ifdef __INIT_LATE__
//setup 115200,8n1 on ttyS0
Expand Down Expand Up @@ -341,6 +341,6 @@ sl_startnew:
----------------------------------------------------------------------*/

/* sl stack, this is just a placeholder and ensures that the linker
actually "allocates" the stack up until 0x10000*/
actually "allocates" the stack up until 0x20000*/
.section .sl_stack
.fill 2048, 1, 0
4 changes: 2 additions & 2 deletions xmhf/src/xmhf-core/xmhf-secureloader/sl.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ void xmhf_sl_main(u32 cpu_vendor, u32 baseaddr, u32 rdtsc_eax, u32 rdtsc_edx){
#endif /* !defined(__I386__) */

//linker relocates sl image starting from 0, so
//parameter block must be at offset 0x10000
HALT_ON_ERRORCOND( (sla_t)&slpb == 0x10000 );
//parameter block must be at offset 0x20000
HALT_ON_ERRORCOND( (sla_t)&slpb == 0x20000 );

//do we have the required MAGIC?
HALT_ON_ERRORCOND( slpb.magic == SL_PARAMETER_BLOCK_MAGIC);
Expand Down
6 changes: 3 additions & 3 deletions xmhf/src/xmhf-core/xmhf-secureloader/sl.lds.S
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ ENTRY(_sl_start)
MEMORY
{
// XMHF: TODO: workaround software bloating, very insecure
low (rwxai) : ORIGIN = 0, LENGTH = 164K
high (rwxai) : ORIGIN = 164K, LENGTH = 1984K /* balance of 2M total */
low (rwxai) : ORIGIN = 0, LENGTH = 128K
high (rwxai) : ORIGIN = 128K, LENGTH = 1984K /* balance of 2M total */
debug (rwxai) : ORIGIN = 0, LENGTH = 1024M
unaccounted (rwxai) : ORIGIN = 0, LENGTH = 0 /* see section .unaccounted at end */
}
Expand Down Expand Up @@ -116,7 +116,7 @@ SECTIONS

.sl_stack : {
*(.sl_stack)
. = ALIGN(0x10000);
. = ALIGN(0x20000);
} >low

/* Content below is UNTRUSTED.
Expand Down

0 comments on commit 19e0c15

Please sign in to comment.