problem loading sectors
problem loading sectors
Hi all,
I am (finally) implementing the ability to load sectors in my OS. Since my os is only 512 bytes, I have decided to save space and instead of having the user type what sector they want loaded, they press keys F1-F3 to load sectors 1-3 respectively (I am adding F4-F12 later...).
The problem is that when loading a sector, the OS crashes in bochs with the message "00068675875p[CPU0 ] >>PANIC<< prefetch: RIP > CS.limit"
Sectors are loaded to 0x2000:0x0000
The source code is located at http://protonix.asmhackers.net/protonix ... NEWPRO.ASM
(Sorry for the long URL, I have a weird way of organizing my stuff on my webspace)
The relevant sector loading code is at these labels:
sectcomp:
intload2:
intload3:
loadsect:
Here is the Bochs log: http://protonix.asmhackers.net/protonix ... el/log.txt
This is all in FASM, and realmode.
What is causing this PANIC?
-Anthony
I am (finally) implementing the ability to load sectors in my OS. Since my os is only 512 bytes, I have decided to save space and instead of having the user type what sector they want loaded, they press keys F1-F3 to load sectors 1-3 respectively (I am adding F4-F12 later...).
The problem is that when loading a sector, the OS crashes in bochs with the message "00068675875p[CPU0 ] >>PANIC<< prefetch: RIP > CS.limit"
Sectors are loaded to 0x2000:0x0000
The source code is located at http://protonix.asmhackers.net/protonix ... NEWPRO.ASM
(Sorry for the long URL, I have a weird way of organizing my stuff on my webspace)
The relevant sector loading code is at these labels:
sectcomp:
intload2:
intload3:
loadsect:
Here is the Bochs log: http://protonix.asmhackers.net/protonix ... el/log.txt
This is all in FASM, and realmode.
What is causing this PANIC?
-Anthony
Re:problem loading sectors
Hi,
Your code seems to be okay, but what are you loading at 0x2000:0000 (in other words, what's at sector 2 ?)
I think the code, which is at sector 2, is actually causing the problem. (you're jumping to it.)
HTH,
DennisCGc.
Your code seems to be okay, but what are you loading at 0x2000:0000 (in other words, what's at sector 2 ?)
I think the code, which is at sector 2, is actually causing the problem. (you're jumping to it.)
HTH,
DennisCGc.
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:problem loading sectors
it looks like your code ran straight forward through 0x2000:xxxx until it attemps to execute instruction at cs=0x2000, eip=0x00010000, which is forbidden in realmode ...
Chances are that you've loaded a bunch of zeroes instead of the code you expected to have (wrong sector nr or something alike).
Chances are that you've loaded a bunch of zeroes instead of the code you expected to have (wrong sector nr or something alike).
Re:problem loading sectors
Here's the test program:
And to write everything to disk:
-Anthony
Code: Select all
;Protonix sector loading test program
;Just prints a string, waits for a key, and returns to the OS
;Also demonstrates Protonix interrupts in user programs
use16
org 0x0000
mov ax, 0x2000
mov ds, ax
mov es, ax
mov si, string ;load and print string
mov si, pakmsg
int 0x21
int 0x22 ;wait for key
int 0x19 ;give control back to OS
string db 'If you can read this, you have successfully run the Protonix test program',13,10,0
pakmsg db 'Press any key to return to Protonix',13,10,0
times 512-($-$$) db 0 ;make file 512 bytes
Code: Select all
@echo off
echo Installer Script for Protonix 0.2-1
echo Insert a blank floppy disk in drive A (it need not be formatted)
fasm newpro.asm
fasm test.asm
copy /b newpro.bin+test.bin protonix.img
echo.
pause
partcopy protonix.img 0 400 -f0
echo Done!
Re:problem loading sectors
Question:
Is it ment to start in DOS?
if it is not then int 21h and 22h is only for dos, you have to write your own ISR.
if it is then [org 7c00h] statement is wrong.
even with support for int 21h
is going to execute function 20h (a NULL function);
Is it ment to start in DOS?
if it is not then int 21h and 22h is only for dos, you have to write your own ISR.
if it is then [org 7c00h] statement is wrong.
even with support for int 21h
Code: Select all
mov ax, 0x2000
mov ds, ax
mov es, ax
mov si, string ;load and print string
mov si, pakmsg
int 0x21
Re:problem loading sectors
Interrupt 0x21 and 0x22 are valid in my OS (I set up a custom IVT). 0x21 is string output and 0x22 is character input.
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:problem loading sectors
what about setting a breakpoint in the bochs at 0x20000 so that you can make sure what's there is your code and that it executes as expected ?