/branches/sparc/boot/arch/ia64/loader/asm.S |
---|
37,7 → 37,5 |
alloc loc0 = ar.pfs, 1, 1, 0, 0 |
movl r8 = 0x4404000;; |
mov b1 = r8 ;; |
mov r1 = in0; |
mov r1 = in0; #Save bootinfo prt |
br.call.sptk.many b0 = b1;; |
.global ofw |
ofw: |
/branches/sparc/boot/arch/ia64/loader/boot.S |
---|
34,6 → 34,7 |
.global start |
start: |
mov ar.rsc = r0 |
# movl r8 = (VRN_KERNEL << VRN_SHIFT) ;; |
movl r1 = 0x4400000 |
57,6 → 58,22 |
mov b1 = r18 ;; |
br.call.sptk.many b0 = b1 |
.align 512 |
ap_start: |
ap_loop: |
movl r18=0x4405000;; |
mov b1 = r18 ;; |
br.call.sptk.many b0 = b1;; |
.align 1024 |
.align 4096 |
.global binfo |
binfo: |
.bss #on this line is ".bss", it cannot be seen in my mcedit :-( |
/branches/sparc/boot/arch/ia64/loader/main.c |
---|
34,7 → 34,7 |
#include <align.h> |
#include <balloc.h> |
bootinfo_t bootinfo; |
extern bootinfo_t binfo; |
component_t components[COMPONENTS]; |
char *release = RELEASE; |
69,6 → 69,8 |
int ii; |
bootinfo_t *bootinfo=&binfo; |
//for(ii=0;ii<KERNEL_SIZE;ii++) ((char *)(0x100000))[ii] = ((char *)KERNEL_START)[ii+1]; |
92,19 → 94,18 |
components[i].name, components[i].size); |
bootinfo.taskmap.count = 0; |
bootinfo->taskmap.count = 0; |
for (i = 0; i < COMPONENTS; i++) { |
if (i > 0) { |
bootinfo.taskmap.tasks[bootinfo.taskmap.count].addr = components[i].start; |
bootinfo.taskmap.tasks[bootinfo.taskmap.count].size = components[i].size; |
bootinfo.taskmap.count++; |
bootinfo->taskmap.tasks[bootinfo->taskmap.count].addr = components[i].start; |
bootinfo->taskmap.tasks[bootinfo->taskmap.count].size = components[i].size; |
bootinfo->taskmap.count++; |
} |
} |
jump_to_kernel(bootinfo); |
jump_to_kernel(&bootinfo); |
} |
/branches/sparc/boot/arch/ia64/loader/gefi/apps/Makefile |
---|
28,7 → 28,7 |
CRTOBJS = ../gnuefi/crt0-efi-$(ARCH).o |
LDSCRIPT = ../gnuefi/elf_$(ARCH)_efi.lds |
LDFLAGS += -T $(LDSCRIPT) -shared -Bsymbolic -L../lib -L../gnuefi $(CRTOBJS) |
LOADLIBES = -lefi -lgnuefi |
LOADLIBES = -lefi -lgnuefi $(shell $(CC) -print-libgcc-file-name) |
FORMAT = efi-app-$(ARCH) |
TARGETS = t.efi t2.efi t3.efi t4.efi t5.efi t6.efi printenv.efi t7.efi |
/branches/sparc/boot/arch/ia64/loader/gefi/HelenOS/hello.c |
---|
1,9 → 1,23 |
#include <efi.h> |
#include <efilib.h> |
#include <../../../../../../kernel/arch/ia64/include/bootinfo.h> |
#define KERNEL_LOAD_ADDRESS 0x4400000 |
//Link image as a data array into hello - usefull with network boot |
//#define IMAGE_LINKED |
bootinfo_t *bootinfo=(bootinfo_t *)BOOTINFO_ADDRESS; |
#ifdef IMAGE_LINKED |
extern char HOSimage[]; |
extern int HOSimagesize; |
#endif |
static CHAR16 * |
a2u (char *str) |
{ |
15,24 → 29,7 |
mem[i] = 0; |
return mem; |
} |
char HEX[256]; |
char hexs[]="0123456789ABCDEF"; |
/* |
void to_hex(unsigned long long num) |
{ |
int a; |
for(a=15;a>=0;a--) |
{ |
char c=num - (num & 0xfffffffffffffff0LL); |
num/=16; |
c=hexs[c]; |
HEX[a]=c; |
} |
} |
*/ |
EFI_STATUS |
efi_main (EFI_HANDLE image, EFI_SYSTEM_TABLE *systab) |
{ |
72,11 → 69,12 |
EFI_FILE *FileHandle; |
BS->HandleProtocol(LoadedImage->DeviceHandle, &FileSystemProtocol, &Vol); |
Vol->OpenVolume (Vol, &CurDir); |
char FileName[1024]; |
char *OsKernelBuffer; |
int i; |
int defaultLoad; |
int imageLoad; |
UINTN Size; |
StrCpy(FileName,DevicePathToStr(LoadedImage->FilePath)); |
97,8 → 95,10 |
} |
while(LoadOptions[i]==L' ') if(LoadOptions[i++]==0) break; |
if(LoadOptions[i++]==0) |
if(LoadOptions[i++]==0){ |
StrCat(FileName,L"\\image.bin"); |
defaultLoad=1; |
} |
else{ |
CHAR16 buf[1024]; |
buf[0]='\\'; |
108,28 → 108,84 |
buf[j+1]=LoadOptions[i+j]; |
buf[j+1]=0; |
StrCat(FileName,buf); |
defaultLoad=0; |
} |
//Print(L"%s\n",FileName); |
EFI_STATUS stat; |
stat=CurDir->Open(CurDir, &FileHandle, FileName, EFI_FILE_MODE_READ, 0); |
if(EFI_ERROR(stat)){ |
Print(L"Error Opening Image %s\n",FileName); |
return 0; |
imageLoad=1; |
#ifdef IMAGE_LINKED |
if(defaultLoad) { |
Print(L"Using Linked Image\n"); |
imageLoad=0; |
} |
Size = 0x00400000; |
BS->AllocatePool(EfiLoaderData, Size, &OsKernelBuffer); |
FileHandle->Read(FileHandle, &Size, OsKernelBuffer); |
FileHandle->Close(FileHandle); |
#endif |
if(Size<1) return 0; |
char * HOS; |
if(imageLoad) |
{ |
Size = 0x00400000; |
Vol->OpenVolume (Vol, &CurDir); |
char * HOS = OsKernelBuffer; |
EFI_STATUS stat; |
stat=CurDir->Open(CurDir, &FileHandle, FileName, EFI_FILE_MODE_READ, 0); |
if(EFI_ERROR(stat)){ |
Print(L"Error Opening Image %s\n",FileName); |
return 0; |
} |
BS->AllocatePool(EfiLoaderData, Size, &OsKernelBuffer); |
FileHandle->Read(FileHandle, &Size, OsKernelBuffer); |
FileHandle->Close(FileHandle); |
HOS = OsKernelBuffer; |
if(Size<1) return 0; |
} |
#ifdef IMAGE_LINKED |
else { |
HOS = HOSimage; |
Size = HOSimagesize; |
Print(L"Image start %llX\n",(long long)HOS); |
Print(L"Image size %llX\n",(long long)Size); |
Print(L"Image &size %llX\n",(long long)&Size); |
} |
#endif |
int HOSSize = Size; |
rArg rSAL; |
rArg rPAL; |
//Setup AP's wake up address |
LibSalProc(0x01000000,2,0x4400200,0,0,0,0,0,&rSAL); |
//Get System Frequency |
UINT64 sys_freq; |
LibSalProc(0x01000012,0,0,0,0,0,0,0,&rSAL); |
sys_freq=rSAL.p1; |
UINT64 freq_scale; |
//Get CPU Frequency to System Frequency ratio |
LibPalProc(14,0,0,0,&rPAL); |
freq_scale=rPAL.p1; |
UINT64 sapic; |
LibGetSalIpiBlock(&sapic); |
Print (L"SAPIC:%X\n", sapic); |
//bootinfo->sapic=sapic; |
int wakeup_intno; |
wakeup_intno=0xf0; |
Print (L"WAKEUP INTNO:%X\n", wakeup_intno); |
//bootinfo->wakeup_intno=wakeup_intno; |
{ |
UINTN cookie; |
void *p=(void *)KERNEL_LOAD_ADDRESS; |
167,6 → 223,10 |
for(a=0;a<HOSSize;a++){ |
((char *)(0x4400000))[a]=HOS[a]; |
} |
bootinfo->sapic=(unsigned long *)sapic; |
bootinfo->wakeup_intno=wakeup_intno; |
bootinfo->sys_freq=sys_freq; |
bootinfo->freq_scale=freq_scale; |
//Run Kernel |
asm volatile( |
177,8 → 237,6 |
); |
while(1){ |
((volatile int *)(0x80000000000b8000))[0]++; |
} |
//Not reached |
return EFI_SUCCESS; |
} |
/branches/sparc/boot/arch/ia64/loader/gefi/HelenOS/Makefile |
---|
28,7 → 28,7 |
CRTOBJS = ../gnuefi/crt0-efi-$(ARCH).o |
LDSCRIPT = ../gnuefi/elf_$(ARCH)_efi.lds |
LDFLAGS += -T $(LDSCRIPT) -shared -Bsymbolic -L../lib -L../gnuefi $(CRTOBJS) |
LOADLIBES = -lefi -lgnuefi |
LOADLIBES = -lefi -lgnuefi $(shell $(CC) -print-libgcc-file-name) |
FORMAT = efi-app-$(ARCH) |
45,16 → 45,29 |
-j .rela -j .reloc --target=$(FORMAT) hello.so hello.efi |
$(OBJDUMP) -d hello.efi > hello.disass |
hello.so: hello.o image.o |
$(LD) $(LDFLAGS) -Map hello.map hello.o -o hello.so $(LOADLIBES) |
#When selected first lines or second lines, select if image is linked into hello or not - usefull for network boot |
#hello.so: hello.o image.o |
hello.so: hello.o image.bin |
# $(LD) $(LDFLAGS) -Map hello.map hello.o image.o -o hello.so $(LOADLIBES) #link image inside hello |
$(LD) $(LDFLAGS) -Map hello.map hello.o -o hello.so $(LOADLIBES) #dont link image inside hello |
hello.o: hello.c |
$(CC) $(INCDIR) $(CFLAGS) $(CPPFLAGS) -c hello.c -o hello.o |
image.o: ../../image.boot |
image.bin: ../../image.boot |
$(OBJCOPY) -O binary ../../image.boot image.bin |
$(OBJCOPY) -I binary -O elf64-ia64-little -B ia64 image.bin image.o |
image.o: ../../image.boot mkimage |
$(OBJCOPY) -O binary ../../image.boot image.bin |
./mkimage |
$(CC) $(INCDIR) $(CFLAGS) $(CPPFLAGS) -c image.c -o image.o |
# $(OBJCOPY) -I binary -O elf64-ia64-little -B ia64 image.bin image.o |
mkimage: mkimage.c |
gcc -o mkimage mkimage.c |
gefi: |
make -C .. prefix=$(PREFIX) |
/branches/sparc/boot/arch/ia64/loader/main.h |
---|
29,29 → 29,14 |
#ifndef BOOT_ia64_MAIN_H_ |
#define BOOT_ia64_MAIN_H_ |
#include <ofw.h> |
#include <ofw_tree.h> |
#include <types.h> |
#include <../../../../kernel/arch/ia64/include/bootinfo.h> |
#define CONFIG_INIT_TASKS 32 |
typedef struct { |
void *addr; |
size_t size; |
} init_task_t; |
typedef struct { |
count_t count; |
init_task_t tasks[CONFIG_INIT_TASKS]; |
} init_t; |
typedef struct { |
init_t taskmap; |
} bootinfo_t; |
extern bootinfo_t bootinfo; |
extern void start(void); |
extern void bootstrap(void); |
/branches/sparc/boot/arch/ia64/loader/Makefile |
---|
88,6 → 88,8 |
boot.S |
COMPONENTS = \ |
$(KERNELDIR)/kernel.bin |
NOCOMPONENTS = \ |
$(KERNELDIR)/kernel.bin \ |
$(USPACEDIR)/srv/ns/ns \ |
$(USPACEDIR)/srv/loader/loader \ |