318 questions
4
votes
1
answer
101
views
Did MS-DOS software rely on memory offset wrapping, in practice?
With the Intel 8088's segment:offset model, code and data reads will stay in the active segment unless the segment is changed. For example, take this instruction:
ABCD:FFFF ADD AL,12
This ADD ...
3
votes
2
answers
163
views
What segment register will [SI+BP] use?
In my computer architecture class, we learned about registers (intel 8086 microprocessor) and were given exercises about determining the physical address from a line of assembly. Something like: MOV [...
1
vote
0
answers
46
views
x86 LDTR on 64-bit OSes: is it safe to assume that it is always zero?
I am working on a kernel virtualization driver for x86 CPUs. The driver uses Intel VT-x for virtualization of some guest code.
I stumbled upon a piece of driver code that saves and restores VMM's ...
1
vote
3
answers
380
views
Difference between effective and physical address
I am learning assembly programming on the 8086 microprocessor, and I would like to understand the difference between the effective address and the physical address
My teacher said that the effective ...
1
vote
1
answer
141
views
How can the Intel 8086 access the entirety of the address space at a given time when using memory segmentation?
The intel 8086 has a 20-line address bus. So, it can address 2^20 addresses. However, as it is easier to work with 16-bit words, the 8086 uses only 16 bits to access the memory addresses.
How is it ...
1
vote
1
answer
114
views
How does an assembler find the offset of a label without knowing the value of the segment register?
I am learning about some simple x86 bootloader code and having some trouble understanding how the assembler (nasm in my case) calculates the offsets of labels.
It is my understanding that a data label ...
3
votes
1
answer
98
views
How does CPU addressing the next instruction immediately after switching into protection mode?
I've been working on the Lab1 of MIT6.828. I've got a question about the code used for switching to protection mode.
Here is the assembly code
# Switch from real to protected mode, using a bootstrap ...
0
votes
0
answers
241
views
Why does far call "call far ptr label" MASM syntax not work as intended?
I have been trying to set up a 0x9A, absolute far call using MASM syntax in 32 bit mode and despite my code assembling succesfully, the result will always be call far 0:0. The valid MASM syntax call ...
3
votes
1
answer
533
views
x86 - Switching from 32-bit to 64-bit via RETF
I was looking at some anti-disassembler techniques and came across the following snippet:
push 0x33
call $+5
add [esp+0x10+var_10], 5
retf
; next instruction here
So in a nutshell, this would ...
3
votes
0
answers
233
views
Does the CS register need to be set when setting up Unreal Mode?
The OSDev Wiki describes the general procedure of switching to unreal mode, with an example bootloader:
ORG 0x7c00 ; add to offsets
start:
xor ax, ax ; make it zero
...
3
votes
1
answer
140
views
Why does `pop SS` need that RPL and DPL are equal to the CPL?
Recently, when I read the book "Computer Organization and Design: The Hardware/
Software Interface" by David A. Patterson and John L. Hennessy , it references one resource [Robin and Irvine, ...
0
votes
0
answers
48
views
MIPS behavior of consecutive jumps on segment boundary
This question specifically concerns the VR3000A and MIPS I instruction set, although it's more of a general MIPS question.
I recently found a set of PlayStation 1 hardware tests about the behavior of ...
0
votes
1
answer
143
views
A2118: cannot have segment address references with TINY model
The task is to write an assembly language program that finds the first file in the directory and shows the time of its creation. When you launch the program, nothing happens. Where can the error be? ...
0
votes
0
answers
93
views
calculating segment adresses [duplicate]
in intel 8086 , given a physical adress how to find the possible sets of segment : offset
for example :
5F173 = (5F17,3) = (578D,78A3)
when the first is easy to find but what about the second ?
and is ...
1
vote
1
answer
90
views
Can't assign a variable to the desired memory location
I'm new to assembly. I'm trying to move some numbers into the memory locatons starting from 0800:0010 but couldn't figure it out.
Here's the code:
.data
NUM0 DB 00H
NUM1 DB 22H
NUM2 DB ...
1
vote
1
answer
98
views
Will it be OK to access data through a data segment register after I disturb gdt table?
I had set the gdt table using this data
uint16_t gdt_table[][4] = {
{ 0, 0, 0, 0 },
{ 0xFFFF, 0x0000, 0x9a00, 0x00cf },
{ 0xFFFF, 0x0000, 0x9200, ...
0
votes
0
answers
338
views
Exploiting Conforming Code Segment access
Seeing this in Intel Manual:
"Conforming segments are used for code modules such as math libraries and exception handlers, which support applications but do not require access to protected ...
0
votes
0
answers
47
views
What is value held in selector of task register? Index or byte-offsets?
I'm studying old linux kernel source(linux-0.11), some macros defined in sched.h:
#define FIRST_TSS_ENTRY 4
#define _TSS(n) ((((unsigned long) n)<<4)+(FIRST_TSS_ENTRY<<3))
#define ltr(n) ...
0
votes
1
answer
125
views
I am trying to print a string that contains the ascii letters signatures of the master boot record
But it just prints an empty string, unless I set the address to something like 0x00 or 0x20, then it prints some ascii characters . Also I am new to assembly and x86 segmentation so I barely know if I ...
1
vote
1
answer
89
views
Where system stores 16 segment addresses while segment registers are 4?
In real mode memory addressing there are 16 segments made with the size of 64KB, and there are 4 segment registers, so where system store those 16 addresses?
0. 00000
1. 10000
2. 20000
3. 30000
...
3
votes
1
answer
582
views
How does assembly ORG instruction calculate offset?
I am trying to create a simple BIOS boot sector, for which I use an x86 assembly language. I found out that the layout of memory throughout the booting process looks like the picture beneath this text....
1
vote
1
answer
100
views
16-bit assembly program returning memory values as 0 even after setting values to 1
I'm trying to make a floppy disk operating system, which right now is in its beta. I tried reserving 2 sectors for configuration, and loaded the data into 0x7100. But even though I made sure the ...
-1
votes
1
answer
89
views
SEGMENTATION FAULT for my code , need guidance with debugging
I am using the below code to solve the rat maze problem from geeksforgeeks.However I am getting the segmentation error and I am unable to debug it.Can someone guide me with the debugging?
Here's the ...
1
vote
1
answer
230
views
How can DOS's stack pointer init put a segment just below another segment?
I am learning MS-DOS source
code during that i am in
difficulty with some line of
code:
BIOSSEG: EQU 40H
BIOSLEN: EQU 2048
DOSLEN: EQU 8192
In the next page there are
some lines of code,
INIT:
XOR BP,...
0
votes
0
answers
97
views
When running a compiled GCC file in the terminal
P1 and P2 two processes that share a memory segment representing an integer N and
running in parallel.
the results is supposed to look something like :
process 1 : 2 4 6 8 10
27 29 31 33 35
52 54 56 ...