low-level

Why do you program in assembly? [closed]

痞子三分冷 提交于 2019-12-17 14:59:25
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 10 months ago . I have a question for all the hardcore low level hackers out there. I ran across this sentence in a blog. I don't really think the source matters (it's Haack if you really care) because it seems to be a common statement. For example, many modern 3-D Games have their high

Instruction Level Profiling: The Meaning of the Instruction Pointer?

心不动则不痛 提交于 2019-12-14 00:30:59
问题 When profiling code at the the assembly instruction level, what does the position of the instruction pointer really mean given that modern CPUs don't execute instructions serially or in-order? For example, assume the following x64 assembly code: mov RAX, [RBX]; // Assume a cache miss here. mov RSI, [RBX + RCX]; // Another cache miss. xor R8, R8; add RDX, RAX; // Dependent on the load into RAX. add RDI, RSI; // Dependent on the load into RSI. Which instruction will the instruction pointer

What Are Functions/Closures/Lambdas, From A Data Structures Perspective?

≡放荡痞女 提交于 2019-12-13 07:39:00
问题 I got into a discussion the other day about some nitty-gritty details of programming languages, and one topic that was brought up was what a function (or closure/lambda/etc.) actually 'is' from a data structures perspective. To be clear, I am not asking what functions do or how they are used, but rather how they are represented in code 'behind the scenes'. When a function is 'called', what is happening as the code executes? Is a function a struct or object of some kind that is passed around

Low level C - Display text, pixel by pixel

会有一股神秘感。 提交于 2019-12-12 09:06:52
问题 I am working on a small project where I have to write a low level app. I'd like to display text in that app, and I would even like it to be anti aliased (à la ClearType). No libraries allowed, I have to draw each char pixel by pixel. What is the best way to do this? Can you recommend some known algorithms? How should I store/read the fonts? Thanks! 回答1: You mean you just want to smooth the edges of an existing bitmapped font? This is easy if your original font is 16x32 and you want to render

Android low-level read of SD card greater than 2GB

五迷三道 提交于 2019-12-12 08:41:10
问题 My Android application attempts to read the physical sectors of the SD card by accessing the actual device (in my case, /dev/block/vold/179:1). (this is on a rooted phone, of course) I'm able to open the device as a FileInputStream , and read data from it. However, I can't seem to read it past the 2GB mark (my memory card is 16GB). Is this because Android doesn't support files greater than 2GB? If that's the case, why do functions like position() and skip() accept long arguments?? Does anyone

reading the system clock value?

偶尔善良 提交于 2019-12-11 20:43:48
问题 Is there a virtual/system clock running independently when a computer is booted? How can we read that value? 回答1: Use the RDTSC x86 instruction, it reads the clocks since the system-start. Edit: On x86-64 targets the use of inline assembly is not possible anymore, use either intrinics or a external linked object file which was generated by an assembler. Do not forget to flush the processor pipeline before using this instruction. 来源: https://stackoverflow.com/questions/3253387/reading-the

Why does compiling this simple assembly code and linking to ELF result in such a bigger size than flat binary?

我只是一个虾纸丫 提交于 2019-12-11 00:12:09
问题 I'm working with an embedded OS like environment, and so size of binaries needs to be as small as possible. I had been using simple flat binary files as an executable, but now I'm trying to use ELF. I'm just using assembly code, but linking with ld. Assembly code: CPU i386 BITS 32 SECTION .text progbits alloc exec nowrite GLOBAL start start: mov eax, 0 add eax, 1 inc eax mov eax, 0x12345678 mov dword [0x100000], eax mov ebx, dword [0x100000] mov eax, ebx out 0xF3, al ;dump memory API call out

Decoding Git index file using C#

不想你离开。 提交于 2019-12-10 17:38:39
问题 Is there any documentation about internal structure of Git index file? From various book I know it's binary and it contains SHAs of staged files, I know about Git 'plumbing' commands helping to reveal index content... But how about read index by myself using C#, for example? I know that there several implementations of this feature, so it's possible to study the code: In Git itself; In libgit2 written on C; In GitSharp ported to C# from Java. And all these options a bit complex, because need

How can i access JPEG COM segment in iOS?

痴心易碎 提交于 2019-12-10 16:22:26
问题 JPEG has many Marker Segment Levels, I want to read and write Comment marker segment level - COM (read/write). It needs low level programming. How can i access it in iOS ? References - http://help.accusoft.com/ImageGear/v18.1/Mac/IGDLL-10-05.html https://www.npmjs.com/package/jpeg-com-segment http://www.sno.phy.queensu.ca/~phil/exiftool/ 回答1: IOS allows you to open files. Read the JPEG file. Search the stream for the COM marker. Read the length. Read the data. It's basic [objective] C

primitive ssh connection (lowlevel)

耗尽温柔 提交于 2019-12-10 13:35:47
问题 as a small (large) hobby project I've set out to make a (very primitive) ssh-2.0 client in C#. This is to explore and better understand DH and help flourish my encryption familiarities :) As per RFC 4253, I've begun the initial connection like this: (leaving out irrelevant presetting of vars etc.) Random cookie_gen = new Random(); while ((ssh_response = unsecure_reader.ReadLine()) != null) { MessageBox.Show(ssh_response); if (ssh_response.StartsWith("SSH-2.0-") { // you told me your name, now