summaryrefslogtreecommitdiff
path: root/kern/linux
diff options
context:
space:
mode:
Diffstat (limited to 'kern/linux')
-rw-r--r--kern/linux/linux.hh2
-rw-r--r--kern/linux/linux_syscalls.cc664
-rw-r--r--kern/linux/linux_syscalls.hh13
-rw-r--r--kern/linux/linux_system.cc125
-rw-r--r--kern/linux/linux_system.hh72
5 files changed, 466 insertions, 410 deletions
diff --git a/kern/linux/linux.hh b/kern/linux/linux.hh
index a3cb94e91..9905a0b16 100644
--- a/kern/linux/linux.hh
+++ b/kern/linux/linux.hh
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003 The Regents of The University of Michigan
+ * Copyright (c) 2004 The Regents of The University of Michigan
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/kern/linux/linux_syscalls.cc b/kern/linux/linux_syscalls.cc
index d259499a2..c3e0bf1e5 100644
--- a/kern/linux/linux_syscalls.cc
+++ b/kern/linux/linux_syscalls.cc
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003 The Regents of The University of Michigan
+ * Copyright (c) 2004 The Regents of The University of Michigan
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -30,335 +30,335 @@
namespace {
const char *
- standard_strings[SystemCalls<Linux>::StandardNumber] = {
-
-
- "llseek", //0
- "newselect", //1
- "sysctl", //2
- "access", //3
- "acct", //4
- "adjtimex", //5
- "afs_syscall", //6
- "alarm", //7
- "bdflush", //8
- "break", //9
-
-
- "brk", //10
- "capget", //11
- "capset", //12
- "chdir", //13
- "chmod", //14
- "chown", //15
- "chown32", //16
- "chroot", //17
- "clock_getres", //18
- "clock_gettime", //19
-
-
- "clock_nanosleep", //20
- "clock_settime", //21
- "clone", //22
- "close", //23
- "creat", //24
- "create_module", //25
- "delete_module", //26
- "dup", //27
- "dup2", //28
- "epoll_create", //29
-
-
- "epoll_ctl", //30
- "epoll_wait", //31
- "execve", //32
- "exit", //33
- "exit_group", //34
- "fadvise64", //35
- "fadvise64_64", //36
- "fchdir", //37
- "fchmod", //38
- "fchown", //39
-
-
- "fchown32", //40
- "fcntl", //41
- "fcntl64", //42
- "fdatasync", //43
- "fgetxattr", //44
- "flistxattr", //45
- "flock", //46
- "fork", //47
- "fremovexattr", //48
- "fsetxattr", //49
-
-
- "fstat", //50
- "fstat64", //51
- "fstatfs", //52
- "fstatfs64", //53
- "fsync", //54
- "ftime", //55
- "ftruncate", //56
- "ftruncate64", //57
- "futex", //58
- "get_kernel_syms", //59
-
-
- "get_thread_area", //60
- "getcwd", //61
- "getdents", //62
- "getdents64", //63
- "getegid", //64
- "getegid32", //65
- "geteuid", //66
- "geteuid32", //67
- "getgid", //68
- "getgid32", //69
-
-
- "getgroups", //70
- "getgroups32", //71
- "getitimer", //72
- "getpgid", //73
- "getpgrp", //74
- "getpid", //75
- "getpmsg", //76
- "getppid", //77
- "getpriority", //78
- "getresgid", //79
-
-
- "getresgid32", //80
- "getresuid", //81
- "getresuid32", //82
- "getrlimit", //83
- "getrusage", //84
- "getsid", //85
- "gettid", //86
- "gettimeofday", //87
- "getuid", //88
- "getuid32", //89
-
-
- "getxattr", //90
- "gtty", //91
- "idle", //92
- "init_module", //93
- "io_cancel", //94
- "io_destroy", //95
- "io_getevents", //96
- "io_setup", //97
- "io_submit", //98
- "ioctl", //99
-
-
- "ioperm", //100
- "iopl", //101
- "ipc", //102
- "kill", //103
- "lchown", //104
- "lchown32", //105
- "lgetxattr", //106
- "link", //107
- "listxattr", //108
- "llistxattr", //109
-
-
- "lock", //110
- "lookup_dcookie", //111
- "lremovexattr", //112
- "lseek", //113
- "lsetxattr", //114
- "lstat", //115
- "lstat64", //116
- "madvise", //117
- "madvise1", //118
- "mincore", //119
-
-
- "mkdir", //120
- "mknod", //121
- "mlock", //122
- "mlockall", //123
- "mmap", //124
- "mmap2", //125
- "modify_ldt", //126
- "mount", //127
- "mprotect", //128
- "mpx", //129
-
-
- "mremap", //130
- "msync", //131
- "munlock", //132
- "munlockall", //133
- "munmap", //134
- "nanosleep", //135
- "nfsservctl", //136
- "nice", //137
- "oldfstat", //138
- "oldlstat", //139
-
-
- "oldolduname", //140
- "oldstat", //141
- "olduname", //142
- "open", //143
- "pause", //144
- "personality", //145
- "pipe", //146
- "pivot_root", //147
- "poll", //148
- "prctl", //149
-
-
- "pread64", //150
- "prof", //151
- "profil", //152
- "ptrace", //153
- "putpmsg", //154
- "pwrite64", //155
- "query_module", //156
- "quotactl", //157
- "read", //158
- "readahead", //159
-
-
- "readdir", //160
- "readlink", //161
- "readv", //162
- "reboot", //163
- "remap_file_pages", //164
- "removexattr", //165
- "rename", //166
- "restart_syscall", //167
- "rmdir", //168
- "rt_sigaction", //169
-
-
- "rt_sigpending", //170
- "rt_sigprocmask", //171
- "rt_sigqueueinfo", //172
- "rt_sigreturn", //173
- "rt_sigsuspend", //174
- "rt_sigtimedwait", //175
- "sched_get_priority_max", //176
- "sched_get_priority_min", //177
- "sched_getaffinity", //178
- "sched_getparam", //179
-
-
- "sched_getscheduler", //180
- "sched_rr_get_interval", //181
- "sched_setaffinity", //182
- "sched_setparam", //183
- "sched_setscheduler", //184
- "sched_yield", //185
- "select", //186
- "sendfile", //187
- "sendfile64", //188
- "set_thread_area", //189
-
-
- "set_tid_address", //190
- "setdomainname", //191
- "setfsgid", //192
- "setfsgid32", //193
- "setfsuid", //194
- "setfsuid32", //195
- "setgid", //196
- "setgid32", //197
- "setgroups", //198
- "setgroups32", //199
-
-
- "sethostname", //200
- "setitimer", //201
- "setpgid", //202
- "setpriority", //203
- "setregid", //204
- "setregid32", //205
- "setresgid", //206
- "setresgid32", //207
- "setresuid", //208
- "setresuid32", //209
-
-
- "setreuid", //210
- "setreuid32", //211
- "setrlimit", //212
- "setsid", //213
- "settimeofday", //214
- "setuid", //215
- "setuid32", //216
- "setxattr", //217
- "sgetmask", //218
- "sigaction", //219
-
-
- "sigaltstack", //220
- "signal", //221
- "sigpending", //222
- "sigprocmask", //223
- "sigreturn", //224
- "sigsuspend", //225
- "socketcall", //226
- "ssetmask", //227
- "stat", //228
- "stat64", //229
-
-
- "statfs", //230
- "statfs64", //231
- "stime", //232
- "stty", //233
- "swapoff", //234
- "swapon", //235
- "symlink", //236
- "sync", //237
- "sysfs", //238
- "sysinfo", //239
-
-
- "syslog", //240
- "tgkill", //241
- "time", //242
- "timer_create", //243
- "timer_delete", //244
- "timer_getoverrun", //245
- "timer_gettime", //246
- "timer_settime", //247
- "times", //248
- "tkill", //249
-
-
- "truncate", //250
- "truncate64", //251
- "ugetrlimit", //252
- "ulimit", //253
- "umask", //254
- "umount", //255
- "umount2", //256
- "uname", //257
- "unlink", //258
- "uselib", //259
-
-
- "ustat", //260
- "utime", //261
- "utimes", //262
- "vfork", //263
- "vhangup", //264
- "vm86", //265
- "vm86old", //266
- "vserver", //267
- "wait4", //268
- "waitpid", //269
-
-
- "write", //270
- "writev", //271
+ standard_strings[SystemCalls<Linux>::Number] = {
+
+
+ "llseek", //0
+ "newselect", //1
+ "sysctl", //2
+ "access", //3
+ "acct", //4
+ "adjtimex", //5
+ "afs_syscall", //6
+ "alarm", //7
+ "bdflush", //8
+ "break", //9
+
+
+ "brk", //10
+ "capget", //11
+ "capset", //12
+ "chdir", //13
+ "chmod", //14
+ "chown", //15
+ "chown32", //16
+ "chroot", //17
+ "clock_getres", //18
+ "clock_gettime", //19
+
+
+ "clock_nanosleep", //20
+ "clock_settime", //21
+ "clone", //22
+ "close", //23
+ "creat", //24
+ "create_module", //25
+ "delete_module", //26
+ "dup", //27
+ "dup2", //28
+ "epoll_create", //29
+
+
+ "epoll_ctl", //30
+ "epoll_wait", //31
+ "execve", //32
+ "exit", //33
+ "exit_group", //34
+ "fadvise64", //35
+ "fadvise64_64", //36
+ "fchdir", //37
+ "fchmod", //38
+ "fchown", //39
+
+
+ "fchown32", //40
+ "fcntl", //41
+ "fcntl64", //42
+ "fdatasync", //43
+ "fgetxattr", //44
+ "flistxattr", //45
+ "flock", //46
+ "fork", //47
+ "fremovexattr", //48
+ "fsetxattr", //49
+
+
+ "fstat", //50
+ "fstat64", //51
+ "fstatfs", //52
+ "fstatfs64", //53
+ "fsync", //54
+ "ftime", //55
+ "ftruncate", //56
+ "ftruncate64", //57
+ "futex", //58
+ "get_kernel_syms", //59
+
+
+ "get_thread_area", //60
+ "getcwd", //61
+ "getdents", //62
+ "getdents64", //63
+ "getegid", //64
+ "getegid32", //65
+ "geteuid", //66
+ "geteuid32", //67
+ "getgid", //68
+ "getgid32", //69
+
+
+ "getgroups", //70
+ "getgroups32", //71
+ "getitimer", //72
+ "getpgid", //73
+ "getpgrp", //74
+ "getpid", //75
+ "getpmsg", //76
+ "getppid", //77
+ "getpriority", //78
+ "getresgid", //79
+
+
+ "getresgid32", //80
+ "getresuid", //81
+ "getresuid32", //82
+ "getrlimit", //83
+ "getrusage", //84
+ "getsid", //85
+ "gettid", //86
+ "gettimeofday", //87
+ "getuid", //88
+ "getuid32", //89
+
+
+ "getxattr", //90
+ "gtty", //91
+ "idle", //92
+ "init_module", //93
+ "io_cancel", //94
+ "io_destroy", //95
+ "io_getevents", //96
+ "io_setup", //97
+ "io_submit", //98
+ "ioctl", //99
+
+
+ "ioperm", //100
+ "iopl", //101
+ "ipc", //102
+ "kill", //103
+ "lchown", //104
+ "lchown32", //105
+ "lgetxattr", //106
+ "link", //107
+ "listxattr", //108
+ "llistxattr", //109
+
+
+ "lock", //110
+ "lookup_dcookie", //111
+ "lremovexattr", //112
+ "lseek", //113
+ "lsetxattr", //114
+ "lstat", //115
+ "lstat64", //116
+ "madvise", //117
+ "madvise1", //118
+ "mincore", //119
+
+
+ "mkdir", //120
+ "mknod", //121
+ "mlock", //122
+ "mlockall", //123
+ "mmap", //124
+ "mmap2", //125
+ "modify_ldt", //126
+ "mount", //127
+ "mprotect", //128
+ "mpx", //129
+
+
+ "mremap", //130
+ "msync", //131
+ "munlock", //132
+ "munlockall", //133
+ "munmap", //134
+ "nanosleep", //135
+ "nfsservctl", //136
+ "nice", //137
+ "oldfstat", //138
+ "oldlstat", //139
+
+
+ "oldolduname", //140
+ "oldstat", //141
+ "olduname", //142
+ "open", //143
+ "pause", //144
+ "personality", //145
+ "pipe", //146
+ "pivot_root", //147
+ "poll", //148
+ "prctl", //149
+
+
+ "pread64", //150
+ "prof", //151
+ "profil", //152
+ "ptrace", //153
+ "putpmsg", //154
+ "pwrite64", //155
+ "query_module", //156
+ "quotactl", //157
+ "read", //158
+ "readahead", //159
+
+
+ "readdir", //160
+ "readlink", //161
+ "readv", //162
+ "reboot", //163
+ "remap_file_pages", //164
+ "removexattr", //165
+ "rename", //166
+ "restart_syscall", //167
+ "rmdir", //168
+ "rt_sigaction", //169
+
+
+ "rt_sigpending", //170
+ "rt_sigprocmask", //171
+ "rt_sigqueueinfo", //172
+ "rt_sigreturn", //173
+ "rt_sigsuspend", //174
+ "rt_sigtimedwait", //175
+ "sched_get_priority_max", //176
+ "sched_get_priority_min", //177
+ "sched_getaffinity", //178
+ "sched_getparam", //179
+
+
+ "sched_getscheduler", //180
+ "sched_rr_get_interval", //181
+ "sched_setaffinity", //182
+ "sched_setparam", //183
+ "sched_setscheduler", //184
+ "sched_yield", //185
+ "select", //186
+ "sendfile", //187
+ "sendfile64", //188
+ "set_thread_area", //189
+
+
+ "set_tid_address", //190
+ "setdomainname", //191
+ "setfsgid", //192
+ "setfsgid32", //193
+ "setfsuid", //194
+ "setfsuid32", //195
+ "setgid", //196
+ "setgid32", //197
+ "setgroups", //198
+ "setgroups32", //199
+
+
+ "sethostname", //200
+ "setitimer", //201
+ "setpgid", //202
+ "setpriority", //203
+ "setregid", //204
+ "setregid32", //205
+ "setresgid", //206
+ "setresgid32", //207
+ "setresuid", //208
+ "setresuid32", //209
+
+
+ "setreuid", //210
+ "setreuid32", //211
+ "setrlimit", //212
+ "setsid", //213
+ "settimeofday", //214
+ "setuid", //215
+ "setuid32", //216
+ "setxattr", //217
+ "sgetmask", //218
+ "sigaction", //219
+
+
+ "sigaltstack", //220
+ "signal", //221
+ "sigpending", //222
+ "sigprocmask", //223
+ "sigreturn", //224
+ "sigsuspend", //225
+ "socketcall", //226
+ "ssetmask", //227
+ "stat", //228
+ "stat64", //229
+
+
+ "statfs", //230
+ "statfs64", //231
+ "stime", //232
+ "stty", //233
+ "swapoff", //234
+ "swapon", //235
+ "symlink", //236
+ "sync", //237
+ "sysfs", //238
+ "sysinfo", //239
+
+
+ "syslog", //240
+ "tgkill", //241
+ "time", //242
+ "timer_create", //243
+ "timer_delete", //244
+ "timer_getoverrun", //245
+ "timer_gettime", //246
+ "timer_settime", //247
+ "times", //248
+ "tkill", //249
+
+
+ "truncate", //250
+ "truncate64", //251
+ "ugetrlimit", //252
+ "ulimit", //253
+ "umask", //254
+ "umount", //255
+ "umount2", //256
+ "uname", //257
+ "unlink", //258
+ "uselib", //259
+
+
+ "ustat", //260
+ "utime", //261
+ "utimes", //262
+ "vfork", //263
+ "vhangup", //264
+ "vm86", //265
+ "vm86old", //266
+ "vserver", //267
+ "wait4", //268
+ "waitpid", //269
+
+
+ "write", //270
+ "writev", //271
};
@@ -367,9 +367,7 @@ namespace {
const char *
SystemCalls<Linux>::name(int num)
{
- if (num >= StandardNumber)
- return 0;
- else if (num >= 0)
+ if ((num >= 0) && (num < Number))
return standard_strings[num];
else
return 0;
diff --git a/kern/linux/linux_syscalls.hh b/kern/linux/linux_syscalls.hh
index 54d2391a8..a729431a0 100644
--- a/kern/linux/linux_syscalls.hh
+++ b/kern/linux/linux_syscalls.hh
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003 The Regents of The University of Michigan
+ * Copyright (c) 2004 The Regents of The University of Michigan
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -308,22 +308,15 @@ struct SystemCalls<Linux>
waitpid = 270,
write = 271,
writev = 272,
- StandardNumber
+ Number
};
static const char *name(int num);
static bool validSyscallNumber(int num) {
- return num < StandardNumber;
+ return num < Number;
}
- /* why does this exist, I don't think it is needed for linux */
- static int convert(int syscall_num) {
- if (!validSyscallNumber(syscall_num))
- return -1;
-
- return syscall_num ;
- }
};
#endif // __LINUX_SYSCALLS_HH__
diff --git a/kern/linux/linux_system.cc b/kern/linux/linux_system.cc
index a0000fe33..6287ce470 100644
--- a/kern/linux/linux_system.cc
+++ b/kern/linux/linux_system.cc
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003 The Regents of The University of Michigan
+ * Copyright (c) 2004 The Regents of The University of Michigan
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -26,6 +26,14 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+/**
+ * @file
+ * linux_system.cc loads the linux kernel, console, pal and patches certain functions.
+ * The symbol tables are loaded so that traces can show the executing function and we can
+ * skip functions. Various delay loops are skipped and their final values manually computed to
+ * speed up boot time.
+ */
+
#include "base/loader/aout_object.hh"
#include "base/loader/elf_object.hh"
#include "base/loader/object_file.hh"
@@ -36,6 +44,7 @@
#include "cpu/base_cpu.hh"
#include "kern/linux/linux_events.hh"
#include "kern/linux/linux_system.hh"
+#include "kern/system_events.hh"
#include "mem/functional_mem/memory_control.hh"
#include "mem/functional_mem/physical_memory.hh"
#include "sim/builder.hh"
@@ -51,40 +60,26 @@ LinuxSystem::LinuxSystem(const string _name, const uint64_t _init_param,
MemoryController *_memCtrl, PhysicalMemory *_physmem,
const string &kernel_path, const string &console_path,
const string &palcode, const string &boot_osflags,
- const string &bootloader_path, const bool _bin,
- const vector<string> &_binned_fns)
+ const bool _bin, const vector<string> &_binned_fns)
: System(_name, _init_param, _memCtrl, _physmem, _bin, _binned_fns),
bin(_bin), binned_fns(_binned_fns)
{
kernelSymtab = new SymbolTable;
consoleSymtab = new SymbolTable;
- bootloaderSymtab = new SymbolTable;
+ /**
+ * Load the kernel, pal, and console code into memory
+ */
+ // Load kernel code
ObjectFile *kernel = createObjectFile(kernel_path);
if (kernel == NULL)
fatal("Could not load kernel file %s", kernel_path);
+ // Load Console Code
ObjectFile *console = createObjectFile(console_path);
if (console == NULL)
fatal("Could not load console file %s", console_path);
- ObjectFile *bootloader = createObjectFile(bootloader_path);
- if (bootloader == NULL)
- fatal("Could not load bootloader file %s", bootloader_path);
-
- if (!kernel->loadGlobalSymbols(kernelSymtab))
- panic("could not load kernel symbols\n");
- debugSymbolTable = kernelSymtab;
-
- if (!kernel->loadLocalSymbols(kernelSymtab))
- panic("could not load kernel local symbols\n");
-
- if (!console->loadGlobalSymbols(consoleSymtab))
- panic("could not load console symbols\n");
-
- if (!bootloader->loadGlobalSymbols(bootloaderSymtab))
- panic("could not load bootloader symbols\n");
-
// Load pal file
ObjectFile *pal = createObjectFile(palcode);
if (pal == NULL)
@@ -98,10 +93,18 @@ LinuxSystem::LinuxSystem(const string _name, const uint64_t _init_param,
kernel->loadSections(physmem, true);
kernelStart = kernel->textBase();
kernelEnd = kernel->bssBase() + kernel->bssSize();
- /* FIXME: entrypoint not in kernel, but in bootloader,
- variable should be re-named appropriately */
kernelEntry = kernel->entryPoint();
+ // load symbols
+ if (!kernel->loadGlobalSymbols(kernelSymtab))
+ panic("could not load kernel symbols\n");
+ debugSymbolTable = kernelSymtab;
+
+ if (!kernel->loadLocalSymbols(kernelSymtab))
+ panic("could not load kernel local symbols\n");
+
+ if (!console->loadGlobalSymbols(consoleSymtab))
+ panic("could not load console symbols\n");
DPRINTF(Loader, "Kernel start = %#x\n"
"Kernel end = %#x\n"
@@ -110,27 +113,28 @@ LinuxSystem::LinuxSystem(const string _name, const uint64_t _init_param,
DPRINTF(Loader, "Kernel loaded...\n");
- // Load bootloader file
- bootloader->loadSections(physmem, true);
- kernelEntry = bootloader->entryPoint();
- kernelStart = bootloader->textBase();
- DPRINTF(Loader, "Bootloader entry at %#x\n", kernelEntry);
#ifdef DEBUG
kernelPanicEvent = new BreakPCEvent(&pcEventQueue, "kernel panic");
consolePanicEvent = new BreakPCEvent(&pcEventQueue, "console panic");
#endif
- skipIdeDelay50msEvent = new LinuxSkipIdeDelay50msEvent(&pcEventQueue,
- "ide_delay_50ms");
+ skipIdeDelay50msEvent = new SkipFuncEvent(&pcEventQueue,
+ "ide_delay_50ms");
skipDelayLoopEvent = new LinuxSkipDelayLoopEvent(&pcEventQueue,
"calibrate_delay");
- skipCacheProbeEvent = new LinuxSkipFuncEvent(&pcEventQueue, "determine_cpu_caches");
+ skipCacheProbeEvent = new SkipFuncEvent(&pcEventQueue,
+ "determine_cpu_caches");
Addr addr = 0;
+ /**
+ * find the address of the est_cycle_freq variable and insert it so we don't
+ * through the lengthly process of trying to calculated it by using the PIT,
+ * RTC, etc.
+ */
if (kernelSymtab->findAddress("est_cycle_freq", addr)) {
Addr paddr = vtophys(physmem, addr);
uint8_t *est_cycle_frequency =
@@ -140,31 +144,43 @@ LinuxSystem::LinuxSystem(const string _name, const uint64_t _init_param,
*(uint64_t *)est_cycle_frequency = ticksPerSecond;
}
- if (kernelSymtab->findAddress("aic7xxx_no_reset", addr)) {
- Addr paddr = vtophys(physmem, addr);
- uint8_t *aic7xxx_no_reset =
- physmem->dma_addr(paddr, sizeof(uint32_t));
-
- if (aic7xxx_no_reset) {
- *(uint32_t *)aic7xxx_no_reset = 1;
- }
- }
+ /**
+ * Copy the osflags (kernel arguments) into the consoles memory. Presently
+ * Linux does use the console service routine to get these command line
+ * arguments, but we might as well make them available just in case.
+ */
if (consoleSymtab->findAddress("env_booted_osflags", addr)) {
Addr paddr = vtophys(physmem, addr);
char *osflags = (char *)physmem->dma_addr(paddr, sizeof(uint32_t));
if (osflags)
- strcpy(osflags, boot_osflags.c_str());
+ strcpy(osflags, boot_osflags.c_str());
}
+ /**
+ * 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, boot_osflags.c_str());
+ }
+
+
+ /**
+ * Set the hardware reset parameter block system type and revision information
+ * to Tsunami.
+ */
if (consoleSymtab->findAddress("xxm_rpb", addr)) {
Addr paddr = vtophys(physmem, addr);
char *hwprb = (char *)physmem->dma_addr(paddr, sizeof(uint64_t));
if (hwprb) {
*(uint64_t*)(hwprb+0x50) = 34; // Tsunami
- *(uint64_t*)(hwprb+0x58) = (1<<10);
+ *(uint64_t*)(hwprb+0x58) = (1<<10); // Plain DP264
}
else
panic("could not translate hwprb addr to set system type/variation\n");
@@ -182,14 +198,20 @@ LinuxSystem::LinuxSystem(const string _name, const uint64_t _init_param,
consolePanicEvent->schedule(addr);
#endif
+ /**
+ * Any time ide_delay_50ms, calibarte_delay or determine_cpu_caches is called
+ * just skip the function. Currently determine_cpu_caches only is used put
+ * information in proc, however if that changes in the future we will have to
+ * fill in the cache size variables appropriately.
+ */
if (kernelSymtab->findAddress("ide_delay_50ms", addr))
- skipIdeDelay50msEvent->schedule(addr+8);
+ skipIdeDelay50msEvent->schedule(addr+sizeof(MachInst));
if (kernelSymtab->findAddress("calibrate_delay", addr))
- skipDelayLoopEvent->schedule(addr+8);
+ skipDelayLoopEvent->schedule(addr+sizeof(MachInst));
if (kernelSymtab->findAddress("determine_cpu_caches", addr))
- skipCacheProbeEvent->schedule(addr+8);
+ skipCacheProbeEvent->schedule(addr+sizeof(MachInst));
}
LinuxSystem::~LinuxSystem()
@@ -199,7 +221,6 @@ LinuxSystem::~LinuxSystem()
delete kernelSymtab;
delete consoleSymtab;
- delete bootloaderSymtab;
delete kernelPanicEvent;
delete consolePanicEvent;
@@ -208,6 +229,7 @@ LinuxSystem::~LinuxSystem()
delete skipCacheProbeEvent;
}
+
void
LinuxSystem::setDelayLoop(ExecContext *xc)
{
@@ -239,7 +261,11 @@ LinuxSystem::registerExecContext(ExecContext *xc)
RemoteGDB *rgdb = new RemoteGDB(this, xc);
GDBListener *gdbl = new GDBListener(rgdb, 7000 + xcIndex);
gdbl->listen();
-// gdbl->accept();
+ /**
+ * Uncommenting this line waits for a remote debugger to connect
+ * to the simulator before continuing.
+ */
+ //gdbl->accept();
if (remoteGDB.size() <= xcIndex) {
remoteGDB.resize(xcIndex+1);
@@ -275,7 +301,6 @@ BEGIN_DECLARE_SIM_OBJECT_PARAMS(LinuxSystem)
Param<string> console_code;
Param<string> pal_code;
Param<string> boot_osflags;
- Param<string> bootloader_code;
VectorParam<string> binned_fns;
END_DECLARE_SIM_OBJECT_PARAMS(LinuxSystem)
@@ -292,7 +317,6 @@ BEGIN_INIT_SIM_OBJECT_PARAMS(LinuxSystem)
INIT_PARAM(pal_code, "file that contains palcode"),
INIT_PARAM_DFLT(boot_osflags, "flags to pass to the kernel during boot",
"a"),
- INIT_PARAM(bootloader_code, "file that contains the bootloader"),
INIT_PARAM(binned_fns, "functions to be broken down and binned")
@@ -302,8 +326,7 @@ CREATE_SIM_OBJECT(LinuxSystem)
{
LinuxSystem *sys = new LinuxSystem(getInstanceName(), init_param, mem_ctl,
physmem, kernel_code, console_code,
- pal_code, boot_osflags, bootloader_code,
- bin, binned_fns);
+ pal_code, boot_osflags, bin, binned_fns);
return sys;
}
diff --git a/kern/linux/linux_system.hh b/kern/linux/linux_system.hh
index 3b65e7379..4f5a74259 100644
--- a/kern/linux/linux_system.hh
+++ b/kern/linux/linux_system.hh
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003 The Regents of The University of Michigan
+ * Copyright (c) 2004 The Regents of The University of Michigan
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -32,47 +32,75 @@
#include <vector>
#include "sim/system.hh"
+#include "sim/host.hh"
#include "targetarch/isa_traits.hh"
#include <map>
+/**
+ * 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 ElfObject;
class SymbolTable;
class BreakPCEvent;
-class LinuxBadAddrEvent;
-class LinuxSkipFuncEvent;
class LinuxSkipDelayLoopEvent;
-class LinuxSkipIdeDelay50msEvent;
-class LinuxPrintfEvent;
-class LinuxDebugPrintfEvent;
-class LinuxDumpMbufEvent;
+class SkipFuncEvent;
class FnEvent;
class AlphaArguments;
+/**
+ * This class contains linux specific system code (Loading, Events, Binning).
+ * It points to objects that are the system binaries to load and patches them
+ * appropriately to work in simulator.
+ */
class LinuxSystem : public System
{
private:
+ /** Object pointer for the kernel code */
ElfObject *kernel;
+
+ /** Object pointer for the console code */
ElfObject *console;
- ElfObject *bootloader;
+ /** kernel Symbol table */
SymbolTable *kernelSymtab;
- SymbolTable *bootloaderSymtab;
+
+ /** console symbol table */
SymbolTable *consoleSymtab;
+ /** Event to halt the simulator if the kernel calls panic() */
BreakPCEvent *kernelPanicEvent;
+
+ /** Event to halt the simulator if the console calls panic() */
BreakPCEvent *consolePanicEvent;
- LinuxSkipFuncEvent *skipCacheProbeEvent;
- LinuxSkipIdeDelay50msEvent *skipIdeDelay50msEvent;
- LinuxSkipDelayLoopEvent *skipDelayLoopEvent;
- private:
+ /** Event to skip determine_cpu_caches() because we don't support the
+ * IPRs that the code can access to figure out cache sizes
+ */
+ SkipFuncEvent *skipCacheProbeEvent;
+ /** PC based event to skip the ide_delay_50ms() call */
+ SkipFuncEvent *skipIdeDelay50msEvent;
+
+ /** Skip calculate_delay_loop() rather than waiting for this to be
+ * calculated
+ */
+ LinuxSkipDelayLoopEvent *skipDelayLoopEvent;
+
+ /** Begining of kernel code */
Addr kernelStart;
+
+ /** End of kernel code */
Addr kernelEnd;
+
+ /** Entry point in the kernel to start at */
Addr kernelEntry;
+
bool bin;
std::vector<string> binned_fns;
@@ -80,7 +108,6 @@ class LinuxSystem : public System
std::vector<RemoteGDB *> remoteGDB;
std::vector<GDBListener *> gdbListen;
- public:
LinuxSystem(const std::string _name,
const uint64_t _init_param,
MemoryController *_memCtrl,
@@ -89,7 +116,6 @@ class LinuxSystem : public System
const std::string &console_path,
const std::string &palcode,
const std::string &boot_osflags,
- const std::string &bootloader_path,
const bool _bin,
const std::vector<std::string> &_binned_fns);
@@ -100,9 +126,25 @@ class LinuxSystem : public System
int registerExecContext(ExecContext *xc);
void replaceExecContext(ExecContext *xc, int xcIndex);
+ /**
+ * Returns the addess the kernel starts at.
+ * @return address the kernel starts at
+ */
Addr getKernelStart() const { return kernelStart; }
+
+ /**
+ * Returns the addess the kernel ends at.
+ * @return address the kernel ends at
+ */
Addr getKernelEnd() const { return kernelEnd; }
+
+ /**
+ * Returns the addess the entry point to the kernel code.
+ * @return entry point of the kernel code
+ */
Addr getKernelEntry() const { return kernelEntry; }
+
+
bool breakpoint();
};