#!/bin/csh
# This script is needed as part of generating map files for mm and fs.
# kernel, mm and fs occupy successive chunks of virtual memory, and are
# linked to execute in the virtual addresses they occupy.  This means
# that when mm is linked, it must be forced to start at the virtual
# address that follows the kernel, and when fs is linked it must follow
# mm.  This script expects an smx executable on the standard input,
# and generates an ld(1) map file that will cause an executable
# to be linked to start at the virtual address following the smx executable
# on stdin.  The map file also causes the text and data segments
# to be 8Kb, aligned and multiples of 8Kb, assuming that next_prog_addr
# returns on address that is a multiple of 8Kb.  next_prog_addr
# expects an smx executable on its stdin.
#
# So in the Makefile for mm, we can generate a map file with:
# 
#     make_map_file <../kernel/kernel2

set start_addr = `next_prog_addr`
echo -n 'text = LOAD ?RX V'
echo -n $start_addr
echo \;
echo 'data = LOAD ?RWX A8192;'
