linux-assembly.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: ram <ram@curvesoft.com>
To: "Alexander Jänicke" <DieJaenickes@t-online.de>
Cc: linux-assembly@vger.kernel.org
Subject: Re: GRUB sample kernel question
Date: Sat, 01 Nov 2003 14:36:01 -0800	[thread overview]
Message-ID: <3FA43551.1020806@curvesoft.com> (raw)
In-Reply-To: <200311012224.25240.DieJaenickes@t-online.de>

Alexander Jänicke wrote:

>Am Samstag, 1. November 2003 18:07 schrieb ram:
>  
>
>>Hi,
>>
>>I was looking at the toy kernel in the grub distribution (multiboot.h,
>>kernel.c, boot.S
>>in the 'docs' subdirectory) and noticed boot.S starts out like this:
>>
>>    .globl    start, _start
>>start:
>>_start:
>>    jmp    multiboot_entry
>>    ....
>>multiboot_entry:
>>
>>I'm wondering why this jump is needed; couldn't the start/_start labels
>>simply have
>>been placed adjacent to the multiboot_entry label thereby avoiding the
>>jump ?
>>
>>Thanks.
>>
>>Ram
>>    
>>
>
>
>No, this jump is necessary for making sure that the cs register is initialised 
>correctly. Every BIOS loads the bootloader to physical address 0x07c00. 
>Normally cs=0 and ip=0x7c00, but to be on the safe side, you should make a 
>far-jump. That's why code in most bootloaders begins with a 
>jmp 0x0000:StartAddr or jmp 0x07c0:StartAddr, dependent on whether the 
>location counter started at 0x0000 or 0x07c0.
>If you are interested in os development, have a look at 
>http://www.nondot.org/sabre/os/articles
>
>Alex
>-
>To unsubscribe from this list: send the line "unsubscribe linux-assembly" in
>the body of a message to majordomo@vger.kernel.org
>More majordomo info at  http://vger.kernel.org/majordomo-info.html
>  
>
Thanks for the response but I'm still a little confused: my impression 
is that this
code is not a bootloader but a sample 32-bit OS loaded by GRUB, so GRUB has
already switched to protected mode when this code starts to execute ?

Ram

-
To unsubscribe from this list: send the line "unsubscribe linux-assembly" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2003-11-01 22:36 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-10-23 12:03 confused asm newbie Jason Roberts
2003-10-23 12:53 ` Frederic Marmond
2003-10-23 14:38 ` willy meier
2003-10-23 15:50 ` Philip Jacob Smith
2003-11-01 17:07   ` GRUB sample kernel question ram
2003-11-01 21:24     ` Alexander Jänicke
2003-11-01 22:36       ` ram [this message]
2003-11-17 11:47   ` confused asm newbie b klein
2003-11-17 12:29     ` Frederic Marmond
2003-11-17 13:18       ` b klein
2003-11-17 13:36         ` Frederic Marmond
2003-11-18  2:51     ` Philip Jacob Smith
2003-11-20 21:52       ` b klein

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=3FA43551.1020806@curvesoft.com \
    --to=ram@curvesoft.com \
    --cc=DieJaenickes@t-online.de \
    --cc=linux-assembly@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).