HNHacker News
TopNewBestAskShowJobs

emily-c

317 karma · joined November 9, 2015

I'm a systems software engineer who works on bootloaders/kernels/hypervisors/firmware and computer hardware.

https://www.linkedin.com/in/emily-c/

submissionscomments
emily-c··on x86-64 Assembly Language Programming with Ubuntu
These types of resources are awesome though I've always wished that they at least briefly touched upon the x86 memory model/consistency. Understanding the concept of memory barriers should be considered fundamental.
emily-c··on Reverse-Engineering WebAssembly [pdf]
I think that disassembling WebAssembly is easier than trying to make sense of a highly minified/obfuscated JavaScript bundle. The time of easily readable web code has been dead for quite a while now I would say.
emily-c··on Show HN: T2b – A wicked-powerful text macro language for building binary files
I use fasm for this very use case. It has a wonderful macro language that can be used to programmatically generate binary data on top of being able to emit instructions. It's really cool to see other languages for generating binary files as its an interesting niche to fill.
emily-c··on Multiple OS Vendors Release Security Patches After Misinterpreting Intel Docs
A bit tangentially related, but I've always wondered why the syscall instruction doesn't use the TSS for stack switching like int does. I guess it does give you more flexibility to load rsp from gs during a cpl 3 -> cpl 0 transition rather than consulting the TSS to switch it automatically. Can anyone weigh in on this?
emily-c··on Ask HN: What are some examples of beautiful x86 assembly code?
I've always found this 16 byte bubble sort implementation to be absolutely beautiful.

https://gist.github.com/jibsen/8afc36995aadb896b649

emily-c··on The Art of Assembly Language (1996)
If you know how to construct data structures in C, it's pretty straightforward to construct them in assembly language. In asm you tend to lose the benefit of arrays being a type. In x86 you have powerful addressing modes (the different ways you can calculate a memory address) which are normally encoded with modrm and sib bytes after the opcode. An example where eax, rbx, and rcx are registers:

  ; eax = rbx[rcx] where rbx points to the base of an array of dwords
  mov eax, [rcx*4 + rbx]
  ; => 8B 04 8B
  ; where the first 8B is the opcode for this version of mov, 04 is the modrm byte saying
  ; to mov the value into eax as well as that there will be a sib (scale/index/base)
  ; byte following specifying the data source, and then 8B specifying everything in the []'s.
  ; If we were moving into ecx, the modrm byte would be 0C because a the 3-bit 
  ; register specification portion of modrm would change to specify ecx.
If you are optimizing for size (which can be a fun exercise) there are other ways of iterating through "arrays" of bytes such as the various string instructions [1] (though these tend to be slower on modern processors because they are microcoded). This gets into designing your code to use registers which are used implicitly by small instructions reducing the need for modrm/sib bytes in the instruction bytes [2].

Another example might be:

  lodsd      ; eax = *rsi++  : "AD" (one byte opcode using implicit src/dst operands)
  shl eax, 2 ; eax *= 4      : "C1 E0 02" where C1 specifying shl instruction
             ;                 E0 specifying eax and immediate constant 
             ;                 02 the constant to shift eax by (this is a mul by 4)
  stosd      ; *rdi++ = eax  : "AB" store into destination (one byte opcode)
It's not hard to imagine that being in a loop to iterate over the contents of an array. Hash tables are just the way they are in C really.

[1] http://www.felixcloutier.com/x86/LODS:LODSB:LODSW:LODSD:LODS... (there are others)

[2] https://www.swansontec.com/sregisters.html

emily-c··on The Art of Assembly Language (1996)
Assembly language is really fun to write! I think that it's really important to know the basics of modern computer architecture and their ISAs. All abstractions are leaky and I don't think that you can be a truly proficient systems programmer if you don't know the basics of the hardware your code runs on.

Lately I have been writing a lot of code in x64 asm for fun. I've found that it's impressive how much functionality you can fit in such a small amount of space. Randall Hyde's book got me started but I think that a much better introduction would be Paul Carter's PC Assembly Language https://pacman128.github.io/pcasm/

emily-c··on Ask HN: What stack should I use to build my basic web app as of 3/29/18
There really aren't any wrong answers here but I've had good personal experience with Vue, Go, and Postgres. Make sure you use vue-cli. vuefire is also very convenient if you're so inclined.
emily-c··on Geany – Lightweight IDE for Linux and Windows
This is the IDE that I learned how to program with. So many fond memories. I like how the site is still up!
emily-c··on The evolution of the trackball
My wired Elecom M-DT2URBK is the best mouse I've ever used. It's great if you have small hands.
emily-c··on SymbOS: Graphical Z80 Multitasking Operating System
In this particular case it feels like a throwback to 80s-style tech marketing. I think the low resolution bitmap images look cool and associate beauty with the OS in a way. I understand your point but I say keep them!
emily-c··on RAM-less Buffers
Innovation? That's quite a stretch. Using them together as a contiguous buffer is the not the reason they exist. Not quite sure how you took the article like you did but I have added some extra clarification that this is /not/ how they were designed to be used as well as another example.
emily-c··on RAM-less Buffers
This is true and is precisely why it doesn't work without modification on higher optimization levels. I was originally going to write this article entirely in assembly but it seems like nobody wants to read an assembly dump! Instead even though it is malpractice to do so, the way the code is written in the article is still very clear even to people who don't really know assembly that well (I hope) and the concept is more clear. I will make that more clear in the article.
emily-c··on RAM-less Buffers
I think it's useful in that it gives you a weird trick to think about :)
emily-c··on Top 50 Women in Internet Security
Always happy to see Joanna Rutkowska mentioned. She has been a huge inspiration for me.
emily-c··on Does a compiler use all x86 instructions? (2010)
lea's addressing mode arithmetic also doesn't wipe out any flags so it can be extremely useful for throwing in between arithmetic operations whose resulting flags you care about and the compare operation itself so as to obtain a greater degree of instruction level parallelism.
emily-c··on Mint UI – Mobile UI Elements for Vue.js
Keen UI is a nice library.

https://josephuspaye.github.io/Keen-UI/

emily-c··on Assembly Is Too High Level: SIB Doubles
lea also doesn't set any flags which can be pretty useful when interleaving arithmetic operations with other things.
emily-c··on Flat assembler: x86 assembler that does multiple passes to optimize machine code
fasm has pretty powerful macros that could do something like this though at that point why are you using an assembler directly?
emily-c··on The New Intolerance of Student Activism
It's interesting that the particular way these sorts of people are loud is enabled by the proliferation of social media. A side effect of society being more connected.
emily-c··on PyPy.js – PyPy in Your Browser
Even if it's not extremely useful it's an interesting project. People tend to like doing interesting things for fun.
← PreviousPage 2 of 2