Hacker Newsnew | past | comments | ask | show | jobs | submit | lin0tune's commentslogin


Clickable links, I should have posted the link instead:

GitHub: https://github.com/linktohack/helm-stack

Blog post: https://linktohack.com/posts/evaluate-options-to-migrate-fro...


http://www.emulator101.com/logical-operations.html

   /* Example 2: turn on one LED on the control panel */    
   char * LED_pointer = (char *) 0x2089;    
   char led = *LED_pointer;    
   led = led | 0x40; //set LED controlled by bit 6    
   *LED_pointer = led;
Really?


Yes really. It's example code written for the sole purpose of being read by people for educational purposes. As long as you understand the basics of pointers, it's really easy to read. Why are you mad at it?


What's wrong with that? If you're writing code for pedagogical purposes, it doesn't necessarily need to be as concise as possible.


I know some people who object to one-line read-modify-write of hardware registers, the idea being that glancing at the code the non-atomicity of the operation might be lost. I also generally don't use raw volatile pointers directly when dealing with hardware registers, too easy to forget a "volatile" somewhere and have the code behave erratically. I always use tiny read32/write32 wrappers instead.


Absolutely. Modern compilers are trivially able to inline such operations, so there's no reason not to make your intentions and separation of operations crystal clear. After all, you're going to read the code a lot more often than you'll write it.


Yes and read/write barriers are also sometimes necessary, to prevent re-ordering by the compiler and processor.


You have to be careful though in some cases. For instance, if you read two MMIO registers in a one liner, there's no way to guarantee the ordering between them.


Yes, wrappers are the way to go. e.g. Linux kernel


In fact, in my firmware writing style, I tend to separate MMIO accesses from mutation to make it clear when those bus accesses occur.


Just want to say thanks to the dev, working great on my BlackBerry Priv with Right Shift mapped to Ctrl.


The title is misleading. This tool is to mute all the speakers, disable all the cameras and network adapter. I think it's required for a meeting etc. A better program maybe just pull the power off.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: