From: "Steve Scott" <steve.scott@pioneer-pdt.com>
To: <linux-mips@linux-mips.org>
Cc: <steve.scott@pioneer-pdt.com>
Subject: bug in kernel_entry?
Date: Thu, 9 Oct 2003 15:11:36 -0700 [thread overview]
Message-ID: <021e01c38eb2$4e95f840$2256fea9@janelle> (raw)
In-Reply-To: 20031009140319.GA17647@linux-mips.org
I ran across what looks like a bug in the 'kernel_entry' function in
linux/arch/mips/kernel/head.S while chasing another problem. Our
version of kernel_entry is for 2.4.17. 2.4.22 seems to have
the same problem.
kernel_entry initializes the kernel stack pointer 'kernelsp'. But then
immediately after this clears the bss, which has the side effect of setting
kernelsp to 0. In our system, on initial entry to cpu_idle(), kernelsp is 0.
The bug "heals" itself the first time schedule() is called. But, if for some
reason CP0_STATUS doesn't have CU0 set at startup (which would be
bad for other reasons), and you get an exception before the first call to
schedule() (e.g., the syscall to create "init"), the exception handler will
try to save registers starting from kernelsp, which is 0.
from head.S:
NESTED(kernel_entry, 16, sp)
.
.
.
/*
* Stack for kernel and init, current variable
*/
la $28, init_task_union
addiu t0, $28, KERNEL_STACK_SIZE-32
subu sp, t0, 4*SZREG
sw t0, kernelsp /* <-- this is going to get overwritten below when bss
is cleared... [srs] */
/* The firmware/bootloader passes argc/argp/envp
* to us as arguments. But clear bss first because
* the romvec and other important info is stored there
* by prom_init().
*/
la t0, _edata /* <-- here is the code that eventually clears
kernelsp [srs] */
sw zero, (t0)
la t1, (_end - 4)
1:
addiu t0, 4
bne t0, t1, 1b
sw zero, (t0)
jal init_arch
nop
END(kernel_entry)
--steve
WARNING: multiple messages have this Message-ID (diff)
From: "Steve Scott" <steve.scott@pioneer-pdt.com>
To: linux-mips@linux-mips.org
Cc: steve.scott@pioneer-pdt.com
Subject: bug in kernel_entry?
Date: Thu, 9 Oct 2003 15:11:36 -0700 [thread overview]
Message-ID: <021e01c38eb2$4e95f840$2256fea9@janelle> (raw)
Message-ID: <20031009221136.-IXbyH9zfS2Sx9XOWAPFY2X2jnGKVkQdp2kKxrNCpfQ@z> (raw)
In-Reply-To: 20031009140319.GA17647@linux-mips.org
I ran across what looks like a bug in the 'kernel_entry' function in
linux/arch/mips/kernel/head.S while chasing another problem. Our
version of kernel_entry is for 2.4.17. 2.4.22 seems to have
the same problem.
kernel_entry initializes the kernel stack pointer 'kernelsp'. But then
immediately after this clears the bss, which has the side effect of setting
kernelsp to 0. In our system, on initial entry to cpu_idle(), kernelsp is 0.
The bug "heals" itself the first time schedule() is called. But, if for some
reason CP0_STATUS doesn't have CU0 set at startup (which would be
bad for other reasons), and you get an exception before the first call to
schedule() (e.g., the syscall to create "init"), the exception handler will
try to save registers starting from kernelsp, which is 0.
from head.S:
NESTED(kernel_entry, 16, sp)
.
.
.
/*
* Stack for kernel and init, current variable
*/
la $28, init_task_union
addiu t0, $28, KERNEL_STACK_SIZE-32
subu sp, t0, 4*SZREG
sw t0, kernelsp /* <-- this is going to get overwritten below when bss
is cleared... [srs] */
/* The firmware/bootloader passes argc/argp/envp
* to us as arguments. But clear bss first because
* the romvec and other important info is stored there
* by prom_init().
*/
la t0, _edata /* <-- here is the code that eventually clears
kernelsp [srs] */
sw zero, (t0)
la t1, (_end - 4)
1:
addiu t0, 4
bne t0, t1, 1b
sw zero, (t0)
jal init_arch
nop
END(kernel_entry)
--steve
next prev parent reply other threads:[~2003-10-09 22:09 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-10-08 22:00 mips 32 bit HIGHMEM support exister99
2003-10-08 22:00 ` exister99
2003-10-09 14:03 ` Ralf Baechle
2003-10-09 22:11 ` Steve Scott [this message]
2003-10-09 22:11 ` bug in kernel_entry? Steve Scott
2003-10-10 13:23 ` Ralf Baechle
2003-10-10 14:59 ` mips 32 bit HIGHMEM support Ralf Baechle
2003-10-13 23:15 ` 64 bit kernel in the name of HIGHMEM exister99
2003-10-13 23:15 ` exister99
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='021e01c38eb2$4e95f840$2256fea9@janelle' \
--to=steve.scott@pioneer-pdt.com \
--cc=linux-mips@linux-mips.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox