You are not logged in.
Well, seeing as your forum isn't up...and I suspect that bubach won't mind, I figured I'd start a thread for you. I looked at your latest release and website. The website is much improved over the first time I saw it. The features you intend to bring forward look apetizing too. Good work! Your image loaded fine under bochs as well as on floppy to my hardware. The keyboard handler seemed to work...however I didn't go through all the paces to check all buttons and combinations. It does look promising as well. I can't wait to see your internal commands...which I expect will be soon.
Oh, I nearly forgot, before I leave, the image file loads from HDD into Bochs and the speed indicates 0 MHz. When I boot to Bochs from floppy it is 9 MHz, and when I run it on the hardware I get the 2199 MHz I should get. I have a routine for this myself, however I'm being bit anal and go out to Hz. On this note, I am wondering (due to lack of looking) if there is a simple way of determining if Bochs is loaded? So that a warning message or something can be brought up for the user to let them know that some items in the code may not work as they should do to the emulation. Just a thought.
BTW, thanks for the congrats for my son...I figured I'd bring that subject over here as well.
Offline
smiddy wrote:
Well, seeing as your forum isn't up...and I suspect that bubach won't mind, I figured I'd start a thread for you. I looked at your latest release and website. The website is much improved over the first time I saw it. The features you intend to bring forward look apetizing too. Good work! Your image loaded fine under bochs as well as on floppy to my hardware. The keyboard handler seemed to work...however I didn't go through all the paces to check all buttons and combinations. It does look promising as well. I can't wait to see your internal commands...which I expect will be soon.
Oh, I nearly forgot, before I leave, the image file loads from HDD into Bochs and the speed indicates 0 MHz. When I boot to Bochs from floppy it is 9 MHz, and when I run it on the hardware I get the 2199 MHz I should get. I have a routine for this myself, however I'm being bit anal and go out to Hz. On this note, I am wondering (due to lack of looking) if there is a simple way of determining if Bochs is loaded? So that a warning message or something can be brought up for the user to let them know that some items in the code may not work as they should do to the emulation. Just a thought.
BTW, thanks for the congrats for my son...I figured I'd bring that subject over here as well.
Hi,
Thanks for the compliments! I really should get the forum up asap. I am aware of the "CPU-speed-detecting-routine-bug". (If you can call it a bug). I really am busy with researching multitasking and still designing that part. (Process Management). I think I'm going to use the software-based switch. I think that's "easier" for me. If I passed that, I start thinking of having FS support.
I thought there was a way in BOCHS, not sure though. I will post it when I found something about it. And in VMWARE you could check if your OS is running in VMWARE. I don't know how.
I keep you informed
DennisCGc.
Offline
Sounds good. I'll do the same if I find it too, not that I'm looking for it with a fever pitch.
I don't beleive your CPU speed routine is a bug. When I get home I'll post my code too for a comparison. Mine seemed to be slower as well in Bochs. There is a timing setting in the setup file, which I played with to make it look like an 8 MHz machine. That died quick since it became irritating to watch how slow everything was.
It will be interesting to see your process management. Out of curiosity, will that be a part of the kernel or seperate?
Offline
smiddy wrote:
I don't beleive your CPU speed routine is a bug.
I said it with a sense of irony I'm fully aware that BOCHS is causing the error.
smiddy wrote:
When I get home I'll post my code too for a comparison. Mine seemed to be slower as well in Bochs. There is a timing setting in the setup file, which I played with to make it look like an 8 MHz machine. That died quick since it became irritating to watch how slow everything was.
Going to post my code as well on the forum.. don't have it now actually.. (you can take a look the OS Faq of Mega-tokyo, it's 90% my code)
[url]http://www.mega-tokyo.com/osfaq2/index.php/How%20can%20I%20tell%20CPU%20speed%20%3F[/url]
smiddy wrote:
It will be interesting to see your process management. Out of curiosity, will that be a part of the kernel or seperate?
Since my kernel is almost 100% monolithic (you can easily ignore the word "almost"), it's going to be in the kernel. I have my reasons to program a monolithic kernel instead of a microkernel
DennisCGc.
Offline
Here it is:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; CPU Speed (Only compatible with Pentium or above compatibles) ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; CPUSpeed: push eax push edx push es push di mov ax,0x40 ; 40:006c mov es,ax ; Point DS there mov di,0x006c ; Offset lo_mem.timer_count mov cx,[es:di] ; Load with counter information .TimeChange: cmp cx,[es:di] je .TimeChange ; Loop until timer count changes add cx,0x0008 ; Add 8 to the counter info rdtsc ; Read time-stamp counter into EDX:EAX mov [TheEAX],eax ; Apparently returns in EAX and mov [TheEDX],edx ; the EDX .Calibrated: cmp cx,[es:di] jne .Calibrated ; Loop until counter + 8 has passed rdtsc ; Run again but don't know sub eax,[TheEAX] ; Gets the difference from the first time RDTSC was run sbb edx,[TheEDX] ; Subtract and carry ??? Don't know particulars mov bx,TheEAX mov [bx],eax ; Save EAX mov [bx+4],edx ; Save EDX mov ax,ds ; Restore ES mov es,ax mov si,TheFBSTP ; DS:SI points to fild qword [bx] ; Load both 64-bits, EAX and EDX into FPU fmul dword [OneFifth] ; Floating point op, multiplys stack by variable onefifth fistp qword [TheFBSTP] ; Round it off and pop answer into TheFBSTP (should change variable name) mov eax,dword [TheFBSTP] call ToDecimal ;; Need to put an algorythm in place for this and rip forward zeros off ;; For now, this works! pop di pop es pop edx pop eax ret
I used HFAST for inspiration... I hadn't looked at it in quite some time since I removed it from the bootup check. I will have to update it for protected mode.
Offline
You're using the FPU ? mm, to be honest, I have to figur out one day how it works, etc. (Not using it atm)
Here it is:
cpu_speed_detect: mov ebx,[irq0_count] cpu_wait_for: cmp ebx,[irq0_count] jz cpu_wait_for rdtsc mov [tscLoDword],eax mov [tscHiDword],edx add ebx,2 cpu_loop: cmp ebx,[irq0_count] jnz cpu_loop rdtsc sub eax,[tscLoDword] sbb edx,[tscHiDword] ;in the normal intel manual it says: ;54945=(1/18.2)*1000000 ;because the PIT runs at 100 hz, the formula should be: ;10000=(1/100)*1000000 xor edx,edx mov ebx,10000 div ebx mov [mhz],eax xor eax,eax mov esi,cpu_msg01 call WRITE mov eax,[mhz] call write_digit mov esi,cpu_msg02 call WRITE ret tscLoDword dd 0 tscHiDword dd 0 mhz dd 0 cpu_msg01 db 'kernel.s: Measured CPU speed: ',0 cpu_msg02 db ' MHz',13,0
It's assumed irq0_count is increased every 10 ms. Further more, cpu_detect first checks if your CPU supports CPUID, if so, it's assumed you have RDTSC available. I know, it's a wrong assumation, but for me it works Later I will do that using CPUID.
And there's also a "bug", if your CPU is more than 4 GHZ, it will "overloop". I have to use the FPU, but as explained before, I seriously don't know how to use it. I will find something about it.
DennisCGc.
Offline
Doesn't bochs bios have some special int or something, so that you'll know it's bochs?
Otherwise, check a couple of ram locations, if it's all zeros it's (almost) safe to asume that
you'r running inside bochs..
Offline
@DennisCGc:
I looked at your code on Mega-Tokyo's site (same as here? looks to be initially). I like the idea of the hook into the timing interrupt. However, as yet, I haven't set up my IDT, as you know. I finally have the VENDORS.TXT loaded and have enumerated the PCI bus for specific devices. So the next step for me is the device manager. I have ideas so it should be about two to three weeks before I have a working model. At which point my IDT should be working too and I can start work on the floppy driver, as well as the keyboard, ATA, et al. So, when that happens I'll have to place your routine versus mine and see how they work...
I don't know much about the FPU either...but it provides a level of precision I need for scientific work. I will be using it more and more for applications that do further analysis, like the Network Analyser.
As for the [i]over flop[/i] it may be wise to consider using 64-bit registers too, if they are available. I am considering this myself since I want to be able to run my OS on the variants of 64-bit CPUs, especially in consideration that a potential of 16TB can be on board one CPU...man imagine the possibilities.
I really was near rookie status when I originally put that code together. You may have noticed a few places where I had been redundant and could really clean it up now. If I wasn't so lazy (as bubach claims he is...but I think otherwise) I would put dates on my code fragments and a dialogue of the changes as I make them. But alas I haven't so I can not remember how long ago it was that I put it together.
@bubach:
I don't know. As I've been putting my PCI BIOS 32 routines together I have been reading more and more about Bochs. I haven't found anything about that yet. I did find a recent online manual (the link is at home, I'll post it when I'm able this evening) which is pretty interresting. Most cool attributes of Bochs are only able to be done under Linux, so I am bummed, since I use Window XP. But, Bochs 2.2 Pre 4 does have PCI BIOS 32 supported and I'll provide a screen shot of it's enumeration tonight too. I really want to be able to interface my RealTek 8139 NIC through Bochs too for development purposes later down the road and I suspect it is possible but as yet haven't found a way without tinkering which takes some time, which I'd rather spend coding my current phase on the OS.
As for check for zeros, this may work on an intitial run, but subsequent runs (hitting the reset button for reboot) leaves whatever you wrote the previous time in memory, so that may not be the safest/best way to do it. I current also have interrupts turned off until after I have a rudimentary device manager up and running (which will be contingent on interrupts). Then I will look at task/process/thread switching... Not too much to do, eh?
I should find it tonight if there is an INT for Bochs or some other so that I can put up a [b]WARNING:[/b] message up that Bochs has been detected, some objects may be closer than they actually appear.
Offline
smiddy wrote:
@DennisCGc:
I looked at your code on Mega-Tokyo's site (same as here? looks to be initially).
Because it's almost mine
http://www.mega-tokyo.com/osfaq2/index.php/How%20can%20I%20tell%20CPU%20speed%20%3F wrote:
See the intel manual (see links) for more information. (
-- bugs report are welcome. IM to DennisCGC
smiddy wrote:
I like the idea of the hook into the timing interrupt. However, as yet, I haven't set up my IDT, as you know. I finally have the VENDORS.TXT loaded and have enumerated the PCI bus for specific devices. So the next step for me is the device manager. I have ideas so it should be about two to three weeks before I have a working model. At which point my IDT should be working too and I can start work on the floppy driver, as well as the keyboard, ATA, et al. So, when that happens I'll have to place your routine versus mine and see how they work...
I don't know much about the FPU either...but it provides a level of precision I need for scientific work. I will be using it more and more for applications that do further analysis, like the Network Analyser.
Uhm, okay... Please note I only have the ATA driver ready (to be more precisely, the HD code is done)
Nice to see you're making much more progress than I do. And you're right about the FPU, it's far more precise than the CPU is.
smiddy wrote:
As for the [i]over flop[/i] it may be wise to consider using 64-bit registers too, if they are available. I am considering this myself since I want to be able to run my OS on the variants of 64-bit CPUs, especially in consideration that a potential of 16TB can be on board one CPU...man imagine the possibilities.
I only have 32 bit processors, and the FPU should suffice, right ? If not, MMX should do the trick
Offline
Well, here is my latest screen shot from Bochs 2.2 Pre4:
smiddy's OS (C) 2004, 2005. All Rights Reserved. Version 1.00.00.000000A0 CPU: Pentium or equivelent A20 Gate: Initializing; A20 gate enabled... E820: 67,108,864 bytes. E801: 67,108,864 bytes. 88xx: 16,777,216 bytes. CMOS: 67,108,864 bytes. Entering UnReal Mode... Probe: 67,108,864 bytes. Mapping Memory 1: 67,108,864 installed: E820: Mapping Memory 2: Bitmap Initialized at 14MB: 50,331,648 bytes free for use. Looking for FLOPPY.SYS in root...Unable to find file! Looking for ATA.SYS in root...Unable to find file! Looking for KEYBOARD.SYS in root...Unable to find file! Looking for VENDORS.TXT in root...Found! Loading VENDORS.TXT 198,194 bytes. The next file can be loaded at: 01030800h Stack Initialized at 00FFFFFFh; Growing Down. We made it to PMode, WOW! BIOS32 Entry Found at: 000F9D90h Revision: 0 PCI32 BIOS Found at: 000F9DD0h PCIIRQ Table found: 000FA030h Slots: 6 Bus: 0 Device: 01h Function: 00h PCI IRQ Slot: 0 Bus: 0 Device: 01h INT A#: 60h PCI IRQ Slot: 1 Bus: 0 Device: 02h INT A#: 61h PCI IRQ Slot: 2 Bus: 0 Device: 03h INT A#: 62h PCI IRQ Slot: 3 Bus: 0 Device: 04h INT A#: 63h PCI IRQ Slot: 4 Bus: 0 Device: 05h INT A#: 60h PCI IRQ Slot: 5 Bus: 0 Device: 06h INT A#: 61h The first pass completed: This file was created on: Sun May 15 19:01:48 PDT 2005 Creating database of 891,224 bytes: VendorID, DeviceID, VendorString, DeviceString. Reducing required information size to items only currently installed. 8086 1237 Intel Corporation - 82440LX/EX PCI & Memory 8086 7000 Intel Corporation - 82371SB PIIX3 PCI-to-ISA Bridge (Triton II) 8086 7010 Intel Corporation - 82371SB PIIX3 IDE Interface (Triton II) Start End Size (bytes) Type Owner/Description --------- --------- ------------- --- ----------------- 00000000h 000003FFh 1,024 02h Interrupt Vector Table (IVT) 00000400h 000004FFh 256 02h BIOS Data Area (BDA) 00000500h 000005FFh 256 02h smiddyOS Data Area (OSDA) 00000600h 0009FBFFh 652,800 02h smiddyOS code 0009FC00h 0009FFFFh 1,024 02h Extended BIOS Data Area (EBDA) 000A0000h 000BFFFFh 131,072 02h VGA Buffer Area 000C0000h 000FFFFFh 262,144 02h ROM/BIOS Area 00100000h 00FFFFFFh 15,728,640 02h smiddyOS code 01000000h 010000BFh 192 02h PCI Vendors and Devices Information (Reduced) 010000C0h 010307FFh 198,464 01h <Free Useable Memory> 01030800h 0110A157h 891,224 02h PCI Vendors and Devices Information (Cooking) 0110A158h 03FFFFFFh 49,241,768 01h <Free Useable Memory> 04000000h FFFFFFFFh 4,227,858,432 02h Unuseable addressable memory area Boot up time> 19:55:06 System Time> 19:55:16 Current Time> 19:55:22
As you can see I haven't released the database I created to show the considerable difference between the database and the number of items on one system. Bochs it getting pretty nice too with this PCI BIOS 32 it actually has a few devices...
BTW, here's the website for the latest manual I found: http://www.vruppert.de/bochs/doc/user/book1.html Looking through here I haven't found anything that is a way to determine if Bochs is running your OS.
Offline
Here's a view of the system loading the device drivers. I moved Window's driver there for now to see them get loaded...and perhaps use to manipulate later. I have to come up with a driver set of standard precedures though...
smiddy's OS (C) 2004, 2005. All Rights Reserved. Version 1.00.00.000000A1 CPU: Pentium or equivelent A20 Gate: Initializing; A20 gate enabled... E820: 33,554,432 bytes. E801: 33,554,432 bytes. 88xx: 16,777,216 bytes. CMOS: 33,554,432 bytes. Entering UnReal Mode... Probe: 33,554,432 bytes. Mapping Memory 1: 33,554,432 installed: E820: Mapping Memory 2: Bitmap Initialized at 14MB: 16,777,216 bytes free for use. Looking for FLOPPY.SYS in root...Found! Loading FLOPPY.SYS 20,480 bytes. The next file can be loaded at: 01005000h Looking for ATA.SYS in root...Found! Loading ATA.SYS 95,360 bytes. The next file can be loaded at: 0101C600h Looking for KEYBOARD.SYS in root...Found! Loading KEYBOARD.SYS 24,576 bytes. The next file can be loaded at: 01022600h Looking for VENDORS.TXT in root...Found! Loading VENDORS.TXT 198,194 bytes. The next file can be loaded at: 01052E00h Stack Initialized at 00FFFFFFh; Growing Down. We made it to PMode, WOW! BIOS32 Entry Found at: 000F9D90h Revision: 0 PCI32 BIOS Found at: 000F9DD0h PCIIRQ Table found: 000FA030h Slots: 6 Bus: 0 Device: 01h Function: 00h PCI IRQ Slot: 0 Bus: 0 Device: 01h INT A#: 60h PCI IRQ Slot: 1 Bus: 0 Device: 02h INT A#: 61h PCI IRQ Slot: 2 Bus: 0 Device: 03h INT A#: 62h PCI IRQ Slot: 3 Bus: 0 Device: 04h INT A#: 63h PCI IRQ Slot: 4 Bus: 0 Device: 05h INT A#: 60h PCI IRQ Slot: 5 Bus: 0 Device: 06h INT A#: 61h About to cook VENDORS.TXT file for use in enumeration. The first pass completed: This file was created on: Sun May 15 19:01:48 PDT 2005 Creating database of 891,224 bytes: VendorID, DeviceID, VendorString, DeviceString. Reducing required information size to items only currently installed. 8086 1237 Intel Corporation - 82440LX/EX PCI & Memory 8086 7000 Intel Corporation - 82371SB PIIX3 PCI-to-ISA Bridge (Triton II) 8086 7010 Intel Corporation - 82371SB PIIX3 IDE Interface (Triton II) Start End Size (bytes) Type Owner/Description --------- --------- ------------- --- ----------------- 00000000h 000003FFh 1,024 02h Interrupt Vector Table (IVT) 00000400h 000004FFh 256 02h BIOS Data Area (BDA) 00000500h 000005FFh 256 02h smiddyOS Data Area (OSDA) 00000600h 0009FBFFh 652,800 02h smiddyOS code 0009FC00h 0009FFFFh 1,024 02h Extended BIOS Data Area (EBDA) 000A0000h 000BFFFFh 131,072 02h VGA Buffer Area 000C0000h 000FFFFFh 262,144 02h ROM/BIOS Area 00100000h 00FFFFFFh 15,728,640 02h smiddyOS code 01000000h 01004FFFh 20,480 02h FLOPPY SYS 01005000h 0101C5FFh 95,744 02h ATA SYS 0101C600h 010225FFh 24,576 02h KEYBOARDSYS 01022600h 010226BFh 192 02h PCI Vendors and Devices Information (Reduced) 010226C0h 01FFFFFFh 16,636,224 01h <Free Useable Memory> 02000000h FFFFFFFFh 4,261,412,864 02h Unuseable addressable memory area Boot up time> 20:33:33 System Time> 20:33:43 Current Time> 20:33:51
BTW, I should let you all know now I'll be on Holiday for the next week starting tomorrow evening. So no more coding for me for a while.
Good luck on your projects! I'll write when I return...and perhaps tomorrow at work.
Last edited by smiddy (2005-05-27 00:39:09)
Offline
DennisCGc, Test your OS on 5 real PC's, works great on all, as in detects the right speed, drives etc.
keyboard driver worked on all, except one, but that has a usb keyboard, so it would need a usb driver.
The test pc's range from a old 486 laptop to p4 2.70 GHz pc.
PS: I agree with smiddy your web site look very professional.
Great job .
Offline
Thanks a lot I really have to find (well, I already know some links on the subject) some USB documents. Anyway, first the PM , then the PCI enumaration and then the USB driver
Your OS is looking good as well, hope to see the GUI 100% working
Anyway, thanks a lot for testing my OS
Offline
Pages: 1