Corrected inline asm constraints
This commit is contained in:
parent
7126409aee
commit
23d29ae2f8
1 changed files with 11 additions and 12 deletions
|
|
@ -1427,13 +1427,12 @@ VOID EFIAPI bootboot_startcore(IN VOID* buf)
|
||||||
"movq %%cr4, %%rax;"
|
"movq %%cr4, %%rax;"
|
||||||
"orw $3 << 8, %%ax;"
|
"orw $3 << 8, %%ax;"
|
||||||
"mov %%rax, %%cr4"
|
"mov %%rax, %%cr4"
|
||||||
: );
|
: : : "rax", "memory", "cc");
|
||||||
|
|
||||||
// set up paging
|
// set up paging
|
||||||
__asm__ __volatile__ (
|
__asm__ __volatile__ (
|
||||||
"mov %0, %%rax;"
|
"mov %0, %%cr3"
|
||||||
"mov %%rax, %%cr3"
|
: : "a"(paging) : "memory");
|
||||||
: : "b"(paging) : "memory" );
|
|
||||||
|
|
||||||
// set stack and call _start() in sys/core
|
// set stack and call _start() in sys/core
|
||||||
__asm__ __volatile__ (
|
__asm__ __volatile__ (
|
||||||
|
|
@ -1444,7 +1443,7 @@ VOID EFIAPI bootboot_startcore(IN VOID* buf)
|
||||||
"pushq %1;"
|
"pushq %1;"
|
||||||
"movq %2, %%rdi;"
|
"movq %2, %%rdi;"
|
||||||
"retq"
|
"retq"
|
||||||
: : "a"((UINTN)core_num*initstack), "b"(entrypoint), "c"((UINTN)core_num) : "memory" );
|
: : "a"((UINTN)core_num*initstack), "b"(entrypoint), "c"((UINTN)core_num) : "rdi", "memory" );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -1520,14 +1519,14 @@ efi_main (EFI_HANDLE image, EFI_SYSTEM_TABLE *systab)
|
||||||
"cpuid;"
|
"cpuid;"
|
||||||
"shrl $24, %%ebx;"
|
"shrl $24, %%ebx;"
|
||||||
"mov %%bx,%0"
|
"mov %%bx,%0"
|
||||||
: "=b"(bootboot->bspid) : : );
|
: "=r"(bootboot->bspid) : : "eax", "ebx", "ecx", "edx", "cc");
|
||||||
Print(L"LINE %d\n", (int)__LINE__ );
|
Print(L"LINE %d\n", (int)__LINE__ );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(USE_MP_SERVICES) || !USE_MP_SERVICES
|
#if !defined(USE_MP_SERVICES) || !USE_MP_SERVICES
|
||||||
// should be no need to check for RDSTC, available since Pentium, therefore
|
// should be no need to check for RDSTC, available since Pentium, therefore
|
||||||
// all long mode capable CPUs should have it. But just to be on the safe side
|
// all long mode capable CPUs should have it. But just to be on the safe side
|
||||||
__asm__ __volatile__ ("mov $1, %%eax; cpuid;" : "=d"(a) : : );
|
__asm__ __volatile__ ("mov $1, %%eax; cpuid;" : "=d"(a) : : "eax", "ebx", "ecx");
|
||||||
Print(L"LINE %d\n", (int)__LINE__ );
|
Print(L"LINE %d\n", (int)__LINE__ );
|
||||||
if(a & (1<<4)) {
|
if(a & (1<<4)) {
|
||||||
// calibrate CPU clock cycles
|
// calibrate CPU clock cycles
|
||||||
|
|
@ -1549,7 +1548,7 @@ efi_main (EFI_HANDLE image, EFI_SYSTEM_TABLE *systab)
|
||||||
__asm__ __volatile__ ( "rdtsc" : "=a"(a),"=d"(b)); currtime=((UINT64)b << 32)|a; \
|
__asm__ __volatile__ ( "rdtsc" : "=a"(a),"=d"(b)); currtime=((UINT64)b << 32)|a; \
|
||||||
} while(currtime < endtime); \
|
} while(currtime < endtime); \
|
||||||
} else \
|
} else \
|
||||||
__asm__ __volatile__ ("1: pause; dec %%ecx; or %%ecx, %%ecx; jnz 1b" : : "c"(n*1000) : "memory"); \
|
__asm__ __volatile__ ("1: pause; dec %%ecx; jecxnz 1b" : : "c"(n*1000) : "cc", "memory"); \
|
||||||
} while(0)
|
} while(0)
|
||||||
#define send_ipi(a,m,v) do { \
|
#define send_ipi(a,m,v) do { \
|
||||||
while(*((volatile uint32_t*)(lapic_addr + 0x300)) & (1 << 12)) __asm__ __volatile__ ("pause" : : : "memory"); \
|
while(*((volatile uint32_t*)(lapic_addr + 0x300)) & (1 << 12)) __asm__ __volatile__ ("pause" : : : "memory"); \
|
||||||
|
|
@ -1941,7 +1940,7 @@ get_memory_map:
|
||||||
__asm__ __volatile__ (
|
__asm__ __volatile__ (
|
||||||
"movb $0xFF, %%al; outb %%al, $0x21; outb %%al, $0xA1;" // disable PIC
|
"movb $0xFF, %%al; outb %%al, $0x21; outb %%al, $0xA1;" // disable PIC
|
||||||
"inb $0x70, %%al; orb $0x80, %%al; outb %%al, $0x70;" // disable NMI
|
"inb $0x70, %%al; orb $0x80, %%al; outb %%al, $0x70;" // disable NMI
|
||||||
: : :);
|
: : : "eax", "cc");
|
||||||
|
|
||||||
#if !defined(USE_MP_SERVICES) || !USE_MP_SERVICES
|
#if !defined(USE_MP_SERVICES) || !USE_MP_SERVICES
|
||||||
// green dot on the top left corner (do not allow gcc to rearrange this!!!)
|
// green dot on the top left corner (do not allow gcc to rearrange this!!!)
|
||||||
|
|
@ -1954,12 +1953,12 @@ get_memory_map:
|
||||||
|
|
||||||
// copy trampoline and save UEFI's 64 bit system registers for the trampoline code
|
// copy trampoline and save UEFI's 64 bit system registers for the trampoline code
|
||||||
__asm__ __volatile__ (
|
__asm__ __volatile__ (
|
||||||
"movq $32, %%rcx; movq %0, %%rsi; movq $0x8000, %%rdi; repnz movsq;"
|
"movq $32, %%rcx; movq $0x8000, %%rdi; repnz movsq;"
|
||||||
"movq %%cr3, %%rax; movq %%rax, 0x80C0;"
|
"movq %%cr3, %%rax; movq %%rax, 0x80C0;"
|
||||||
"movl %%cs, %%eax; movl %%eax, 0x80CC;"
|
"movl %%cs, %%eax; movl %%eax, 0x80CC;"
|
||||||
"movl %%ds, %%eax; movl %%eax, 0x80D0;"
|
"movl %%ds, %%eax; movl %%eax, 0x80D0;"
|
||||||
"movq %%rbx, 0x80D8;"
|
"movq %1, 0x80D8;"
|
||||||
"sgdt 0x80E0;" : : "d"((uint64_t)&ap_trampoline), "b"((uint64_t)&bootboot_startcore) : );
|
"sgdt 0x80E0;" : : "S"((uint64_t)&ap_trampoline), "r"((uint64_t)&bootboot_startcore) : "rax", "rcx", "rdi", "memory");
|
||||||
|
|
||||||
// enable Local APIC
|
// enable Local APIC
|
||||||
*((volatile uint32_t*)(lapic_addr + 0x0D0)) = (1 << 24);
|
*((volatile uint32_t*)(lapic_addr + 0x0D0)) = (1 << 24);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue