Articles tagged #rust
Everything but ELF
And we’re back!
In the last article, we thanked our old code and bade it adieu, for it did not spark joy. And then we made a new, solid foundation, on which we planned to actually make an executable packer.
As part of this endeavor, we’ve made a crate called encore, which only
depends on libcore, and provides some of the things libstd would give us,
but which we cannot have, because we do not want to rely on a libc.
Between libcore and libstd
You’re still here! Fantastic.
I have good news, and bad news. The good news is, we’re actually going to make an executable packer now!
Hurray!
I know right? No lie, we’re actually really going to start working on the final product from this point onwards.
What uhhh what about the previous fourteen parts?
Ah, yes, the previous fourteen parts. Well, we had fun, didn’t we? And we learned a lot about ELF, how it’s basically a database format that different tools look at in different ways, how it’s mapped in memory (more or less), what we really need to set up before starting up another executable, all that good stuff.
In the bowels of glibc
Good morning, and welcome back to “how many executables can we run with our custom dynamic loader before things get really out of control”.
In Part 13, we “implemented” thread-local storage. I’m using scare quotes because, well, we spent most of the article blabbering about Addressing Memory Through The Ages, And Other Fun Tidbits.
But that was then, and this is now, which is, uh, nine months later. Not only am I wiser and more productive, I’m also finally done updating all the previous thirteen parts of this series to fix some inconsistencies, upgrade crate versions, and redo all the diagrams as SVG.
Day 14 (Advent of Code 2020)
It’s time for the Day 14 problem!
After the hassle that was Day 13, I hope this time we’ll have a relatively chill time. And, at least for Part 1, that is true.
Our input looks something like this:
mask = XXXXXXXXXXXXXXXXXXXXXXXXXXXXX1XXXX0X
mem[8] = 11
mem[7] = 101
mem[8] = 0
mem is our memory. Our addresses are 36-bit wide, but as you’ll see, that
doesn’t matter much.
Day 13 (Advent of Code 2020)
In the Day 13 problem, we’re trying to take the bus.
Our input looks like this:
939
7,13,x,x,59,x,31,19
The first line indicates the earliest minute we can leave from the bus terminal, and the second line indicates the “identifier” of the buses that are active.
Each bus departs every “bus ID” minutes - bus 7 leaves at minute 0, minute 7, minute 14, minute 21, etc. The question is: which bus can we take first (apparently they either all go to the same destination, or we don’t really care where we’re going), and how long do we have to wait for it?
Day 12 (Advent of Code 2020)
Time for the Day 12 problem!
In this problem, we have a ship. And we have navigation instructions:
- Action
Nmeans to movenorthby the given value. - Action
Smeans to movesouthby the given value. - Action
Emeans to moveeastby the given value. - Action
Wmeans to movewestby the given value. - Action
Lmeans to turnleftthe given number of degrees. - Action
Rmeans to turnrightthe given number of degrees.
Day 11 (Advent of Code 2020)
Another day, another problem.
This time the problem looks suspiciously like Conway’s Game of Life, or, I guess, any old Cellular automaton.
We have a map like so:
L.LL.LL.LL
LLLLLLL.LL
L.L.L..L..
LLLL.LL.LL
L.LL.LL.LL
L.LLLLL.LL
..L.L.....
LLLLLLLLLL
L.LLLLLL.L
L.LLLLL.LL
And for each iteration:
Lsymbols turn into#if there’s no#in any of the 8 adjacent cells
Go back to the homepage.