aboutsummaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
Diffstat (limited to 'sys')
-rw-r--r--sys/boot/sparc64/loader/Makefile47
-rw-r--r--sys/boot/sparc64/loader/help.sparc640
-rw-r--r--sys/boot/sparc64/loader/locore.s118
3 files changed, 21 insertions, 144 deletions
diff --git a/sys/boot/sparc64/loader/Makefile b/sys/boot/sparc64/loader/Makefile
index 0fda8d4484de..83076be8688b 100644
--- a/sys/boot/sparc64/loader/Makefile
+++ b/sys/boot/sparc64/loader/Makefile
@@ -3,15 +3,17 @@
BASE= loader
PROG= ${BASE}
NEWVERSWHAT= "bootstrap loader" sparc64
+BINDIR?= /boot
+INSTALLFLAGS= -b
CFLAGS= -mno-app-regs
-LOADER_DISK_SUPPORT?= no
-LOADER_UFS_SUPPORT?= no
+LOADER_DISK_SUPPORT?= yes
+LOADER_UFS_SUPPORT?= yes
LOADER_CD9660_SUPPORT?= no
-LOADER_NET_SUPPORT?= yes
-LOADER_NFS_SUPPORT?= yes
-LOADER_TFTP_SUPPORT?= yes
+LOADER_NET_SUPPORT?= no
+LOADER_NFS_SUPPORT?= no
+LOADER_TFTP_SUPPORT?= no
.if ${LOADER_DISK_SUPPORT} == "yes"
CFLAGS+= -DLOADER_DISK_SUPPORT
@@ -33,7 +35,7 @@ CFLAGS+= -DLOADER_TFTP_SUPPORT
.endif
# Architecture-specific loader code
-SRCS= locore.s main.c metadata.c
+SRCS= locore.S main.c metadata.c
# Always add MI sources
.PATH: ${.CURDIR}/../../common
@@ -41,10 +43,11 @@ SRCS= locore.s main.c metadata.c
CFLAGS+= -I${.CURDIR}/../../common
CFLAGS+= -I${.CURDIR}/../../.. -I.
-CLEANFILES+= ${PROG}
+CLEANFILES+= ${PROG}.help
CFLAGS+= -W -Wall -ffreestanding
-LDFLAGS= -X -static
+LDFLAGS= -nostdlib -static
+LDADD= ${LIBSTAND} ${LIBOFW}
# where to get libstand from
#XXX need a better way to do this
@@ -55,33 +58,25 @@ LIBSTAND= ${.OBJDIR}/../../../../lib/libstand/libstand.a
LIBSTAND= -lstand
.endif
.endif
-LIBOFW= ${.CURDIR}/../../ofw/libofw/libofw.a
+LIBOFW= ${.OBJDIR}/../../ofw/libofw/libofw.a
CFLAGS+= -I${.CURDIR}/../../../../lib/libstand/
CFLAGS+= -I${.CURDIR}/../../ofw/libofw/
-# Debug me!
-#CFLAGS+= -g
-#LDFLAGS+= -g
+${BASE}.help: help.common help.sparc64
+ cat ${.ALLSRC} | \
+ awk -f ${.CURDIR}/../../common/merge_help.awk > ${.TARGET}
-${PROG}: ${OBJS}
- ${LD} -o ${.TARGET} ${OBJS} ${LIBOFW} ${LIBSTAND} ${LDFLAGS}
-
-locore.o: locore.s
- ${CC} ${CFLAGS} -D_LOCORE -xassembler-with-cpp -c locore.s -o locore.o
-main.o: main.c
- ${CC} ${CFLAGS} -c main.c -o main.o
-
-beforeinstall:
+beforeinstall: ${PROG}.help
.if exists(${DESTDIR}/boot/loader)
mv ${DESTDIR}/boot/loader ${DESTDIR}/boot/loader.old
.endif
-.if exists(${.OBJDIR}/loader.help)
+#.if exists(${.OBJDIR}/loader.help)
${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
${.OBJDIR}/${BASE}.help ${DESTDIR}/boot
-.else
- ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
- ${.CURDIR}/${BASE}.help ${DESTDIR}/boot
-.endif
+#.else
+# ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
+# ${.CURDIR}/${BASE}.help ${DESTDIR}/boot
+#.endif
.if !exists(${DESTDIR}/boot/loader.rc)
${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
${.CURDIR}/../../forth/loader.rc ${DESTDIR}/boot
diff --git a/sys/boot/sparc64/loader/help.sparc64 b/sys/boot/sparc64/loader/help.sparc64
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/sys/boot/sparc64/loader/help.sparc64
diff --git a/sys/boot/sparc64/loader/locore.s b/sys/boot/sparc64/loader/locore.s
deleted file mode 100644
index 920171a34a1e..000000000000
--- a/sys/boot/sparc64/loader/locore.s
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * Initial implementation:
- * Copyright (c) 2001 Robert Drehmel
- * All rights reserved.
- *
- * As long as the above copyright statement and this notice remain
- * unchanged, you can do what ever you want with this file.
- *
- * $FreeBSD$
- */
-
-#define LOCORE
-
-#include <machine/asi.h>
-#include <machine/asm.h>
-#include <machine/pstate.h>
-#include <machine/smp.h>
-#include <machine/upa.h>
-
-#define PAGE_SIZE 8192
-#define PAGE_SHIFT 13
-
-#define SPOFF 2047
-#define STACK_SIZE (2 * PAGE_SIZE)
-
-ENTRY(_start)
- /* limit interrupts */
- wrpr %g0, 13, %pil
-
- /*
- * PSTATE: privileged, interrupts enabled, floating point
- * unit enabled
- */
- wrpr %g0, PSTATE_PRIV|PSTATE_IE|PSTATE_PEF, %pstate
- wr %g0, 0x4, %fprs
-
- setx stack + STACK_SIZE - SPOFF - CCFSZ, %l7, %l6
- mov %l6, %sp
- call main
- mov %o4, %o0
- sir
-
-/*
- * %o0 input VA constant
- * %o1 current iTLB offset
- * %o2 current iTLB TTE tag
- */
-ENTRY(itlb_va_to_pa)
- clr %o1
-0: ldxa [%o1] ASI_ITLB_TAG_READ_REG, %o2
- cmp %o2, %o0
- bne,a %xcc, 1f
- nop
- /* return PA of matching entry */
- ldxa [%o1] ASI_ITLB_DATA_ACCESS_REG, %o0
- sllx %o0, 23, %o0
- srlx %o0, PAGE_SHIFT+23, %o0
- sllx %o0, PAGE_SHIFT, %o0
- retl
- mov %o0, %o1
-1: cmp %o1, 63<<3
- blu %xcc, 0b
- add %o1, 8, %o1
- clr %o0
- retl
- not %o0
-
-ENTRY(dtlb_va_to_pa)
- clr %o1
-0: ldxa [%o1] ASI_DTLB_TAG_READ_REG, %o2
- cmp %o2, %o0
- bne,a %xcc, 1f
- nop
- /* return PA of matching entry */
- ldxa [%o1] ASI_DTLB_DATA_ACCESS_REG, %o0
- sllx %o0, 23, %o0
- srlx %o0, PAGE_SHIFT+23, %o0
- sllx %o0, PAGE_SHIFT, %o0
- retl
- mov %o0, %o1
-1: cmp %o1, 63<<3
- blu %xcc, 0b
- add %o1, 8, %o1
- clr %o0
- retl
- not %o0
-
-/*
- * %o0 = slot number
- * %o1 = vpn
- * %o2 = tte data
- */
-ENTRY(itlb_enter)
- rdpr %pstate, %o4
- wrpr %o4, PSTATE_IE, %pstate
- sllx %o0, 3, %o0
- sllx %o1, PAGE_SHIFT, %o1
- mov AA_IMMU_TAR, %o3
- stxa %o1, [%o3] ASI_IMMU
- stxa %o2, [%o0] ASI_ITLB_DATA_ACCESS_REG
- membar #Sync
- retl
- wrpr %o4, 0, %pstate
-
-ENTRY(dtlb_enter)
- rdpr %pstate, %o4
- wrpr %o4, PSTATE_IE, %pstate
- sllx %o0, 3, %o0
- sllx %o1, PAGE_SHIFT, %o1
- mov AA_DMMU_TAR, %o3
- stxa %o1, [%o3] ASI_DMMU
- stxa %o2, [%o0] ASI_DTLB_DATA_ACCESS_REG
- membar #Sync
- retl
- wrpr %o4, 0, %pstate
-
- .comm stack, STACK_SIZE, 32
- .comm smp_stack, STACK_SIZE, 32