/boot/trunk/arch/sparc64/loader/regname.h |
---|
File deleted |
/boot/trunk/arch/sparc64/loader/msim.c |
---|
File deleted |
/boot/trunk/arch/sparc64/loader/msim.h |
---|
File deleted |
/boot/trunk/arch/sparc64/loader/asm.S |
---|
26,12 → 26,6 |
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
# |
#include "regname.h" |
.set noat |
.set noreorder |
.set nomacro |
.text |
.global halt |
43,69 → 37,9 |
nop |
memcpy: |
addiu $v0,$a1,3 |
li $v1,-4 # 0xfffffffffffffffc |
and $v0,$v0,$v1 |
beq $a1,$v0,3f |
move $t0,$a0 |
0: |
beq $a2,$zero,2f |
move $a3,$zero |
1: |
addu $v0,$a1,$a3 |
lbu $a0,0($v0) |
addu $v1,$t0,$a3 |
addiu $a3,$a3,1 |
bne $a3,$a2,1b |
sb $a0,0($v1) |
2: |
jr $ra |
move $v0,$a1 |
3: |
addiu $v0,$a0,3 |
and $v0,$v0,$v1 |
bne $a0,$v0,0b |
srl $t1,$a2,2 |
beq $t1,$zero,5f |
move $a3,$zero |
move $a3,$zero |
move $a0,$zero |
4: |
addu $v0,$a1,$a0 |
lw $v1,0($v0) |
addiu $a3,$a3,1 |
addu $v0,$t0,$a0 |
sw $v1,0($v0) |
bne $a3,$t1,4b |
addiu $a0,$a0,4 |
5: |
andi $a2,$a2,0x3 |
beq $a2,$zero,2b |
b memcpy |
nop |
sll $v0,$a3,2 |
addu $t1,$v0,$t0 |
move $a3,$zero |
addu $t0,$v0,$a1 |
6: |
addu $v0,$t0,$a3 |
lbu $a0,0($v0) |
addu $v1,$t1,$a3 |
addiu $a3,$a3,1 |
bne $a3,$a2,6b |
sb $a0,0($v1) |
jr $ra |
move $v0,$a1 |
jump_to_kernel: |
# .word 0x39 |
j $a0 |
b jump_to_kernel |
nop |
/boot/trunk/arch/sparc64/loader/boot.S |
---|
26,20 → 26,13 |
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
# |
#include "regname.h" |
#define INITIAL_STACK 0x0 |
#define INITIAL_STACK 0x80040000 |
.section BOOTSTRAP, "ax" |
.set noat |
.set noreorder |
.set nomacro |
.section BOOTSTRAP |
.global start |
start: |
lui $sp, INITIAL_STACK >> 16 |
ori $sp, $sp, INITIAL_STACK & 0xffff |
# TODO: set initial stack |
j bootstrap |
b bootstrap |
nop |
/boot/trunk/arch/sparc64/loader/main.c |
---|
28,15 → 28,14 |
#include "main.h" |
#include <printf.h> |
#include "msim.h" |
#include "asm.h" |
#include "_components.h" |
#define KERNEL_VIRTUAL_ADDRESS 0x80100000 |
#define KERNEL_VIRTUAL_ADDRESS 0x400000 |
void bootstrap(void) |
{ |
printf("HelenOS MIPS Bootloader\n"); |
printf("HelenOS SPARC64 Bootloader\n"); |
component_t components[COMPONENTS]; |
bootinfo_t bootinfo; |
/boot/trunk/arch/sparc64/loader/asm.h |
---|
29,11 → 29,12 |
#ifndef __ASM_H__ |
#define __ASM_H__ |
#define PAGE_SIZE 16384 |
#define PAGE_WIDTH 14 |
#define PAGE_SIZE 8192 |
#define PAGE_WIDTH 13 |
#define memcpy(dst, src, cnt) __builtin_memcpy((dst), (src), (cnt)) |
void jump_to_kernel(void *entry, void *bootinfo, unsigned int bootinfo_size) __attribute__((noreturn)); |
extern void halt(void); |
extern void jump_to_kernel(void *entry, void *bootinfo, unsigned int bootinfo_size) __attribute__((noreturn)); |
#endif |
/boot/trunk/arch/sparc64/loader/types.h |
---|
36,9 → 36,9 |
typedef unsigned char __u8; |
typedef unsigned short __u16; |
typedef unsigned int __u32; |
typedef unsigned long long __u64; |
typedef unsigned long __u64; |
typedef __u32 __address; |
typedef __u32 __native; |
typedef __u64 __address; |
typedef __u64 __native; |
#endif |
/boot/trunk/arch/sparc64/loader/ofw.c |
---|
0,0 → 1,35 |
/* |
* Copyright (C) 2005 Martin Decky |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* |
* - Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* - Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* - The name of the author may not be used to endorse or promote products |
* derived from this software without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
#include <ofw.h> |
#include <printf.h> |
void write(const char *str, const int len) |
{ |
ofw_write(str, len); |
} |
/boot/trunk/arch/sparc64/loader/Makefile |
---|
29,8 → 29,8 |
## Toolchain configuration |
# |
TARGET = mipsel-linux-gnu |
TOOLCHAIN_DIR = /usr/local/mipsel/bin |
TARGET = sparc64-linux-gnu |
TOOLCHAIN_DIR = /usr/local/sparc64/bin |
ifeq ($(COMPILER),native) |
CC = gcc |
46,25 → 46,18 |
OBJDUMP = $(TOOLCHAIN_DIR)/$(TARGET)-objdump |
endif |
CFLAGS = -I. -I../../../generic -nostdinc -nostdlib -fno-builtin -Werror-implicit-function-declaration -Wmissing-prototypes -Werror -O3 -mno-abicalls -G 0 -fno-zero-initialized-in-bss -mhard-float -mips3 |
CFLAGS = -I. -I../../../generic -I../../../genarch -nostdinc -nostdlib -fno-builtin -Werror-implicit-function-declaration -Wmissing-prototypes -Werror -O3 -mcpu=ultrasparc -m64 |
SOURCES = \ |
main.c \ |
msim.c \ |
../../../generic/printf.c \ |
../../../genarch/ofw.c \ |
ofw.c \ |
asm.S \ |
boot.S |
COMPONENTS = \ |
$(KERNELDIR)/kernel.bin \ |
$(USPACEDIR)/ns/ns \ |
$(USPACEDIR)/init/init \ |
$(USPACEDIR)/fb/fb \ |
$(USPACEDIR)/kbd/kbd \ |
$(USPACEDIR)/console/console \ |
$(USPACEDIR)/tetris/tetris \ |
$(USPACEDIR)/ipcc/ipcc \ |
$(USPACEDIR)/klog/klog |
$(KERNELDIR)/kernel.bin |
OBJECTS := $(addsuffix .o,$(basename $(SOURCES))) |
COMPONENT_OBJECTS := $(addsuffix .o,$(basename $(notdir $(COMPONENTS)))) |
/boot/trunk/arch/sparc64/loader/pack |
---|
30,43 → 30,27 |
[ "$#" -lt 1 ] && exit 1 |
case "$1" in |
"binary") |
BFD="binary" |
;; |
"ecoff") |
BFD="ecoff-littlemips" |
;; |
*) |
echo "Undefined image format" >&1 |
exit 1 |
;; |
esac |
OBJCOPY="$2" |
OBJCOPY="$1" |
LINK="_link.ld" |
HEADER="_components.h" |
shift 2 |
shift |
echo "OUTPUT_FORMAT(\"${BFD}\") |
echo 'OUTPUT_FORMAT("elf64-sparc") |
ENTRY(start) |
SECTIONS { |
.boot 0xbfc00000: AT (0) { |
.boot 0x4000: AT (0) { |
*(BOOTSTRAP); |
*(.text); |
*(.rodata); |
*(.rodata.*); |
*(.data); /* initialized data */ |
*(.data); /* initialized data */ |
*(.sdata); |
*(.sdata2); |
*(.sbss); |
*(.scommon); |
*(.bss); /* uninitialized static variables */ |
*(COMMON); /* global variables */ |
*(.reginfo);" > "$LINK" |
*(.bss); /* uninitialized static variables */ |
*(COMMON);' > "$LINK" |
echo '#ifndef ___COMPONENTS_H__ |
#define ___COMPONENTS_H__ |
90,7 → 74,7 |
echo "$TASK -> $OBJECT" |
echo " |
. = ALIGN(4096); |
. = ALIGN(8192); |
*(.${BASENAME}_image);" >> "$LINK" |
echo " |
101,7 → 85,7 |
#define ${MACRO}_END ((void *) &${SYMBOL}_end) |
#define ${MACRO}_SIZE ((unsigned int) ${MACRO}_END - (unsigned int) ${MACRO}_START)" >> "$HEADER" |
"$OBJCOPY" -I binary -O elf32-tradlittlemips -B mips --rename-section ".data=.${BASENAME}_image" "$TASK" "$OBJECT" |
"$OBJCOPY" -I binary -O elf64-sparc -B sparc --rename-section ".data=.${BASENAME}_image" "$TASK" "$OBJECT" |
DATA="${DATA} |
components[$COUNT].name = \"${BASENAME}\"; |