DPDK has two hugepage sizes:2MB hugepages and 1GB hugepages. I run the command below to use the 1GB hugepages: However, when I run the command cat /proc/meminfo: It still seems to use the 2MB hugepages. What should I do to use the 1GB hugepages? Answer The Hugepagesize field of /proc/meminfo is the default huge page size used by applications allocating
Tag: x86-64
Calling libc functions from another shared library in AT&T syntax?
i was trying to assemble codes below to shared library via gcc. i used command below in terminal and got errors. Then i googled the question and got a seemingly feasible answer in undefined-reference-to-main-for-shared-library. Then i added option -no-pie, used commands below and got another error. It seems that the order of options matters. But i used codes in 32-bits
Why does this nostdlib C++ code segfault when I call a function with a thread local variable? But not with a global var or when I access members?
Assembly included. This weekend I tried to get my own small library running without any C libs and the thread local stuff is giving me problems. Below you can see I created a struct called Try1 (because it’s my first attempt!) If I set the thread local variable and use it, the code seems to execute fine. If I call
Understanding ELF64 text/data segment layout/padding
I’m trying to brush up on UNIX viruses and one text I’m reading mentions that parasitic code can be inserted in the padding between the text and the data segment, supposedly up to 2MB in size on x86-64 systems. But when I compile a simple hello world program with gcc -no-pie… …and inspect its segment headers with readelf -W -l
How to make a custom section executable (other than .text)
Basic Hello World as seen many times before on x86_64 Linux: My current ld linker script: Invoked with: I’m currently getting a segfault. Inspecting the output of readelf -a I can see that my_section does not have executable permissions. I believe this is causing the segfault. If I replace it with .text : { *(.my_section*) } > rom it still
get a char passed as parameter
I would like to write a function in NASM System V ABI x86-64 (Intel Syntax) that I could use in a C program. Here is the prototype of the function: I therefore retrieve the parameters in order (const char *s = rdi, int c = rsi) First, I get the character stored in the register rsi and put it in
Clang 11 and GCC 8 O2 Breaks Inline Assembly
I have a short snippet of code, with some inline assembly that prints argv[0] properly in O0, but does not print anything in O2 (when using Clang. GCC, on the other hand, prints the string stored in envp[0] when printing argv[0]). This problem is also restricted to only argv (the other two function parameters can be used as expected with
What is the size in bits of a file descriptor in an x64 system running Ubuntu 19.10?
What is the size in bits of a file descriptor such as standard input and standard output, is it a 32-bit integer? Answer If you are talking about the actual file descriptors returned by (and used for) Linux syscalls, then take a look at the manpage for open etc. as @JonathanLeffler suggests. For instance: The return value of open() is
Why is there a “gap” beween the variables that I initiated in the stack?
I’m trying to play around with a buffer overflow. When the program counter gets to if(modified != 0), the base pointer is 0x00007fffffffdfe0. Right below the base pointer, I see 4 bytes that contains integer 0 which makes sense. However, the buffer is not right below the int modified. It looks like 4 bytes of 0s then 0x00007fff are in
How to run Rebol script on Linux 64-bit
I can not run this sample Rebol script on Debian 10 Linux 64-bit OS. The script is from the official Rebol tutorial. I’m trying to run it using this command from console: but it fails with error message I use the latest available build for Linux x86-64 from the official Rebol site. How to run the script? Does Rebol support