Questions tagged [low-level]
In terms of a computer system, low-level refers to the components that appears lower in the stack of system layers.
647
questions
0
votes
1
answer
58
views
C : write to video ram
I am trying to make a function that would write strings to video memory with a specific color. However, I am unable to make it work. To write single characters, i would do this:
*(char *)0xb8000 = 'O';...
1
vote
0
answers
54
views
Test for incoming connections
I've been thinking about that for a while, but can not figure out how to do that :
I would like to have a way to know if someone tries to connect to some of my port, but without opening it :
For ...
-1
votes
0
answers
32
views
How to make a simple, single purpose operating system
I am interested in making an operating system which interacts with a server.
it will establish a connection with the server when turned on and take input from a keyboard and pass that directly to the ...
-1
votes
0
answers
18
views
File with extension .s llvm how to use [duplicate]
I have been given a .s file but I don't know what to do with it. I know from a hint that it is related to low level virtual machine (LLVM). Can someone help please.
File :
; ModuleID = 'source.c'
...
0
votes
0
answers
37
views
how does the assembler know which type of machine code to generate?
So I know that assemblers are basically programs that convert say C code to certain machine code that the CPU can understand. Now my question is, how does the assembler know what kind of machine code ...
1
vote
0
answers
19
views
x86 Assembly - LODSB loading wrong bytes in random pattern [duplicate]
I'm trying to make a very basic function in assembly - printing to screen using video memory instead of BIOS interrupts. I already have a basic bootloader that just loads this sector into memory at ...
0
votes
0
answers
29
views
What is an address/range of addresses that are guaranteed to be not used in x86-64?
I am writing a version of malloc that is compatible with multi-threading. Is is going to use arenas to help facilitate the parallelism.
mmap is being used to create the arenas. Using NULL as the input ...
0
votes
1
answer
59
views
Virtual memory and Heap
Good morning. I hope some can help me out understanding how one aspect of virtual memory works and how C behaves.
From what I understand, whenever we call malloc, C will add it to the heap, with the ...
0
votes
0
answers
22
views
How can I count total number of instructions of a function in a WebAssembly module?
WebAssembly code consists of sequences of instructions. I am looking to identify the total number of instructions of a certain function in a WebAssembly module.
Is there an existing method to easily ...
0
votes
0
answers
96
views
Low level system design of http url router in spring java
Can you guys guide me in designing a basic system(spring boot java) that can take a http request that contains a url, http method, body, etc in the request body and the system would send a http ...
1
vote
1
answer
28
views
Clear the contents of a file using low level functions [duplicate]
I would like to write a function able to delete contents of files.
I have some thoughts of how to do it and here is the program that come up from them:
/*fclr - clear file contents*/
#include <...
0
votes
0
answers
31
views
MIPS function syscall printing random number/memory address instead of parameter
I'm new to MIPS and I'm trying to write a very basic function that takes 4 numbers (so 4 parameters) and adds them together. I'm doing it so 3 of the numbers are hard-coded in memory and the 4th ...
0
votes
0
answers
107
views
error: invalid static_cast from type ‘__m256i’ {aka ‘__vector(4) long long int’} to type ‘void*’
I'm trying to compile a piece of code where it calls uses static_cast to do something like the following:
__m256i values;
int64_t i = 1;
static_cast<void*>(values + i);
but this results ...
0
votes
2
answers
62
views
Loading a custom kernel causes VM to constantly reboot
I am working on a custom 32-bit OS, and i have coded a bare bones bootloader. I am trying to make it load a simple kernel that puts a char onto the screen, however, instead of getting the char i get a ...
0
votes
0
answers
37
views
MIPS (assembly) Print function not working as expected
I'm learning MIPS and trying to understand function calls and stuff. I wrote this basic 'printValue' function to print the value of a variable defined in Global memory, but it's printing 0 instead (it ...
0
votes
1
answer
33
views
Undefined chars wrote by low-level function write() on a file
Currently, as exercise, I am building a small database using C programming Language. The database will be structured as a collection of structures. Each structure contain specific elements (in this ...
0
votes
1
answer
29
views
Get the length of a single line from a file with Low-Level I/O functions
I am writing a routine to check if a username has already been registered on an internal database.
In particular the following function "should" return the length of only one single line of ...
0
votes
0
answers
58
views
Divide multi-byte number
If I only have a routine to divide two (unsigned) bytes, how can I divide a two-byte number by a one-byte number (both unsigned)?
The divisor is always 10, if that helps (which I know may mean there ...
0
votes
0
answers
30
views
Can you create an opaque structure wrapper with no runtime penalties?
I have an executable A that dynamically loads a shared library B.
Within B there is a method that returns an object. For a variety of reasons the only thing that A can know at compile time about this ...
2
votes
2
answers
51
views
Multiple threads invoking the same rand() function, how do I make them call their own instance of rand() function? [duplicate]
I have a question about how multithreading and function calls at low-level work. If I call the rand() function from multiple threads, do they access the same function? Where is it stored in the memory?...
0
votes
0
answers
35
views
Write members of a structure using low level I/O function
I want to write a program able to "save" user's data on a file (More or less is like a registration routine).
User's information (Username, Password and ID) are stored into a structure. ...
0
votes
0
answers
20
views
In object file produced by assembler what is the address used in places where linker is supposed to link the correct address? [duplicate]
So an assembler converts the assembly language code into an object file and a linker would then produce an executable file which we can use to execute the program. The job of linker is to link the ...
0
votes
0
answers
24
views
How does a programm remember RAM address?
(So this is a theoretical question and not associated with any specific language. Please let me know if something is wrong with the question)
So for example let's say I have declared and initialized a ...
1
vote
0
answers
94
views
Is there a way to check which event file in /dev/input/ is being used for keyboard input?
Basically, what I am trying to do is capture keyboard input from the user, using files in "/dev/input/". However, a problem I have come across is that the file which handles keyboard input ...
0
votes
2
answers
89
views
Linker Inserts Unnecessary Opcode Padding
I've recently come across a minor issue when linking multiple object files for a Motorola 68000 based system (SEGA Mega Drive). The problem is, when an input section for one object file ends and the ...
0
votes
0
answers
58
views
How to calculate pixel width of given letter
I'm attempting to implement the ability to draw text to the screen on a basic 2D plane, using only HTML Canvas and JavaScript.
I start by setting up the canvas.
const canvas = document.querySelector(&...
1
vote
0
answers
42
views
Basic Understanding: Can a computer skip bits/Bytes?
the last few days I was interested in how a computer works and I want to understand what the PC with CPU, RAM, GPU etc. does (on a low-level) with 0 and 1.
So 8 Bits equals 1 Byte, (e.g. 10100110). My ...
0
votes
0
answers
107
views
WHY deprecate the keyword "volatile" in C++20, although it has important uses in embedded programming? [duplicate]
Update:
First of all, please kindly note that this question does neither involve threading, nor is it about re-ordering or fence-related.
Therefore, this does not answer my question (although it's a ...
0
votes
0
answers
19
views
How do I create a function in Python. (It's not what you think)
Of course, I know how to create a function, but I want to create a function which name varies.
Example given:
I have a dict of jobs and for each job, I want to create a function that prints ...
0
votes
0
answers
29
views
How Linux resists single event upsets?
I am collecting information about single event upsets for my report at the university.
I found plenty of helpful articles for my theme, but I got stuck with operating systems' resistance against SEU. ...
-2
votes
1
answer
84
views
Is there a point to learn legacy x86 16-bit segmentation and DOS assembler at 2021? [duplicate]
Is there a point to learn x86 assembly (protected mode, virtual x86 mode, segmentation, DOS calls etc.) at the end of 2021 by reading the old assembly books about 286/386/486 processors?
Or it will be ...
1
vote
1
answer
181
views
How do I convert a custom image implementation of a bitmap slice to PNG?
I work at a project written in Rust that basically mocks a printer. I get printer input, and try to convert it to human readable data (strings, images). So, for reproducing the QR code, I am ...
0
votes
0
answers
38
views
Designing a reranking service/system following some hard-bound rules
Description:
Given a initial Ranked list of products. Design a reranking system that reorders the items in the list based on the rules defined.
E.g.
I/p format:
query: "aata": ["...
1
vote
2
answers
141
views
Are there invalid floating point states/values?
I know that NaN and various other special cases exist. But are there other unused binary values which are completely invalid?
For example, IEEE 754 does allow -0. But if it didn't, then the binary ...
0
votes
1
answer
70
views
How to clear BIOS-related info on screen then print message?
everyone! I'm sharpening my assembly low-level skills and made myself a simple bootloader. I now made some routines and the entrypoint and successfully output a message however, I want to clear the ...
0
votes
0
answers
61
views
Why is my code printing "Helloo" rather than the intended string I want to print?
everyone! I want to write some basic bootloader so I wrote something that only prints "Hello" to the screen. But when it prints, it prints: "Helloo" as shown on the picture:
Here'...
0
votes
1
answer
41
views
Knuth GC stack overflow prevention algorithm - how does it work?
I'm reading the Garbage Collection. Algorithmis for Automatic Dynamic Memory Management book, and trying to write a blog post about it. I'm concentrating on mark-sweep chapter, where authors discuss ...
0
votes
0
answers
54
views
Sending commands to iOS devices through usb interface
There are commercial tools that send commands to iOS devices through usb interface, for example an iOS device can have mock GPS coordinates using an app like this one,
how do these apps work? how can ...
3
votes
1
answer
392
views
Each program allocates a fixed stack size? Who defines the amount of stack memory for each application running?
When we run a code, the compiler after compile "detects" the necessary amount of Stack memory? And with this, each program has its own "block" of stack memory.
Or the stack memory ...
1
vote
2
answers
227
views
Best way to update a clock every second in Linux
When we talk about updating a clock every second in Linux, I think that something similar to the following code is what comes to mind.
while :; do date +%T; sleep 1; done
This piece of code always ...
0
votes
1
answer
40
views
How to get a regular expression based on the following constraints
I need help in creating regex based on the following constraints for creating a password. [This is for a course assignment]
Note : I can't use extended regular expression. I need to use core regex,i....
1
vote
1
answer
174
views
Questions about ATA
Now I wanted to implement ATA PIO and ATA DMA (PCI bus mastering) drivers. I read the OSdev wiki pages for them and after a whole day of messing around with it I finally understood a lot about ATA ...
0
votes
0
answers
23
views
Do the instruction cache and data cache sync with each other? [duplicate]
Assume this scenario:
We are going to patch a piece of instruction in executable memory while it's running in another thread, here a sample code in C:
Instruction* mem; // pointer to executable memory....
0
votes
1
answer
131
views
vxworks system call trap mechanism
I'm new to VxWorks and working with an ELF binary for VxWorks. System calls appear to trap into the kernel by calling the address _func_syscallTrapHandle which is 0x1234. Since the program must ...
2
votes
0
answers
24
views
Can I perform compute on an NVMe storage device?
I'll start by saying this is not something I am doing in a production system, just a personal project and just writing coding to learn and try and find challenging tasks.
So NVMe drives are used in ...
1
vote
5
answers
124
views
Low level languages and their dependencies
I am trying to understand exactly what it means that low-level languages are machine-dependent.
Let's take for example C, well if it is machine-dependent does it mean that if it was compiled on one ...
3
votes
1
answer
457
views
RISC-V: Illegal instruction exception when switching to supervisor mode
When setting the mstatus.mpp field to switch to supervisor mode, I'm getting an illegal instruction exception when calling mret. I'm testing this in qemu-system-riscv64 version 6.1 with the riscv64-...
0
votes
1
answer
95
views
How to set jump condition for an 8-bit computer?
I have been taking a course called nand2tetris. In it, we build a 16-bit computer, and in each instruction, the first bit chooses address mode or command mode, i.e., if it's 0, then we load the ...
0
votes
1
answer
73
views
Translating C++ program to JavaScript/asm.js does not produce the same sequence of numbers
I took the mother of all random number generators from Agner Fog's library and attempted to make a JavaScript version of this. I expect the bit pattern to be identical but this doesn't seem to be the ...
-2
votes
1
answer
194
views
How to send data using DMA to PCI device? [closed]
How to program the DMA controller for sending/receiving data to/from a PCI device?