Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6625209
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T21:44:46+00:00 2026-05-25T21:44:46+00:00

Recently I’m looking at the linux 0.01 source code, since the bootsect.S in 2.6.11

  • 0

Recently I’m looking at the linux 0.01 source code, since the bootsect.S in 2.6.11 and upper version is useless and it is a good place to start learning linux code, therefore I choose to trace the first version of linux. 😛

I have some question in bootsect.S. The following is some of the code in bootsect.S linux v 0.01.

P.S the first version assembly code is using intel syntax instead of at&t.

mov   ax,#0x0001  | protected mode (PE) bit
lmsw  ax          | This is it!
jmpi  0,8  | jmp offset 0 of segment 8 (cs) which is the second entry of the gdt.

gdt:

.word    0,0,0,0        | dummy
.word    0x07FF        | 8Mb - limit=2047 (2048*4096=8Mb)
.word    0x0000        | base address=0
.word    0x9A00        | code read/exec
.word    0x00C0        | granularity=4096, 386

.word    0x07FF        | 8Mb - limit=2047 (2048*4096=8Mb)
.word    0x0000        | base address=0
.word    0x9200        | data read/write
.word    0x00C0        | granularity=4096, 386

The booting process seems to be like the following:

  • move the bootloader code from 0x7c00 to 0x9000

  • jumps to 0x9000

  • set the segment registers.

  • load the system code to 0x10000
    (the system code contains boot/head.S and init/main.c according to the Makefile)

  • load temporary gdt and idt with lgdt and lidt

  • enable A20 to access the 16mb physical memory.

  • set cr0 PE bit to go to protected mode

  • jump to 0x000000

the following is the Makefile for system:

tools/system:   
boot/head.o init/main.o \
$(ARCHIVES) $(LIBS)
$(LD) $(LDFLAGS) boot/head.o init/main.o \
$(ARCHIVES) \
$(LIBS) \

-o tools/system > System.map

It seems like that the head.S and main.c is link together as the system binary which the bootsect loads into memory.

My question is if the system code(which entry is head.S/startup_32 ) is loaded in 0x10000 than why not jumps to 0x10000 instead jumps to 0x000000?
Isn’t it weird to jump to 0x0 since there is no code loaded inside there??

the following is the link to download the source code:
https://docs.google.com/viewer?a=v&pid=explorer&chrome=true&srcid=0B1F0m2rUn8BYMjQ4ZDQxZTUtODI5My00MGZiLTgwZDQtM2ZiZWQ2ZWQxYzIx

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T21:44:47+00:00Added an answer on May 25, 2026 at 9:44 pm

    Here’s the answer:

    | It then loads the system at 0x10000, using BIOS interrupts. Thereafter
    | it disables all interrupts, moves the system down to 0x0000, ...
    

    and here’s the code that goes with it:

            cli                     | no interrupts allowed !
    
    | first we move the system to it's rightful place
    
            mov     ax,#0x0000
            cld                     | 'direction'=0, movs moves forward
    do_move:
            mov     es,ax           | destination segment
            add     ax,#0x1000
            cmp     ax,#0x9000
            jz      end_move
            mov     ds,ax           | source segment
            sub     di,di
            sub     si,si
            mov     cx,#0x8000
            rep
            movsw
            j       do_move
    

    If you look closely at the code, you’ll notice that it indeed starts doing REP MOVSW with ES=0,DI=0 (destination) and DS=0x1000,SI=0 (source), that is, it moves stuff from 0x10000(=DS*0x10+SI) to 0(=ES*0x10+DI).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Recently we have released our product. Our team decided to preserve the source code
Recently I found some simple source code of a bootloader.The following is the simple
Recently downloaded some code for a minor open-source project related to a small webgame
Recently I install a tortoise SVN in a server, holding the source code, and
Recently a friend and I were talking about securing stored procedure code in a
Recently I've begun to code in Objective-C for iOS 5 devices. My brand new
Recently, we discovered odd behavior in some old code. This code has worked for
Recently i saw an open source javascript library have a line like : style
Recently i am learning something about unicode in python2.7, and i want to know
Recently,I read Java Network Programming,in section 5.5,part 5.5.2.6 ,it has the following code: public

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.