Git Product home page Git Product logo

Comments (5)

steveklabnik avatar steveklabnik commented on July 17, 2024

I'm treating this as as assumed knowledge bug, but to answer right now:

(and why is this in decimal and not hex, even though 0 is 0 regardless of number system)?

Just a mistake, cc #86

but size of what exactly? Is the amount of memory the magic number and protected mode code take up? is it the size of the total instructions in the file? I feel like this is a core idea of assembly I'm missing here.

It's the size of this whole structure. See more below....

But what are header_end and header_start

When we define the two labels in this file, they can be used like addresses. So header_start, being at the beginning, is going to be the address at the beginning, and header_end, being a label at the end, is going to be the end.

And what is in between these two addresses, just 0xe85250d6 and 0, or something else?

We have four dd statements, which _d_efine _d_oubles, which means 32-bit values. So 4 * 32 = 128 bits is going to be the difference.

from book.

roneesh avatar roneesh commented on July 17, 2024

Ok, I understand now. What really cleared it up was getting a hexeditor via brew install hexedit

And then compiling the file just with

nasm multiboot_header.asm -o multiboot_header.o

From there I was able to see that the value of dd header_end - header_start is just 0x00000010 which is 16 in decimal. Which means that the value of header_end - header_start is just 16 bytes.

I think that the text would be improved by spelling that out a bit (maybe as a comment in the code), but I can also see how it might be too much extra information for some maybe.

from book.

steveklabnik avatar steveklabnik commented on July 17, 2024

I'm also not sure if this just isn't too complicated for something that's never getting changed; the reason that you do it this way is so that things automatically update when you change the definition, but we're not planning on doing so.

from book.

courajs avatar courajs commented on July 17, 2024

This is also confusing for me. I also asked myself

is header_start going to be 0x00000000?

The labels are addresses - but addresses in what? Byte offsets in the ELF/.o file? The linked kernel.bin? Or is it dynamically resolved at runtime?

from book.

steveklabnik avatar steveklabnik commented on July 17, 2024

I'm not working on the first edition anymore, so I'm going to give this a close. This stuff isn't in the second edition yet, and it's not likely to make it exactly. If someone wants to send in a PR to fix up the first edition, please feel free!

from book.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.