Skip to content
This repository has been archived by the owner on Apr 6, 2020. It is now read-only.

Set up rust #119

Merged
merged 7 commits into from Jun 13, 2016
Merged

Set up rust #119

merged 7 commits into from Jun 13, 2016

Conversation

steveklabnik
Copy link
Member

Here's the next chapter! We finally have Rust code!

```

This is our main function, which is traditionally called `kmain()`, for 'kernel
main.' We need to use the `#[no_mangle] and `pub extern` annotations to indicate
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing backtick after #[no_mangle].

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!

This is our main function, which is traditionally called `kmain()`, for 'kernel
main.' We need to use the `#[no_mangle]` and `pub extern` annotations to indicate
that we're going to call this function like we would call a C function. The `-> !`
indicates that this function never returns. And in fact, it does not: the body
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Incorrect not in it does not.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm, I think this is one of things things in which English is ambiguous.

And in fact, it does not return

is how I read this, but you're reading it as negating the "never returns."

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, could you change it to it does not return?

In this case, the reason we need `unsafe` is the next two lines: we create a
pointer to `0xb8000`, and then write some numbers to it. Rust cannot know that
this is safe; if it did, it would have to understand that we are a kernel,
and understand the VGA specification. Having a programming langauge understand
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/langauge/language/

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i am the worst. thanks for finding these 😄

@steveklabnik
Copy link
Member Author

Thanks everyone, I've addressed the nits. Also, I wrote an aside pointing to an example of a more DRY makefile.

as discovered in intermezzOS/kernel#45, the
focus on the .a wouldn't actually cause things to be rebuilt. This will.
@steveklabnik
Copy link
Member Author

I am too excited to get this merged, and so I'm going to go ahead and do it. If you didn't get the chance to check this chapter out yet, please open issues with anything you want to comment on! Still very happy to get feedback.

@steveklabnik steveklabnik merged commit e07fbca into master Jun 13, 2016
@steveklabnik steveklabnik deleted the set-up-rust branch June 13, 2016 22:10
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants