: System(p)
{
Addr addr = 0;
+ Addr paddr = 0;
+
+ /**
+ * The symbol swapper_pg_dir marks the beginning of the kernel and
+ * the location of bootloader passed arguments
+ */
+ if (!kernelSymtab->findAddress("swapper_pg_dir", KernelStart)) {
+ panic("Could not determine start location of kernel");
+ }
+
+ /**
+ * Since we aren't using a bootloader, we have to copy the
+ * kernel arguments directly into the kernel's memory.
+ */
+ paddr = vtophys(physmem, CommandLine());
+ char *commandline = (char *)physmem->dma_addr(paddr, sizeof(uint64_t));
+ if (commandline)
+ strncpy(commandline, params->boot_osflags.c_str(), CommandLineSize);
/**
* find the address of the est_cycle_freq variable and insert it
* calculated it by using the PIT, RTC, etc.
*/
if (kernelSymtab->findAddress("est_cycle_freq", addr)) {
- Addr paddr = vtophys(physmem, addr);
+ paddr = vtophys(physmem, addr);
uint8_t *est_cycle_frequency =
physmem->dma_addr(paddr, sizeof(uint64_t));
}
- /**
- * Since we aren't using a bootloader, we have to copy the kernel arguments
- * directly into the kernels memory.
- */
- {
- Addr paddr = vtophys(physmem, PARAM_ADDR);
- char *commandline = (char*)physmem->dma_addr(paddr, sizeof(uint64_t));
- if (commandline)
- strcpy(commandline, params->boot_osflags.c_str());
- }
-
-
/**
* EV5 only supports 127 ASNs so we are going to tell the kernel that the
* paritiuclar EV6 we have only supports 127 asns.
* 255 ASNs.
*/
if (kernelSymtab->findAddress("dp264_mv", addr)) {
- Addr paddr = vtophys(physmem, addr);
+ paddr = vtophys(physmem, addr);
char *dp264_mv = (char *)physmem->dma_addr(paddr, sizeof(uint64_t));
if (dp264_mv) {
#ifndef __KERN_LINUX_LINUX_SYSTEM_HH__
#define __KERN_LINUX_LINUX_SYSTEM_HH__
-/**
- * MAGIC address where the kernel arguments should go. Defined as
- * PARAM in linux kernel alpha-asm.
- */
-const Addr PARAM_ADDR = ULL(0xfffffc000030a000);
-
class ExecContext;
class BreakPCEvent;
*/
class LinuxSystem : public System
{
+ private:
+ /**
+ * Addresses defining where the kernel bootloader places various
+ * elements. Details found in include/asm-alpha/system.h
+ */
+ Addr KernelStart; // Lookup the symbol swapper_pg_dir
+
+ public:
+ Addr InitStack() const { return KernelStart + 0x02000; }
+ Addr EmptyPGT() const { return KernelStart + 0x04000; }
+ Addr EmptyPGE() const { return KernelStart + 0x08000; }
+ Addr ZeroPGE() const { return KernelStart + 0x0A000; }
+ Addr StartAddr() const { return KernelStart + 0x10000; }
+
+ Addr Param() const { return ZeroPGE() + 0x0; }
+ Addr CommandLine() const { return Param() + 0x0; }
+ Addr InitrdStart() const { return Param() + 0x100; }
+ Addr InitrdSize() const { return Param() + 0x108; }
+ static const int CommandLineSize = 256;
+
private:
#ifndef NDEBUG
/** Event to halt the simulator if the kernel calls panic() */