Changes for boot loading of symbols.

This commit is contained in:
brezak 1993-08-29 12:48:10 +00:00
parent 7f550be7fd
commit aaf4f8dbc5
3 changed files with 50 additions and 26 deletions

View File

@ -1,6 +1,6 @@
# Copyright 1990 W. Jolitz
# from: @(#)Makefile.i386 7.1 5/10/91
# $Id: Makefile.i386,v 1.27 1993/08/27 23:58:20 brezak Exp $
# $Id: Makefile.i386,v 1.28 1993/08/29 12:48:10 brezak Exp $
#
# Makefile for NetBSD
#
@ -24,6 +24,8 @@ TOUCH= touch -f -c
LD= /usr/bin/ld
CC= cc
CPP= cpp
STRIP= strip
DBSYM= /usr/sbin/dbsym
S= ../../../..
I386= ../..
@ -42,7 +44,7 @@ SYSTEM_OBJS=locore.o ${OBJS} param.o ioconf.o conf.o
SYSTEM_DEP=Makefile symbols.sort ${SYSTEM_OBJS}
SYSTEM_LD_HEAD= @echo loading $@; rm -f $@
SYSTEM_LD= @${LD} -z -T ${LOAD_ADDRESS} -o $@ -X vers.o ${SYSTEM_OBJS}
SYSTEM_LD_TAIL= @echo rearranging symbols; symorder symbols.sort $@; /usr/sbin/dbsym -fT ${LOAD_ADDRESS} $@; size $@; chmod 755 $@
SYSTEM_LD_TAIL= @echo rearranging symbols; symorder symbols.sort $@; ${DBSYM} -fT ${LOAD_ADDRESS} $@; ${STRIP} -x $@; size $@; chmod 755 $@
# (XXX) ok, this is weird. but we've got a working ed, and a broken ex, and
# the script is identical for either... -- cgd

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)locore.s 7.3 (Berkeley) 5/13/91
* $Id: locore.s,v 1.27 1993/08/23 05:01:47 cgd Exp $
* $Id: locore.s,v 1.28 1993/08/29 12:48:54 brezak Exp $
*/
@ -45,6 +45,7 @@
*/
#include "npx.h"
#include "assym.s"
#include "machine/psl.h"
#include "machine/pte.h"
@ -121,6 +122,9 @@
* Initialization
*/
.data
.globl _esym
_esym: .long 0 # ptr to end of syms
.globl _cpu,_cold,_boothowto,_bootdev,_cyloffset,_atdevbase
_cpu: .long 0 # are we 386, 386sx, or 486
_cold: .long 1 # cold till we are not
@ -140,7 +144,7 @@ start: movw $0x1234,0x472 # warm boot
.space 0x500 # skip over warm boot shit
/*
* pass parameters on stack (howto, bootdev, unit, cyloffset)
* pass parameters on stack (howto, bootdev, unit, cyloffset, esym)
* note: (%esp) is return address of boot
* ( if we want to hold onto /boot, it's physical %esp up to _end)
*/
@ -151,6 +155,9 @@ start: movw $0x1234,0x472 # warm boot
movl %eax,_bootdev-KERNBASE
movl 12(%esp),%eax
movl %eax,_cyloffset-KERNBASE
movl 16(%esp),%eax
addl $ KERNBASE,%eax
movl %eax, _esym-KERNBASE
/* find out our CPU type. */
pushfl
@ -221,28 +228,48 @@ start: movw $0x1234,0x472 # warm boot
movl %eax,_Maxmem-KERNBASE
#endif
/* find end of kernel image */
movl $_end-KERNBASE,%ecx
addl $NBPG-1,%ecx
andl $~(NBPG-1),%ecx
movl %ecx,%esi
/* clear bss and memory for bootstrap pagetables. */
movl $_edata-KERNBASE,%edi
subl %edi,%ecx
addl $(UPAGES+5)*NBPG,%ecx
/*
* Virtual address space of kernel:
*
* text | data | bss | page dir | proc0 kernel stack | usr stk map | Sysmap
* 0 1 2 3 4
! * text | data | bss | [syms] | page dir | proc0 kernel stack | usr stk map | Sysmap
* 0 1 2 3 4
*/
/* find end of kernel image */
movl $_end-KERNBASE,%ecx
movl %ecx,%esi
movl $_edata-KERNBASE,%edi
subl %edi,%ecx
/* clear bss */
xorl %eax,%eax # pattern
cld
rep
stosb
movl %esi,_IdlePTD-KERNBASE /*physical address of Idle Address space */
movl %esi,%ecx # if syms are not loaded
#if defined(DDB) && !defined(SYMTAB_SPACE)
/* save the symbols (if loaded) */
cmpl $0,_esym-KERNBASE
je 1f
movl _esym-KERNBASE,%ecx
subl $ KERNBASE,%ecx
#endif
1: movl %ecx,%edi # edi= end || esym
addl $ NBPG-1,%ecx # page align up
andl $~(NBPG-1),%ecx
movl %ecx,%esi # esi=start of tables
subl %edi,%ecx
addl $(UPAGES+5)*NBPG,%ecx # size of tables
/* clear memory for bootstrap tables */
xorl %eax,%eax # pattern
cld
rep
stosb
/* physical address of Idle Address space */
movl %esi,_IdlePTD-KERNBASE
#define fillkpt \
1: movl %eax,(%ebx) ; \

View File

@ -23,7 +23,7 @@
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*
* $Id: db_aout.c,v 1.6 1993/08/02 17:53:11 mycroft Exp $
* $Id: db_aout.c,v 1.7 1993/08/29 12:49:13 brezak Exp $
*/
#include "types.h"
@ -60,10 +60,6 @@
(sp = (struct nlist *)((symtab) + 1), \
ep = (struct nlist *)((char *)sp + *(symtab)))
#ifndef SYMTAB_SPACE
#define SYMTAB_SPACE 63000
#endif
#ifdef SYMTAB_SPACE
int db_symtabsize = SYMTAB_SPACE;
char db_symtab[SYMTAB_SPACE] = { 1 };
@ -101,12 +97,11 @@ X_db_sym_init(symtab, esymtab, name)
(((vm_offset_t)(x) + sizeof(vm_size_t) - 1) & ~(sizeof(vm_size_t) - 1))
if (round_to_size(estrtab) != round_to_size(esymtab)) {
{
db_printf("[ %s symbol table not valid ]\n", name);
return;
}
}
#undef round_to_size
#endif
for (sp = sym_start; sp < sym_end; sp++) {
@ -124,7 +119,7 @@ X_db_sym_init(symtab, esymtab, name)
if (db_add_symbol_table(sym_start, sym_end, name, (char *)symtab) != -1) {
#ifndef SYMTAB_SPACE
db_printf("[ preserving %#x bytes of %s symbol table ]\n",
db_printf("[ preserving %d bytes of %s symbol table ]\n",
esymtab - (char *)symtab, name);
#endif
}