mirror of
https://github.com/freebsd/freebsd-src.git
synced 2024-12-04 10:19:26 +00:00
* Make a start on a realistic definition for bootinfo.
* Switch to proc0's stack and backing store before calling ia64_init so that we don't rely on the loader's stack at all. * Change kernel entry point name from locorestart to __start.
This commit is contained in:
parent
b03a0c9e5e
commit
e763b778c8
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=83301
@ -93,7 +93,6 @@ SYSTEM_SFILES= $S/$M/$M/locore.s
|
||||
SYSTEM_DEP= Makefile ${SYSTEM_OBJS}
|
||||
SYSTEM_OBJS= locore.o vnode_if.o ${OBJS} hints.o env.o config.o hack.So
|
||||
SYSTEM_LD= @${LD} ${FMT} -Bdynamic -T $S/conf/ldscript.$M \
|
||||
-e locorestart \
|
||||
-export-dynamic -dynamic-linker /red/herring \
|
||||
-o ${.TARGET} -X ${SYSTEM_OBJS} vers.o
|
||||
SYSTEM_LD_TAIL= @${OBJCOPY} --strip-symbol gcc2_compiled. ${.TARGET} ; \
|
||||
|
@ -65,6 +65,9 @@
|
||||
#include <nfs/nfs.h>
|
||||
#include <nfs/nfsdiskless.h>
|
||||
|
||||
ASSYM(UPAGES, UPAGES);
|
||||
ASSYM(PAGE_SIZE, PAGE_SIZE);
|
||||
|
||||
ASSYM(GD_CURPROC, offsetof(struct globaldata, gd_curproc));
|
||||
ASSYM(GD_FPCURPROC, offsetof(struct globaldata, gd_fpcurproc));
|
||||
ASSYM(GD_CURPCB, offsetof(struct globaldata, gd_curpcb));
|
||||
|
@ -63,24 +63,44 @@
|
||||
#include <machine/intrcnt.h>
|
||||
#endif
|
||||
|
||||
.section .data.proc0,"aw"
|
||||
.global proc0paddr
|
||||
.align PAGE_SIZE
|
||||
proc0paddr: .space UPAGES * PAGE_SIZE
|
||||
|
||||
.text
|
||||
|
||||
/*
|
||||
* Not really a leaf but we can't return.
|
||||
*/
|
||||
ENTRY(locorestart, 1)
|
||||
ENTRY(__start, 1)
|
||||
|
||||
movl r8=ia64_vector_table // set up IVT early
|
||||
movl r9=ia64_vhpt+(1<<8)+(15<<2)+1 // and VHPT
|
||||
;;
|
||||
mov cr.iva=r8
|
||||
mov cr.pta=r9
|
||||
movl r10=proc0
|
||||
;;
|
||||
add r10=P_ADDR,r10
|
||||
movl r11=proc0paddr
|
||||
;;
|
||||
st8 [r10]=r11
|
||||
srlz.i
|
||||
;;
|
||||
srlz.d
|
||||
mov r9=UPAGES*PAGE_SIZE-16
|
||||
;;
|
||||
movl gp=__gp // find kernel globals
|
||||
add sp=r9,r11 // proc0's stack
|
||||
add r10=SIZEOF_USER,r11 // proc0's backing store
|
||||
mov ar.rsc=0 // turn off rse
|
||||
;;
|
||||
mov ar.bspstore=r10 // switch backing store
|
||||
;;
|
||||
loadrs // invalidate regs
|
||||
;;
|
||||
mov ar.rsc=3 // turn rse back on
|
||||
;;
|
||||
br.call.sptk.many rp=ia64_init
|
||||
|
||||
@ -184,12 +204,6 @@ XENTRY(esigcode)
|
||||
.quad esigcode-sigcode
|
||||
.text
|
||||
|
||||
.data
|
||||
EXPORT(proc0paddr)
|
||||
.quad 0
|
||||
|
||||
.text
|
||||
|
||||
/* XXX: make systat/vmstat happy */
|
||||
.data
|
||||
EXPORT(intrnames)
|
||||
|
@ -63,24 +63,44 @@
|
||||
#include <machine/intrcnt.h>
|
||||
#endif
|
||||
|
||||
.section .data.proc0,"aw"
|
||||
.global proc0paddr
|
||||
.align PAGE_SIZE
|
||||
proc0paddr: .space UPAGES * PAGE_SIZE
|
||||
|
||||
.text
|
||||
|
||||
/*
|
||||
* Not really a leaf but we can't return.
|
||||
*/
|
||||
ENTRY(locorestart, 1)
|
||||
ENTRY(__start, 1)
|
||||
|
||||
movl r8=ia64_vector_table // set up IVT early
|
||||
movl r9=ia64_vhpt+(1<<8)+(15<<2)+1 // and VHPT
|
||||
;;
|
||||
mov cr.iva=r8
|
||||
mov cr.pta=r9
|
||||
movl r10=proc0
|
||||
;;
|
||||
add r10=P_ADDR,r10
|
||||
movl r11=proc0paddr
|
||||
;;
|
||||
st8 [r10]=r11
|
||||
srlz.i
|
||||
;;
|
||||
srlz.d
|
||||
mov r9=UPAGES*PAGE_SIZE-16
|
||||
;;
|
||||
movl gp=__gp // find kernel globals
|
||||
add sp=r9,r11 // proc0's stack
|
||||
add r10=SIZEOF_USER,r11 // proc0's backing store
|
||||
mov ar.rsc=0 // turn off rse
|
||||
;;
|
||||
mov ar.bspstore=r10 // switch backing store
|
||||
;;
|
||||
loadrs // invalidate regs
|
||||
;;
|
||||
mov ar.rsc=3 // turn rse back on
|
||||
;;
|
||||
br.call.sptk.many rp=ia64_init
|
||||
|
||||
@ -184,12 +204,6 @@ XENTRY(esigcode)
|
||||
.quad esigcode-sigcode
|
||||
.text
|
||||
|
||||
.data
|
||||
EXPORT(proc0paddr)
|
||||
.quad 0
|
||||
|
||||
.text
|
||||
|
||||
/* XXX: make systat/vmstat happy */
|
||||
.data
|
||||
EXPORT(intrnames)
|
||||
|
@ -81,12 +81,12 @@
|
||||
u_int64_t cycles_per_usec;
|
||||
u_int32_t cycles_per_sec;
|
||||
int cold = 1;
|
||||
struct bootinfo_kernel bootinfo;
|
||||
struct bootinfo bootinfo;
|
||||
|
||||
struct mtx sched_lock;
|
||||
struct mtx Giant;
|
||||
|
||||
struct user *proc0paddr;
|
||||
char proc0paddr[UPAGES * PAGE_SIZE];
|
||||
|
||||
char machine[] = "ia64";
|
||||
SYSCTL_STRING(_hw, HW_MACHINE, machine, CTLFLAG_RD, machine, 0, "");
|
||||
@ -389,20 +389,20 @@ ia64_init()
|
||||
*/
|
||||
kernstart = trunc_page(kernel_text);
|
||||
#ifdef DDBxx
|
||||
ksym_start = (void *)bootinfo.ssym;
|
||||
ksym_end = (void *)bootinfo.esym;
|
||||
ksym_start = (void *)bootinfo.bi_symtab;
|
||||
ksym_end = (void *)bootinfo.bi_esymtab;
|
||||
kernend = (vm_offset_t)round_page(ksym_end);
|
||||
#else
|
||||
kernend = (vm_offset_t)round_page(_end);
|
||||
#endif
|
||||
/* But if the bootstrap tells us otherwise, believe it! */
|
||||
if (bootinfo.kernend)
|
||||
kernend = round_page(bootinfo.kernend);
|
||||
preload_metadata = (caddr_t)bootinfo.modptr;
|
||||
if (bootinfo.bi_kernend)
|
||||
kernend = round_page(bootinfo.bi_kernend);
|
||||
preload_metadata = (caddr_t)bootinfo.bi_modulep;
|
||||
if (envmode == 1)
|
||||
kern_envp = static_env;
|
||||
else
|
||||
kern_envp = bootinfo.envp;
|
||||
kern_envp = (caddr_t)bootinfo.bi_envp;
|
||||
|
||||
/* Init basic tunables, including hz */
|
||||
init_param();
|
||||
@ -546,12 +546,6 @@ ia64_init()
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Init mapping for u page(s) for proc 0
|
||||
*/
|
||||
proc0paddr = proc0.p_addr =
|
||||
(struct user *)pmap_steal_memory(UPAGES * PAGE_SIZE);
|
||||
|
||||
/*
|
||||
* Setup the global data for the bootstrap cpu.
|
||||
*/
|
||||
@ -603,7 +597,7 @@ ia64_init()
|
||||
boothowto |= RB_KDB;
|
||||
#endif
|
||||
/* boothowto |= RB_KDB | RB_GDB; */
|
||||
for (p = bootinfo.boot_flags; p && *p != '\0'; p++) {
|
||||
for (p = bootinfo.bi_flags; p && *p != '\0'; p++) {
|
||||
/*
|
||||
* Note that we'd really like to differentiate case here,
|
||||
* but the Ia64 AXP Architecture Reference Manual
|
||||
|
@ -41,46 +41,19 @@
|
||||
* (u_long), then the bootinfo
|
||||
*/
|
||||
|
||||
#define BOOTINFO_MAGIC 0xdeadbeeffeedface
|
||||
|
||||
struct bootinfo_v1 {
|
||||
u_long ssym; /* 0: start of kernel sym table */
|
||||
u_long esym; /* 8: end of kernel sym table */
|
||||
char boot_flags[64]; /* 16: boot flags */
|
||||
char booted_kernel[64]; /* 80: name of booted kernel */
|
||||
void *hwrpb; /* 144: hwrpb pointer (BEVA) */
|
||||
u_long hwrpbsize; /* 152: size of hwrpb data */
|
||||
int (*cngetc) __P((void)); /* 160: console getc pointer */
|
||||
void (*cnputc) __P((int)); /* 168: console putc pointer */
|
||||
void (*cnpollc) __P((int)); /* 176: console pollc pointer */
|
||||
u_long pad[6]; /* 184: rsvd for future use */
|
||||
char *envp; /* 232: start of environment */
|
||||
u_long kernend; /* 240: end of kernel */
|
||||
u_long modptr; /* 248: FreeBSD module base */
|
||||
/* 256: total size */
|
||||
struct bootinfo {
|
||||
char bi_flags[64]; /* boot flags */
|
||||
char bi_kernel[64]; /* name of booted kernel */
|
||||
u_int64_t bi_systab; /* pa of EFI system table */
|
||||
u_int64_t bi_memmap; /* pa of EFI memory map */
|
||||
u_int64_t bi_memmap_size; /* size of EFI memory map */
|
||||
u_int64_t bi_memdesc_size; /* sizeof EFI memory desc */
|
||||
u_int32_t bi_memdesc_version; /* EFI memory desc version */
|
||||
u_int64_t bi_symtab; /* start of kernel sym table */
|
||||
u_int64_t bi_esymtab; /* end of kernel sym table */
|
||||
u_int64_t bi_kernend; /* end of kernel space */
|
||||
u_int64_t bi_envp; /* environment */
|
||||
u_int64_t bi_modulep; /* preloaded modules */
|
||||
};
|
||||
|
||||
/*
|
||||
* Kernel-internal structure used to hold important bits of boot
|
||||
* information. NOT to be used by boot blocks.
|
||||
*
|
||||
* Note that not all of the fields from the bootinfo struct(s)
|
||||
* passed by the boot blocks aren't here (because they're not currently
|
||||
* used by the kernel!). Fields here which aren't supplied by the
|
||||
* bootinfo structure passed by the boot blocks are supposed to be
|
||||
* filled in at startup with sane contents.
|
||||
*/
|
||||
struct bootinfo_kernel {
|
||||
u_long ssym; /* start of syms */
|
||||
u_long esym; /* end of syms */
|
||||
u_long modptr; /* FreeBSD module pointer */
|
||||
u_long kernend; /* "end of kernel" from boot code */
|
||||
char *envp; /* "end of kernel" from boot code */
|
||||
u_long hwrpb_phys; /* hwrpb physical address */
|
||||
u_long hwrpb_size; /* size of hwrpb data */
|
||||
char boot_flags[64]; /* boot flags */
|
||||
char booted_kernel[64]; /* name of booted kernel */
|
||||
char booted_dev[64]; /* name of booted device */
|
||||
};
|
||||
|
||||
extern struct bootinfo_kernel bootinfo;
|
||||
extern struct bootinfo bootinfo;
|
||||
|
Loading…
Reference in New Issue
Block a user