Questions understanding exec_kernel
Hello hackers:
I'm still trying to debug why I can load the kernel from exec_kernel (in arch/parisc/boot/boot_code/ipl_s.S)
I've snipped the relevent section of code and have some questions reguarding it. (Pleae remember I'm, this is my first attempt with PA-RISC, and I've been learning by reading the PA-RISC 1.1 Architecture and Instruction Set Reference Manual, HP Assembler Reference Manual, various comments throughout the code, and trial and error.)
/*
* exec_kernel(entry_point, &commandline, Kernel_FreeMemStart,half_bss_size );
* exec_kernel() calls our kernel...
*/
.EXPORT exec_kernel,code
.PROC
.CALLINFO
.ENTRYexec_kernel
mtsm %r0 ; Disable traps and interrupts.
mtctl %r0, %cr17 ; Clear two-level IIA Space Queue mtctl %r0, %cr17 ; effectively setting kernel space.
[Question: Page 5-149 from the PA-RISC 1.1 Architecture and Instruction
Set Reference Manual states: "Level 0: If the target control register is CR 8, 9, 12, 13, 17, or 20, this instructin executes as a null instruction." I am assuming we are running at level 0 since the rfi command required running at level 0, so what is the difference between a null instruction and a nop?]
mtctl %arg0, %cr18 ; Stuff entry point into head of IIA ldo 4(%arg0), %arg0 ; Offset Queue, and entry point + 4 mtctl %arg0, %cr18 ; into tail of IIA Offset Queue.
ldi 0x9, %arg0 ; Set PSW Q & I bits (collect intrpt mtctl %arg0, %ipsw ; state, allow external intrpts).
copy %arg2, %arg0 ; commandline to arg1
[Note: I think the comment is incorrect... we are actually copying theKernel_FreeMemStart into arg0 ... Am I missunderstanding the comment?]
; arg3 is not changed..
.EXIT
rfi ; begin execution of kernel.
nop
[Question: Page 5-139 from the PA-RISC 1.1 Architecture and Instruction
Set Reference Manual states: "Execution of an RFI instruction when any of the PSW !, I, or R bits are ones is an undefined operation." We are explicitly setting the Q & I bits before calling the rfi command. I don't understand how this works ... ]
.PROCEND
Thanks,
-Ryan
Quoted 6 lines · Ryan Bradetich
[Question: Page 5-149 from the PA-RISC 1.1 Architecture and Instruction
Set Reference Manual states: "Level 0: If the target control register is CR 8, 9, 12, 13, 17, or 20, this instructin executes as a null instruction." I am assuming we are running at level 0 since the rfi command required running at level 0, so what is the difference between a null instruction and a nop?]
That's an easy one:
Nullfied instructions are simple ignored - output discarded. Branch instructions have a "nullify" flag - the PA1.1 book probably talks more about details here.
NOP is an instruction which is executed but does nothing useful. (eg OR R0, R0, R0) Often used to get precise timing in a loop or patch out unwanted instructions for self modifing code.
Someone else will have to tackle the RFI question....
grant
[parisc-linux] C360 boot problem
Hi!
I downloaded the latest kernel(+ramdisk) from CVS and tried it on my C360. It does not print anything on screen but just blinks the leds. Here's what it looks like:
Leds: 1234
II
I I
I I
and then from the begining...
I guess it is trying to tell me something, but what?
- Goodi
"The linuX Files -- The Source is Out There." ø,¸¸,ø¤º°°º¤ø,¸¸,ø¤º°°º¤ø,¸¸,ø¤º°°º¤ø,¸¸,ø¤º°°º¤ø¤º°`°º¤ø,¸¸,ø¤º°
Re: [parisc-linux] C360 boot problem
Quoted 11 lines
I downloaded the latest kernel(+ramdisk) from CVS and tried it on my C360. It does not print anything on screen but just blinks the leds. Here's what it looks like:
Leds: 1234
II
I I
I I
and then from the begining...I guess it is trying to tell me something, but what?
Can you try to get the PIM contents and search for the symbols closest to IAOQ / CR18 in your System.map ?
Philipp Rumpf
Quoted 6 lines
Quoted 6 lines
[Question: Page 5-149 from the PA-RISC 1.1 Architecture and Instruction
Set Reference Manual states: "Level 0: If the target control register is CR 8, 9, 12, 13, 17, or 20, this instructin executes as a null instruction." I am assuming we are running at level 0 since the rfi command required running at level 0, so what is the difference between a null instruction and a nop?]
There is none. Null instructions (here) refer to instructions ignored since they don't apply to the specific hardware. Nops are usually regular forms of arithmetic / logical instructions that happen to do nothing.
Quoted 2 lines
That's an easy one:
Nullfied instructions are simple ignored - output discarded.
Except we're not talking about nullified instructions :)
Philipp Rumpf
Quoted 10 lines
.EXIT
rfi ; begin execution of kernel.
nop
[Question: Page 5-139 from the PA-RISC 1.1 Architecture and Instruction
Set Reference Manual states: "Execution of an RFI instruction when any of the PSW !, I, or R bits are ones is an undefined operation." We are explicitly setting the Q & I bits before calling the rfi command. I don't understand how this works ... ]
.PROCEND
If I remember right, RFI followed by a NOP is an idiom to tell the CPU
to start fetching instructions from an absolute address pointed to by the IVA so we usually want to that with interrupts enabled (Q & I bits set).
--Hai
Quoted 5 lines
---------------------------------------------------------------------------
To unsubscribe: send e-mail to [email protected] with `unsubscribe' as the subject.
Quoted 3 lines
If I remember right, RFI followed by a NOP is an idiom to tell the CPU
to start fetching instructions from an absolute address pointed to by the IVA so we usually want to that with interrupts enabled (Q & I bits set).
Are you sure ? It never did that on the machines I tested on so far (712, A180C and indirectly 715).
Philipp Rumpf
Quoted 13 lines
/*
* exec_kernel(entry_point, &commandline,Kernel_FreeMemStart,half_bss_size);
*exec_kernel()calls our kernel...
*/.EXPORT exec_kernel,code
.PROC
.CALLINFO
.ENTRYexec_kernel
mtsm %r0 ; Disable traps and interrupts.
Quoted 8 lines
mtctl %r0, %cr17 ; Clear two-level IIA Space Queue mtctl %r0, %cr17 ; effectively setting kernel space.[Question: Page 5-149 from the PA-RISC 1.1 Architecture and Instruction
Set Reference Manual states: "Level 0: If the target control register is CR 8, 9, 12, 13, 17, or 20, this instructin executes as a null instruction." I am assuming we are running at level 0 since the rfi command required running at level 0, so what is the difference between a null instruction and a nop?]
Level 0 refers to the hardware here. Level 0 hardware basically has no MMU, so Linux will never run on it (does HP/UX ?)
Quoted 3 lines
copy %arg2, %arg0 ; commandline to arg1[Note: I think the comment is incorrect... we are actually copying the
Kernel_FreeMemStartinto arg0 ... Am I missunderstanding the comment?]
No, looks like the comment did not get changed when the instruction did.
Quoted 9 lines
; arg3 is not changed..
.EXIT
rfi ; begin execution of kernel.
nop
[Question: Page 5-139 from the PA-RISC 1.1 Architecture and Instruction
Set Reference Manual states: "Execution of an RFI instruction when any of the PSW !, I, or R bits are ones is an undefined operation." We are explicitly setting the Q & I bits before calling the rfi command. I don't understand how this works ... ]
We did execute mtsm 0 which sets the system mask (which includes the Q, I and R bits) to 0.
Philipp Rumpf