Re: [PATCH] Remove the extra jmp

From: Brian Gerst
Date: Mon Feb 23 2004 - 22:33:07 EST


Coywolf Qi Hunt wrote:
Jamie Lokier wrote:


Your patch uses two instructions to flush the queue (push+ret) instead
of one (jmp or ljmp). Is that documented as reliable? I can easily
imagine an implementation which decodes one instruction after a mode
change predictably, but not two.

I doubt that it makes a difference - we're setting PG, not changing
the instruction format - but I'd like us to be sure it cannot fail on
things like 386s and 486s, and similar non-Intel chips.


push+ret is encouraged/borrowed/stolen from FreeBSD ;) it should be reliable. And also, old linux uses ret. Since old linux runs on 386, it is quite reliable. If you still doubt, we can push before PG.



Hello Anvin,

Please either take the push+ret patch or take the one near jmp patch enclosed in this email. thanks

Coywolf



------------------------------------------------------------------------

--- head.S.orig 2004-02-18 11:57:16.000000000 +0800
+++ head.S 2004-02-24 11:08:34.000000000 +0800
@@ -117,9 +117,6 @@
movl %eax,%cr0 /* ..and set paging (PG) bit */
jmp 1f /* flush the prefetch-queue */
1:
- movl $1f,%eax
- jmp *%eax /* make sure eip is relocated */
-1:
/* Set up the stack pointer */
lss stack_start,%esp

This won't work, because the indirect jump is what adds PAGE_OFFSET to %eip (remember, call/jump use relative addressing). Either keep just the indirect jump, or use "jmp __PAGE_OFFSET+1f".

--
Brian Gerst
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/