/SPARTAN/trunk/arch/amd64/src/asm_utils.S |
---|
44,6 → 44,39 |
movq $halt, (%rsp) |
jmp printf |
.global has_cpuid |
.global rdtsc |
## Determine CPUID support |
# |
# Return 0 in EAX if CPUID is not support, 1 if supported. |
# |
has_cpuid: |
pushq %rbx |
pushfq # store flags |
popq %rax # read flags |
movq %rax,%rbx # copy flags |
btcl $21,%ebx # swap the ID bit |
pushq %rbx |
popfq # propagate the change into flags |
pushfq |
popq %rbx # read flags |
andl $(1<<21),%eax # interested only in ID bit |
andl $(1<<21),%ebx |
xorl %ebx,%eax # 0 if not supported, 1 if supported |
popq %rbx |
ret |
rdtsc: |
xorq %rax,%rax |
rdtsc |
ret |
# Push all general purpose registers on stack except %rbp, %rsp |
.macro push_all_gpr |
pushq %rax |
/SPARTAN/trunk/arch/amd64/src/boot/memmap.S |
---|
File deleted |
/SPARTAN/trunk/arch/amd64/src/boot/boot.S |
---|
33,7 → 33,7 |
#include <arch/pm.h> |
#define START_STACK 0x7c00 |
#define START_STACK_64 $0xffffffff80007c00 |
#define START_STACK_64 0xffffffff80007c00 |
# |
# This is where we require any SPARTAN-kernel-compatible boot loader |
51,9 → 51,9 |
xorw %ax,%ax |
movw %ax,%ds |
movw %ax,%ss # initialize stack segment register |
movl START_STACK,%esp # initialize stack pointer |
movl $(START_STACK),%esp # initialize stack pointer |
# call memmap_arch_init |
call memmap_arch_init |
movl $0x80000000, %eax |
cpuid |
116,7 → 116,7 |
.code64 |
start64: |
movq START_STACK_64, %rsp |
movq $(START_STACK_64), %rsp |
call main_bsp # never returns |
1: |
/SPARTAN/trunk/arch/amd64/src/amd64.c |
---|
38,6 → 38,7 |
#include <arch/i8259.h> |
#include <arch/bios/bios.h> |
#include <arch/mm/memory_init.h> |
void arch_pre_mm_init(void) |
{ |
64,3 → 65,21 |
ega_init(); /* video */ |
} |
} |
void arch_late_init(void) |
{ |
if (config.cpu_active == 1) { |
memory_print_map(); |
#ifdef __SMP__ |
acpi_init(); |
#endif /* __SMP__ */ |
} |
} |
void calibrate_delay_loop(void) |
{ |
return; |
i8254_calibrate_delay_loop(); |
i8254_normal_operation(); |
} |
/SPARTAN/trunk/arch/amd64/src/dummy.s |
---|
34,33 → 34,18 |
.global cpu_arch_init |
.global cpu_sleep |
.global cpu_print_report |
.global arch_late_init |
.global calibrate_delay_loop |
.global dummy |
.global rdtsc |
.global reset_TS_flag |
.global fpu_init |
.global memory_print_map |
.global get_memory_size |
get_memory_size: |
movq $4*1024*1024, %rax |
ret |
rdtsc: |
before_thread_runs_arch: |
userspace: |
calibrate_delay_loop: |
cpu_identify: |
cpu_arch_init: |
cpu_sleep: |
cpu_print_report: |
arch_late_init: |
calibrate_delay_loop: |
reset_TS_flag: |
fpu_init: |
memory_print_map: |
dummy: |
0: |