732 questions
1
vote
0
answers
79
views
cuda & cpp - compilation and linking using cmake
I want to create a skeleton for a project in which there are multiple cuda and cpp files. They will be compiled individually and then linked together to form a single executable.
Currently I have the ...
1
vote
0
answers
145
views
Dallas DS18B20 - problem with address decoding
I am implementing my own SW for getting data from DS18B20, but I've been stuck on decoding address for a while - "receiving" only zeros as a result. Here is my code:
#include <avr/io.h>...
9
votes
3
answers
313
views
How do languages handle printing floats under the hood?
As a personal project, I have been writing a compiler for my own C like language to target a CPU emulator of my own design.
As a part of this, I want to implement a standard floating point library (...
2
votes
1
answer
101
views
how does the cpu find static/global objects on x86?
I know the stack pointer can be used to find stack allocated objects, but how does the cpu find global/static objects? From what I could tell from the disassembly, it uses absolute/immediate ...
4
votes
2
answers
2k
views
Ptrace allows to write to executable program segment, but process_vm_writev doesn't
While experimenting with editing opcodes of running process on Linux with C language, I found out that I can't to edit program opcodes by PID with process_vm_writev, but using ptrace and pwrite I can ...
1
vote
0
answers
78
views
How to insert a character from a virtual keyboard into the focused window using Tauri and pure JS?
I'm building a virtual keyboard using Tauri and pure JavaScript. My application is already set up, but I want to insert the character from the virtual keyboard into the focused window when a key is ...
2
votes
1
answer
148
views
Does risc-v require memory address 0 to be invalid?
So in risc-v, for a virtual memory system, I imagine it's up to the kernel to decide if 0 is a valid memory address or not? But for machine mode, or supervisor mode, is memory address 0 valid to ...
2
votes
0
answers
77
views
How do I resolve the recursive dependency in my page frame allocator (custom OS)?
I’m developing a custom OS and facing a chicken-and-egg problem with my page frame allocator. I need to map a specific page, but if the corresponding PML4 entry is NULL, I must allocate a PDPT. ...
1
vote
0
answers
178
views
How to directly access BCM2835 registers in C programming for GPIO control on a Raspberry Pi running FreeBSD 14.2
I am trying to control GPIO pins of a Raspberry Pi 3/4 running FreeBSD, using direct access to the BCM2835 registers. My code is based on Mike McCauley's C library.
It works fine on Linux (Raspberry ...
6
votes
1
answer
11k
views
How to create variable-sized array of fixed-length "strings" in C?
I am trying to create an array of fixed-length "strings" in C, but have been having a little trouble. The problem I am having is that I am getting a segmentation fault.
Here is the objective of my ...
2
votes
1
answer
121
views
Low level I/O in C
I am trying to solve a problem from the K&R C programming book that requires one to write a low level I/O program which reads text from a file and prints it on screen, if no input file is given in ...
0
votes
1
answer
185
views
Issue with DWARF DIE's and tracking variables
My compiler is writing DWARF DIE's and I am currently coming across an issue with tracking variables.
For example, the abbreviation would look something like:
DW_AT_name DW_FORM_string
...
-1
votes
1
answer
75
views
How would having an #include file.h inside a function work?
I am working on an embedded systems project, so i am dealing with limited memory.
I have this huge array of strings in C, it is basically an array of 31 bitmaps. I have it in a separate file called ...
8
votes
5
answers
25k
views
Bluetooth protocol over wifi?
I'm looking to implement the Bluetooth protocol over a physical Wi-Fi based transport, if that makes sense.
Basically my phone has Bluetooth, and my laptop has a Wi-Fi card (802.11a/b/g).
I know that ...
1
vote
2
answers
111
views
MIPS Assembly--> BEQ
I'm using MARS 4.5 like editor to coding in Assembly Mips.
Today I'm learning BEQ, however I have a problem with this code:
.data
Message_1: .asciiz "I numeri sono uguali"
Stampa:
li $...
2
votes
0
answers
111
views
I can't run this assembly code on my Windows
I want to do the typical Hello World in assembler from my Windows with 64-byte architecture, and it simply doesn't show me anything when running the executable program.
extern printf ...
9
votes
3
answers
5k
views
How does a computer draw the screen? [closed]
How does a computer draw anything to the screen at the lowest level (nothing about external libraries like X11)? Are there supposed to be assembly commands that do this? How exactly does the CPU ...
1
vote
1
answer
103
views
Why a string disappear from the stack when exiting from a function
I'm experimenting with the stack in C to test some things and learn more in the language.
I know that a function has a stack frame created by moving the rsp/rbp pointer.
What I don't understand is ...
1
vote
0
answers
203
views
how to write a large value > 32 bits with a format string exploit %n
I'm working on a challenge that requires me to overwrite a memory address with a libc address, which is usually around 48 bits.
I can write a 32-bit number into an address but with anything larger ...
1
vote
2
answers
121
views
How does the ms_abi pass between c and assembely
I am working on an OS using EFI using the ms_abi and was wondering how does it pass arguments because I am moving some systemtable info into a register but when I try to call a function using the ...
0
votes
0
answers
45
views
I was making an assembly program on intel x64 but I got segmentation fault error
this is the code:
;hello3.asm
;27/06/2024
extern printf
section .data
msg db "this is a message", 0
fmtstr db "%s", 0
section .bss
section .text
global ...
2
votes
3
answers
2k
views
What is the point of using a virtual filesystem?
so I’m making this software that encrypts the files on a computer. A friend of mine (we're both students so don't be too hard on us) suggested I use a Virtual File System. I asked why, and what even ...
0
votes
1
answer
66
views
Vec clears, when I use rust workspaces with my crate [closed]
I have recently created a tool, that allows me to access struct from anywhere in the code, just by the structs name.
The way it works is pretty simple, allocate enough space to hold the desired ...
1
vote
2
answers
548
views
How do you draw graphics in C/C++ without external libraries?
I’m trying to find out how to draw graphics in C/C++ without any external libraries. I know it is possible because I’m pretty sure the libraries are programmed in either C or C++ and I want to know ...
0
votes
0
answers
70
views
freertos linking problems to a z80 device
I'm using the Z88DK C compiler to control my Z80 CPU. While trying to link the FreeRTOS library to my project, I've run into some issues. I'm configuring the Z80 with EEPROM from 0 to FFF and RAM from ...