Comments (8)
You can check this commit to see how I fixed the error, it's probably the same issue, just some places that I missed: 65b9c11
from nanobyte_os.
please send the x86.asm file.
If you have discord, it's better to ask the question there as the issues panel is mainly for issues with code in the main nanoOS codebase and not modifications.
from nanobyte_os.
Here is the x86.asm file you requested:
%macro x86_EnterRealMode 0
[bits 32]
jmp word 18h:.pmode16 ; 1 - jump to 16-bit protected mode segment
.pmode16:
[bits 16]
; 2 - disable protected mode bit in cr0
mov eax, cr0
and al, ~1
mov cr0, eax
; 3 - jump to real mode
jmp word 00h:.rmode
.rmode:
; 4 - setup segments
mov ax, 0
mov ds, ax
mov ss, ax
; 5 - enable interrupts
sti
%endmacro
%macro x86_EnterProtectedMode 0
cli
; 4 - set protection enable flag in CR0
mov eax, cr0
or al, 1
mov cr0, eax
; 5 - far jump into protected mode
jmp dword 08h:.pmode
.pmode:
; we are now in protected mode!
[bits 32]
; 6 - setup segment registers
mov ax, 0x10
mov ds, ax
mov ss, ax
%endmacro
; Convert linear address to segment:offset address
; Args:
; 1 - linear address
; 2 - (out) target segment (e.g. es)
; 3 - target 32-bit register to use (e.g. eax)
; 4 - target lower 16-bit half of #3 (e.g. ax)
%macro LinearToSegOffset 4
mov %3, %1 ; linear address to eax
shr %3, 4
mov %2, %4
mov %3, %1 ; linear address to eax
and %3, 0xf
%endmacro
global x86_outb
x86_outb:
[bits 32]
mov dx, [esp + 4]
mov al, [esp + 8]
out dx, al
ret
global x86_inb
x86_inb:
[bits 32]
mov dx, [esp + 4]
xor eax, eax
in al, dx
ret
global x86_Disk_GetDriveParams
x86_Disk_GetDriveParams:
[bits 32]
; make new call frame
push ebp ; save old call frame
mov ebp, esp ; initialize new call frame
x86_EnterRealMode
[bits 16]
; save regs
push es
push bx
push esi
push di
; call int13h
mov dl, [bp + 8] ; dl - disk drive
mov ah, 08h
mov di, 0 ; es:di - 0000:0000
mov es, di
stc
int 13h
; out params
mov eax, 1
sbb eax, 0
; drive type from bl
LinearToSegOffset [bp + 12], es, esi, si
mov es:[si], bl
; cylinders
mov bl, ch ; cylinders - lower bits in ch
mov bh, cl ; cylinders - upper bits in cl (6-7)
shr bh, 6
inc bx
LinearToSegOffset [bp + 16], es, esi, si
mov es:[si], bx
; sectors
xor ch, ch ; sectors - lower 5 bits in cl
and cl, 3Fh
LinearToSegOffset [bp + 20], es, esi, si
mov es:[si], cx
; heads
mov cl, dh ; heads - dh
inc cx
LinearToSegOffset [bp + 24], es, esi, si
mov es:[si], cx
; restore regs
pop di
pop esi
pop bx
pop es
; return
push eax
x86_EnterProtectedMode
[bits 32]
pop eax
; restore old call frame
mov esp, ebp
pop ebp
ret
global x86_Disk_Reset
x86_Disk_Reset:
[bits 32]
; make new call frame
push ebp ; save old call frame
mov ebp, esp ; initialize new call frame
x86_EnterRealMode
mov ah, 0
mov dl, [bp + 8] ; dl - drive
stc
int 13h
mov eax, 1
sbb eax, 0 ; 1 on success, 0 on fail
push eax
x86_EnterProtectedMode
pop eax
; restore old call frame
mov esp, ebp
pop ebp
ret
global x86_Disk_Read
x86_Disk_Read:
; make new call frame
push ebp ; save old call frame
mov ebp, esp ; initialize new call frame
x86_EnterRealMode
; save modified regs
push ebx
push es
; setup args
mov dl, [bp + 8] ; dl - drive
mov ch, [bp + 12] ; ch - cylinder (lower 8 bits)
mov cl, [bp + 13] ; cl - cylinder to bits 6-7
shl cl, 6
mov al, [bp + 16] ; cl - sector to bits 0-5
and al, 3Fh
or cl, al
mov dh, [bp + 20] ; dh - head
mov al, [bp + 24] ; al - count
LinearToSegOffset [bp + 28], es, ebx, bx
; call int13h
mov ah, 02h
stc
int 13h
; set return value
mov eax, 1
sbb eax, 0 ; 1 on success, 0 on fail
; restore regs
pop es
pop ebx
push eax
x86_EnterProtectedMode
pop eax
; restore old call frame
mov esp, ebp
pop ebp
ret
from nanobyte_os.
I am sorry but could you just add the line numbers to the lines where the error occurs? My pc is not working and it is difficult to count the lines in the phone.
from nanobyte_os.
Line 117: mov es:[si], bl
Line 126: mov es:[si], bx
Line 133: mov es:[si], cx
Line 140: mov es:[si], cx
from nanobyte_os.
I'm really sorry about not responding sooner, for some reason I'm not getting notified when new issues are added. I'm having some trouble with WSL at the moment, but I'm working on fixing it and will look into this issue as soon as I can.
from nanobyte_os.
Found the problem, try pulling the latest, it should work now.
from nanobyte_os.
@chibicitiberiu For me the error has returned but at different lines. The log is
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
Assembling [src/bootloader/stage1/boot.asm]
Linking [build/i686_debug/stage1_fat32/stage1.bin]
Assembling [src/bootloader/stage2/crti.asm]
Compiling [src/bootloader/stage2/ctype.c]
Compiling [src/bootloader/stage2/disk.c]
Compiling [src/bootloader/stage2/elf.c]
Compiling [src/bootloader/stage2/fat.c]
Compiling [src/bootloader/stage2/main.c]
Compiling [src/bootloader/stage2/mbr.c]
Compiling [src/bootloader/stage2/memdetect.c]
Compiling [src/bootloader/stage2/memory.c]
Compiling [src/bootloader/stage2/stdio.c]
Compiling [src/bootloader/stage2/stdlib.c]
Compiling [src/bootloader/stage2/string.c]
Assembling [src/bootloader/stage2/entry.asm]
Assembling [src/bootloader/stage2/x86.asm]
src/bootloader/stage2/x86.asm:277: error: invalid combination of opcode and operands
src/bootloader/stage2/x86.asm:292: error: invalid combination of opcode and operands
scons: *** [build/i686_debug/stage2/x86.o] Error 1
scons: building terminated because of errors.
I'm using commit fe61d210896d05c98a731b2d77cded21c4d2c45f
(the latest) on the master branch.
from nanobyte_os.
Related Issues (20)
- mkfs.fat: unrecognized option HOT 13
- NASM on Windows HOT 1
- /usr/bin/ld: i386 architecture of input file `build/i686_debug/stage1_fat32/boot.o' is incompatible with i386:x86-64 output HOT 7
- Linking issues on WSL Ubuntu. HOT 3
- thanks. took some hacking but. built under wsl2 on windows HOT 1
- failed implementing mouse&math HOT 3
- MacOS Makefile? HOT 3
- Part 1 main.asm forgot colon on line 57 HOT 2
- Scons run problem HOT 1
- Broken Makefile part one HOT 4
- mcopy: Permission denied when creating the Makefile HOT 6
- Problem with generate_isrs.sh call in Makefile in videos/part9
- Need to run "bochsdbg" instead of "bochs" to enable gui debug on Windows
- Incorrect PIC ports used in kernel
- Tar extracts files properly, then hangs - PART - 7 HOT 1
- Qemu - Unable to fetch some archives HOT 1
- Cannot use __asm(int $0x1), __asm(int $0x1), etc.
- launch on real hardware HOT 1
- Help needed on x86_64 bit os HOT 2
- main.c(8): Error! E1118: ***FATAL*** No such file or directory
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nanobyte_os.