diff options
author | Robert Morris <[email protected]> | 2020-10-05 15:28:01 -0400 |
---|---|---|
committer | Robert Morris <[email protected]> | 2020-10-05 15:28:01 -0400 |
commit | 6c167595037a0872338d999c7ce0971a5606dedb (patch) | |
tree | e609ecbda6a195fae34e9150ac59f592947c408b /kernel/start.c | |
parent | 0c55849d28a2df0416d28c83bc9da47411e2c78f (diff) | |
download | xv6-labs-6c167595037a0872338d999c7ce0971a5606dedb.tar.gz xv6-labs-6c167595037a0872338d999c7ce0971a5606dedb.tar.bz2 xv6-labs-6c167595037a0872338d999c7ce0971a5606dedb.zip |
more explicable scratch area size for machine-mode timer interrupts
Diffstat (limited to 'kernel/start.c')
-rw-r--r-- | kernel/start.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/kernel/start.c b/kernel/start.c index 4eb6c2d..1876680 100644 --- a/kernel/start.c +++ b/kernel/start.c @@ -10,8 +10,8 @@ void timerinit(); // entry.S needs one stack per CPU. __attribute__ ((aligned (16))) char stack0[4096 * NCPU]; -// scratch area for timer interrupt, one per CPU. -uint64 mscratch0[NCPU * 32]; +// a scratch area per CPU for machine-mode timer interrupts. +uint64 timer_scratch[NCPU][5]; // assembly code in kernelvec.S for machine-mode timer interrupt. extern void timervec(); @@ -64,12 +64,12 @@ timerinit() *(uint64*)CLINT_MTIMECMP(id) = *(uint64*)CLINT_MTIME + interval; // prepare information in scratch[] for timervec. - // scratch[0..3] : space for timervec to save registers. - // scratch[4] : address of CLINT MTIMECMP register. - // scratch[5] : desired interval (in cycles) between timer interrupts. - uint64 *scratch = &mscratch0[32 * id]; - scratch[4] = CLINT_MTIMECMP(id); - scratch[5] = interval; + // scratch[0..2] : space for timervec to save registers. + // scratch[3] : address of CLINT MTIMECMP register. + // scratch[4] : desired interval (in cycles) between timer interrupts. + uint64 *scratch = &timer_scratch[id][0]; + scratch[3] = CLINT_MTIMECMP(id); + scratch[4] = interval; w_mscratch((uint64)scratch); // set the machine-mode trap handler. |