bochs | Bochs IA-32 Emulator Project | Emulator library
kandi X-RAY | bochs Summary
kandi X-RAY | bochs Summary
bochs - the cross platform ia-32 (x86) emulator updated: sun jan 5 08:36:00 cet 2020 version: 2.6.11. bochs is a highly portable open source ia-32 (x86) pc emulator written in c++, that runs on most popular platforms. it includes emulation of the intel x86 cpu, common i/o devices, and a custom bios. bochs can be compiled to emulate many different x86 cpus, from early 386 to the most recent x86-64 intel and amd processors which may even not reached the market yet. bochs is capable of running most operating systems inside the emulation, for example dos, linux or windows. bochs was written by kevin lawton and is currently maintained by the bochs project at "bochs can be compiled and used in a variety of modes, some which are still in development. the 'typical' use of bochs is to provide complete x86 pc emulation, including the x86 processor, hardware devices, and memory. this allows you to run os's and software within the emulator on your workstation, much like you have a machine inside of a machine. bochs will allow you to run windows applications on a solaris machine with x11, for example. bochs is distributed under the gnu lgpl. see license and copying for
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of bochs
bochs Key Features
bochs Examples and Code Snippets
Community Discussions
Trending Discussions on bochs
QUESTION
openstack:~/qemu-6.0.0-rc1/build$ qemu-img --version
qemu-img version 2.5.0 (Debian 1:2.5+dfsg-5ubuntu10.51), Copyright (c) 2004-2008 Fabrice Bellard
openstack:~/qemu-6.0.0-rc1/build$ sudo qemu-img check /mnt/esxi/name.vmdk
No errors were found on the image.
openstack:~/qemu-6.0.0-rc1/build$ ./qemu-img -V
qemu-img version 5.2.91
Copyright (c) 2003-2021 Fabrice Bellard and the QEMU Project developers
openstack:~/qemu-6.0.0-rc1/build$ sudo ./qemu-img check /mnt/esxi/name.vmdk
qemu-img: Could not open '/mnt/esxi/name.vmdk': Failed to lock byte 100: Input/output error
...ANSWER
Answered 2021-Apr-25 at 03:29Because the vmdk file in NFS directory, add this option -o nolock
fixed it.
nolock — Disables file locking. This setting is occasionally required when connecting to older NFS servers. noexec — Prevents execution of binaries on mounted file systems. This is useful if the system is mounting a non-Linux file system via NFS containing incompatible binaries.
QUESTION
I have been reading the makefile of xv6 project. I want to put all the user programs into a folder to keep the project tidy. I can not find where it compiles the user programs. I know that when i run: make fs.img; it will compile the user programs, but i can not find any commands to do so. I also want all the kernel code to go into a directory called "kernel".
Is there a feature in make that allows automatic compilation or is there just something I'm not seeing. And could anyone suggest any make docs to help me understand this makefile.
My Makefile:
...ANSWER
Answered 2021-Mar-25 at 12:30All make systems (as required by POSIX) have a number of built-in rules including rules that know how to compile object files from C files.
For information on GNU make's built-in rules you can review the manual.
QUESTION
I have a problem with my Bochs Emulator / Assembly Code, here is the Problem:
...ANSWER
Answered 2021-Feb-09 at 10:14codeseg equ gdt_codedesc - gdt_start dataseg equ gdt_ -> codedesc Must be datadesc - gdt_start
QUESTION
I'm working on a PC emulator using both Bochs and DOSBox as references.
When emulating the "NEG Ed" instruction (two's complement negation of a doubleword) I'm getting different results if I compile with -O0
rather than -O2
.
This is a test program with just the relevant bits:
...ANSWER
Answered 2021-Jan-31 at 13:31There are some issues in your code:
the value returned by
strtol("0x80000000", NULL, 16)
depends on the range of typelong
: if typelong
has 32 bits, the returned value should beLONG_MAX
, which is2147483647
, whereas iflong
is larger,2147483648
will be returned. Converting these values touint32_t
does not change the value as both as within the range ofuint32_t
. Typelong
on your system seems to have 64 bits. You could avoid this implementation defined behavior usingstrtoul()
instead ofstrtol()
.there is no need for the intermediary cast to
(int32_t)
: negating the unsigned value is well defined and-0x80000000
has the value0x80000000
for typeuint32_t
.furthermore, this conversion is counterproductive and the likely cause of the observed behavior as negating the value
INT32_MIN
has undefined behavior because of signed arithmetic overflow. With optimisations enabled, the compiler determines that you are extracting the sign as if bybool sign = -(int32_t)value < 0
and simplifies this expression asbool sign = (int32_t)value > 0
, which is correct for all values exceptINT32_MIN
for which the compiler considers any behavior to be OK, since the behavior is undefined anyway. You can check the code on Godbolt's Compiler Explorer.you use type
bool
without including: the program should not compile. Is this a copy/paste error or do you compile as c++? The C99
_Bool
semantics add an implicit test in the intialization statement, but it would be better to make it explicit and write:
QUESTION
I'm confused.
I have recently started working on building an operating system while using bochs as an emulator and a certain manual online.
In the manual to move the vga framebuffer cursor I'm using the IO ports using the command 'out'. I get how to control it but I don't know what is it that I'm controlling, and after some reading it seems like everywhere it was addressed as an abstract thing that for example makes the cursor to change its position on the screen.
What I want to know: what are they physically? are they cables? if yes from where to where they are connected? can I input from them also as there name suggest? and why do I need the out command and cant write directly to their place in the memory?
If in your answer you can also include the serial ports and the difference between them and the IO ones it will be amazing,
with respect, revolution
(btw the operating system is 32 bits)
...ANSWER
Answered 2020-Dec-27 at 03:45An IO port is basically memory on the motherboard that you can write/read. The motherboard makes some memory available other than RAM. The CPU has a control bus which allows it to "tell" the motherboard that what it outputs on the data bus is to be written somewhere else than RAM. When you output to the VGA buffer, you write to video memory on the motherboard. The out/in instructions are used to write/read IO ports instead of writing to RAM. When you use out/in instructions, you instruct the CPU to set a certain line on its control bus to tell the motherboard to write/read a certain byte to an IO port instead of RAM.
Today, a lot of RAM memory is used for hardware mapping instead of IO ports. This is often called the PCI hole. It is memory mapped IO. So you will write to RAM and it will send the data to hardware like graphics memory. All of this is transparent to OS developers. You are simply using very abstract hardware interfaces which are either conventional (open source) or proprietary.
Serial ports in the meantime are simply ports which are serial in nature. A serial port is defined to be a port where data is transferred one bit at a time. USB is serial (universal serial bus). VGA is serial and others are too. These ports are not like IO ports. You can output to them indirectly using IO ports.
IO ports offer various hardware interfaces which allow to drive hardware. For example, if you have a VGA compatible screen and set text mode, the motherboard will make certain IO ports available and, when you write to these IO ports, video memory will vary depending on what you output to these ports. Eventually, the VGA screen will refresh when the video controller will output data written to video memory through the actual VGA port. I'm not totally aware of how all of this works since I'm not an electrical engineer and I never read about this stuff. To what I know, you can see the pins of the VGA port and what they do independently on wikipedia. VGA works with RGBHV. RGB stands for red, green and blue while HV stand for horizontal/vertical sync. As stated on wiki in the article on analog television:
Synchronizing pulses added to the video signal at the end of every scan line and video frame ensure that the sweep oscillators in the receiver remain locked in step with the transmitted signal so that the image can be reconstructed on the receiver screen. A sync separator circuit detects the sync voltage levels and sorts the pulses into horizontal and vertical sync.
The horizontal synchronization pulse (horizontal sync, or HSync), separates the scan lines. The horizontal sync signal is a single short pulse which indicates the start of every line. The rest of the scan line follows, with the signal ranging from 0.3 V (black) to 1 V (white), until the next horizontal or vertical synchronization pulse.
Memory in itself takes various forms in hardware. Video memory is often called VRAM (Video RAM) or the Frame Buffer as you can read in a Wikipedia article. So in itself video memory is an array of DRAM. DRAM today is one capacitor (which stores the data) and one mosfet transistor (which controls the flow of the data). So you have special wiring on the motherboard between the data bus of the processor and the VRAM. When you output data to video memory, you write to VRAM on the motherboard. Where you write and how just depends on the video mode you set up.
Most modern systems work with HDMI/Display port along with graphics card. These graphics card are other hardware interfaces which are often complex and they often cannot be known because the drivers for the cards are provided by the manufacturers. osdev.org has information on Intel HD Graphics which has a special interface to interact with. It can be used to gather info on the monitor and to determine what RAM address to use to write to the monitor.
QUESTION
A while ago I was working on a simple bootloader project and I decided to start working on it again. Anyways, I'm trying to detect memory using BIOS INT=15H EAX=E820h
. I used the interrupt in a loop and allocated space for a memory map to hold all the entries. Now I'm trying to parse the entries starting from the last entry. My goal is to find the highest 1MB area I can use to hold a file I'm reading from the disk.
This is my code so far. It's being tested on Bochs 2.6.11, with 32MB of RAM and everything else set to default settings. Of course, it's 16-bit real mode code.
...ANSWER
Answered 2020-Dec-17 at 06:01Originally int 0x15, eax=0xE820
returned a 20-byte structure. This was extended to 24 bytes by a version of ACPI (I think it was ACPI 3.0 but didn't check and could be wrong) that introduced a new "flags" field to the structure.
This code allocates space on the stack for the 20 byte structure (without the extra flags field):
QUESTION
I cannot find records in the page table/page directory for address 0xB8000. It works correct and when I put some symbols into this memory region display shows it.
I’m in the protected mode, and paging is enabled. I’m using bochs.
cr0 is 0xe0000011 or 1110 0000 0000 0000 0000 0000 0001 0001b, cr3 is 0x1000
0xB8000 is equal 1011 1000 0000 0000 0000b, so 10111000b is index of page table, it's equal 184, index of page directory is 0, offset is zero.
I go to 0x1000 of physical memory and I get first (index 0) item:
It is 0x2027 or 10 0000 0010 0111b so the physical address of the page table is 10b or 2. I need a content of 184th entry so I need to go to 184 * 4 + 2 = 738 = 0x2E2, but it's empty:
Btw I have three memory descriptors (memory from 0x0 to 0xFFFFFFFF):
...ANSWER
Answered 2020-Nov-05 at 10:37It is 0x2027 or 10 0000 0010 0111b so the physical address of the page table is 10b or 2. I need a content of 184th entry so I need to go to 184 * 4 + 2 = 738 = 0x2E2, but it's empty:
It's 0x2027, so the physical address of the page table is 0x2000 (not 2). The 185th entry (entry number 184) will be at offset 0x2E0 in the page table and will have the physical address 0x22E0.
Note: You could shift the page directory entry (0x2027) to the right 12 places and say "it's physical page number 2", then multiply the page number by the size of a page (or shift it left 12 places) to find the physical address of the page. It's easier/faster to just mask off the lowest 12 bits instead (e.g. physical_address_of_page_table = page_directory_entry & 0xFFFFF000;
), especially when doing it in your head with hexadecimal values (where you can just assume the last 3 digits are zeros).
QUESTION
I have the following assembly code to set up paging for long mode.
...ANSWER
Answered 2020-Sep-20 at 18:27As stated in Intel's documentation ...
QUESTION
Recently I've started reading this "book" about OS development (https://littleosbook.github.io/), and I find it great and all that, but I came across a problem while trying to boot up my image in bochs.
At some point the guide about running the operating system in Bochs tells me to create a config file for the emulator. I set every option to what I read.
But when I run the following command,
bochs -f bochsrc.txt -q
it says:
display library 'sdl' not available
The relevant line in the config file is pretty obvious:
display_library: sdl
I don't know what's the problem. I installed both libsdl and libsdl2.0, but it still won't work.
My work environment consists of an Ubuntu 20.04 and a Bochs 2.6.11.
Has anybody faced with this issue? What's the solution?
...ANSWER
Answered 2020-Aug-01 at 20:10I ran into this issue when running my code on a Vagrant that had no windows manager installed. I think that a windows manager has to be set up in order for bochs to be able to access the relevant libraries or whatever (don't quote me on that lol). After I reinstalled the following dependencies over this Vagrantfile, I managed to get it to work. It worked even better with bochs-x and x.
QUESTION
I am currently in the process of fixing a bootloader I wrote to load my custom real-mode x86 kernel (SYS.BIN
). I managed to get it to read the root directory and FAT, and load a small-ish kernel from the filesystem, all within the bootsector. However, I began testing it with larger kernels, and it seems that the bootloader will not load more than one cluster. I checked my code against another similar bootloader, and it seems to be doing effectively the same thing when it comes to loading multi-cluster files. The main difference is that I am loading the first FAT into segment 0x3000
and the root directory into segment 0x3800
, so that they will be accessible to the kernel. (Did I mess up segmentation at all?)
I should probably mention that I'm testing this by compiling with NASM, writing the resulting BOOT.BIN
file to the first sector of a raw 32M image, mounting it on a loop device, copying SYS.BIN
over, and creating a new image of that loop device, which I then throw into QEMU as a hard drive. I know with certainty that it is only loading the first cluster of the file.
In particular, I believe the code that is causing the issue is likely in here:
...ANSWER
Answered 2020-Jul-29 at 15:30Your mov ax, word [ds:si]
has an unneeded ds
segment override.
This is also related to your problem with the variables, the memory accesses use ds
as the default segment. So after mov ax, 0x3000
\ mov ds, ax
you are not accessing your original variables any longer.
You have to reset ds
to 7C0h, as your loader uses the default org 0
. Your print_str
function does reset ds
like that. But the mov si, word [cluster]
and everything between the FAT word access in .next_cluster
and up to .jump
uses the wrong ds
. To correct this, change your code like this for example:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install bochs
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page