[librm] Provide an abstraction wrapper for prot_call

Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
Michael Brown
2016-02-18 23:23:38 +00:00
parent 196f0f2551
commit 31b5c2e753
20 changed files with 77 additions and 60 deletions

View File

@@ -131,8 +131,7 @@ init_librm:
addl $gdt, gdt_base
/* Initialise IDT */
pushl $init_idt
call prot_call
virtcall init_idt
/* Restore registers */
negl %edi
@@ -554,8 +553,7 @@ flatten_real_mode:
movb $0x8f, real_cs + 6
movb $0x8f, real_ds + 6
/* Call dummy protected-mode function */
pushl $flatten_dummy
call prot_call
virtcall flatten_dummy
/* Restore GDT */
movb $0x00, real_cs + 6
movb $0x00, real_ds + 6

View File

@@ -56,9 +56,9 @@ static struct profiler real_call_profiler __profiler = { .name = "real_call" };
static struct profiler prot_call_profiler __profiler = { .name = "prot_call" };
/**
* Dummy protected-mode function
* Dummy function for profiling tests
*/
static void librm_test_prot_call ( void ) {
static __asmcall void librm_test_call ( struct i386_all_regs *ix86 __unused ) {
/* Do nothing */
}
@@ -97,7 +97,7 @@ static void librm_test_exec ( void ) {
/* Profile complete real-mode call cycle */
for ( i = 0 ; i < PROFILE_COUNT ; i++ ) {
profile_start ( &real_call_profiler );
__asm__ __volatile__ ( REAL_CODE ( "" ) : : );
__asm__ __volatile__ ( REAL_CODE ( "" ) );
profile_stop ( &real_call_profiler );
}
@@ -105,12 +105,10 @@ static void librm_test_exec ( void ) {
for ( i = 0 ; i < PROFILE_COUNT ; i++ ) {
__asm__ __volatile__ ( REAL_CODE ( "rdtsc\n\t"
"movl %k0, %k2\n\t"
"pushl %k3\n\t"
"call prot_call\n\t"
VIRT_CALL ( librm_test_call )
"rdtsc\n\t" )
: "=a" ( stopped ), "=d" ( discard_d ),
"=R" ( started )
: "i" ( librm_test_prot_call ) );
"=R" ( started ) : );
profile_start_at ( &prot_call_profiler, started );
profile_stop_at ( &prot_call_profiler, stopped );
}