mirror of
https://github.com/fail0verflow/switch-coreboot.git
synced 2025-05-04 01:39:18 -04:00
Support for udelay in baremetal
This commit is contained in:
parent
88d4672564
commit
5bcc3e0242
5 changed files with 40 additions and 4 deletions
|
@ -3,7 +3,7 @@ ARCH = i386
|
|||
|
||||
CC = gcc
|
||||
|
||||
CFLAGS = -I ../include -I ../include/$(ARCH) -O2
|
||||
CFLAGS = -I ../include -I ../include/$(ARCH) -O2 -DZKERNEL_START=0xfff00000
|
||||
|
||||
DEPS = bootselect.o rom_fill_inbuf.o chooser.o ../lib/baremetal.a
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ int choose_stream(struct stream *stream)
|
|||
current += current->block_count+1;
|
||||
}
|
||||
|
||||
j=2;
|
||||
j=1;
|
||||
if(iskey()) {
|
||||
j = ttys0_rx_char();
|
||||
j=-1;
|
||||
|
|
33
util/baremetal/include/cpu/p6/msr.h
Normal file
33
util/baremetal/include/cpu/p6/msr.h
Normal file
|
@ -0,0 +1,33 @@
|
|||
#ifndef CPU_P6_MSR_H
|
||||
#define CPU_P6_MSR_H
|
||||
|
||||
/*
|
||||
* Access to machine-specific registers (available on 586 and better only)
|
||||
* Note: the rd* operations modify the parameters directly (without using
|
||||
* pointer indirection), this allows gcc to optimize better
|
||||
*/
|
||||
|
||||
#define rdmsr(msr,val1,val2) \
|
||||
__asm__ __volatile__("rdmsr" \
|
||||
: "=a" (val1), "=d" (val2) \
|
||||
: "c" (msr))
|
||||
|
||||
#define wrmsr(msr,val1,val2) \
|
||||
__asm__ __volatile__("wrmsr" \
|
||||
: /* no outputs */ \
|
||||
: "c" (msr), "a" (val1), "d" (val2))
|
||||
|
||||
#define rdtsc(low,high) \
|
||||
__asm__ __volatile__("rdtsc" : "=a" (low), "=d" (high))
|
||||
|
||||
#define rdtscl(low) \
|
||||
__asm__ __volatile__ ("rdtsc" : "=a" (low) : : "edx")
|
||||
|
||||
#define rdtscll(val) \
|
||||
__asm__ __volatile__ ("rdtsc" : "=A" (val))
|
||||
|
||||
#define rdpmc(counter,low,high) \
|
||||
__asm__ __volatile__("rdpmc" \
|
||||
: "=a" (low), "=d" (high) \
|
||||
: "c" (counter))
|
||||
#endif /* CPU_P6_MSR_H */
|
|
@ -6,7 +6,7 @@
|
|||
// yes, linux has fancy ones. We don't care. This stuff gets used
|
||||
// hardly at all. And the pain of including those files is just too high.
|
||||
|
||||
//extern inline void strcpy(char *dst, char *src) {while (*src) *dst++ = *src++;}
|
||||
extern inline void strcpy(char *dst, char *src) {while (*src) *dst++ = *src++;}
|
||||
|
||||
//extern inline int strlen(char *src) { int i = 0; while (*src++) i++; return i;}
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ CFLAGS = -I ../include -I ../include/$(ARCH) -O2
|
|||
|
||||
LB_SOURCE=../../../src
|
||||
|
||||
DEPS = printk.o serial_subr.o subr.o vsprintf.o memcpy.o malloc.o memset.o compute_ip_checksum.o elfboot.o boot.o ide.o linuxbios.o
|
||||
DEPS = printk.o serial_subr.o subr.o vsprintf.o memcpy.o malloc.o memset.o compute_ip_checksum.o elfboot.o boot.o ide.o linuxbios.o delay_tsc.o
|
||||
|
||||
baremetal.a : $(DEPS)
|
||||
ar -cr baremetal.a $(DEPS)
|
||||
|
@ -32,5 +32,8 @@ malloc.o: $(LB_SOURCE)/lib/malloc.c
|
|||
printk.o: $(LB_SOURCE)/lib/printk.c
|
||||
$(CC) $(CFLAGS) -c $<
|
||||
|
||||
delay_tsc.o: $(LB_SOURCE)/cpu/p5/delay_tsc.c
|
||||
$(CC) $(CFLAGS) -c $<
|
||||
|
||||
clean:
|
||||
rm -f $(DEPS) baremetal.a
|
||||
|
|
Loading…
Add table
Reference in a new issue