Welcome, Guest. Please login or register.
Amiga Kit Amiga Store Iridium Banner AMIStore App Store A1200/A600 4xIDE Interface

AuthorTopic: 64-bit AmigaDOS operations?  (Read 2004 times)

0 Members and 1 Guest are viewing this topic.

Offline Minuous

64-bit AmigaDOS operations?
« on: February 03, 2004, 08:18:06 PM »
I know there is now support for >4Gb drives at the trackdisk.device level, however is there support for this via dos.library? Are >4Gb *partitions* supported or only >4Gb *drives*?

(I want to get the remaining free space on a partition in a >4Gb-compliant way. But if there is still a <4Gb-per- partition-limit then it's a non-issue, and would explain the lack of support for it in dos.library.)

If >4Gb partitions are *not* supported, does anyone know whether this will be remedied in OS4?

Thanks.
 

Offline Piru

  • \' union select name,pwd--
  • Hero Member
  • *****
  • Join Date: Aug 2002
  • Posts: 6946
  • Total likes: 0
    • http://www.iki.fi/sintonen/
Re: 64-bit AmigaDOS operations?
« Reply #1 on: February 03, 2004, 08:46:01 PM »
Quote
however is there support for this via dos.library?

Yes.

Quote
(I want to get the remaining free space on a partition in a >4Gb-compliant way.

Just make sure you use 64bit math, other than that it's identical to the code you use now.

ULONG NumBlocksFree;
unsigned long long NumBytesFree;
struct InfoData *id; /* assumed allocated and set up by Info() call */

NumBlocksFree = id->id_NumBlocks - id->id_NumBlocksUsed;
NumBytesFree = (unsigned long long) NumBlocksFree * id->id_BytesPerBlock;
 

Offline mikeymike

Re: 64-bit AmigaDOS operations?
« Reply #2 on: February 03, 2004, 08:47:44 PM »
>4GB drive usage is not hampered by whether the OS is 32-bit or 64-bit.

There is a limit for 32-bit setups for RAM, being 4GB, but that's because RAM is talked to and referenced differently to hard disks.  I can't give you a definitive and correct explanation as to the why's and how's, because I don't know :-)

IIRC, I'm not sure, but isn't the 4GB drive barrier addressed in OS3.9 or 3.5?

Offline Minuous

Re: 64-bit AmigaDOS operations?
« Reply #3 on: February 04, 2004, 01:36:48 AM »
Quote

ULONG NumBlocksFree;
unsigned long long NumBytesFree;
struct InfoData *id; /* assumed allocated and set up by Info() call */

NumBlocksFree = id->id_NumBlocks - id->id_NumBlocksUsed;
NumBytesFree = (unsigned long long) NumBlocksFree * id->id_BytesPerBlock;


Thanks, I will have to try this out; eventually I will make a version of Report+ with >4Gb support.

[/QUOTE]
>4GB drive usage is not hampered by whether the OS is 32-bit or 64-bit.

There is a limit for 32-bit setups for RAM, being 4GB, but that's because RAM is talked to and referenced differently to hard disks. I can't give you a definitive and correct explanation as to the why's and how's, because I don't know
[/QUOTE]

Sorry, I should have made the question clearer; I was not referring to whether the operating system is a 32- or 64-bit program, but rather whether 64-bit quantities are used as arguments in disk operations.
 

Offline Acill

Re: 64-bit AmigaDOS operations?
« Reply #4 on: February 04, 2004, 03:03:52 AM »
I'm mostly sure that as of 3.5 its no longer an issue, but dont take my word for it. I do know I installed 3.9 from my emergency disk and can access all of my 60GB drive with no problems. I do have it split into 2 drive, but I was sure I could make it one large drive if I wanted to.

As for large drive support in OS4 I would put my money on guessing its not an issue at all. With smaller drives no longer being sold new it would be stupid to keep the old legacy drive limitations in the OS.
Proud Retired Navy Chief!

A4000T - CSPPC - Mediator
Powerbook G4 15", 17"
Powermac G5 2GHZ
AmigaOne X5000
Need Amiga recap or other services in the US? Visit my website at http://www.acill.com and take a look or on facebook at http://facebook.com/acillclassics
 

Offline danamania

Re: 64-bit AmigaDOS operations?
« Reply #5 on: February 04, 2004, 07:35:27 AM »
Quote
There is a limit for 32-bit setups for RAM, being 4GB, but that's because RAM is talked to and referenced differently to hard disks. I can't give you a definitive and correct explanation as to the why's and how's, because I don't know


At a wild guess, each address in RAM refers to one byte. The limit of 2^32 is 4294967296 bytes, or 4gigabytes total.

On disk, the limit is 2^32 blocks, not bytes. Each of those 2^32 blocks is a good bit bigger than one byte, 4K I think. That's 4294967296 lots of 4kbytes, or ... bucketloads more!. 16192 GB or 16TB, perhaps.

That's the rough explanation, even if the numbers aren't exactly spot on, I think they're about right :)

dana

 

Offline Piru

  • \' union select name,pwd--
  • Hero Member
  • *****
  • Join Date: Aug 2002
  • Posts: 6946
  • Total likes: 0
    • http://www.iki.fi/sintonen/
Re: 64-bit AmigaDOS operations?
« Reply #6 on: February 04, 2004, 10:19:38 AM »
Quote
Each of those 2^32 blocks is a good bit bigger than one byte, 4K I think.

Typically 512 bytes.

Can be 4k too, though, but with that you lose lots of storage with small files.

Your explanation is correct, nevertheless.
 

Offline tweek

Re: 64-bit AmigaDOS operations?
« Reply #7 on: February 04, 2004, 11:09:29 AM »
@ Minuous:

>4Gb partitions is supported by dos. That is because dos only makes references to the logical blocks on the drive, not the bytes. In other words: A partition can be (block size) * 2^32 bytes big ((block size) * 2^31 if signed ints is used as with file offsets...).

With files it is bit different. Here it's the byte offset being used restricting file sizes to 2^31 - 1 bytes (again signed math -- eeww! 8^)

-Tweek
One of the main causes of the fall of the Roman Empire was that, lacking zero, they had no way to indicate successful termination of their C programs
- Robert Firth
 

Offline PiR

Re: 64-bit AmigaDOS operations?
« Reply #8 on: February 04, 2004, 12:12:10 PM »
@Acill

Quote
but I was sure I could make it one large drive if I wanted to


Please don't want.
Remember that on startup all code to handle harddisks is being read from ROM, including trackdisk.device. This means that on the startup you have to use old one, that has 4GB drive limit. On OS startup this trackdisk.device is removed from the system and replaced with new trackdisk.device read from disk. From this time you have no 4GB limit.

BUT

FOR THIS REASON

PLEASE REMEMBER ABOUT 4GB LIMIT FOR YOR STARTUP PARTITION!

This involves both - size of the partition and the space it allocates on disk - ALL OF THE PARTINION MUST BE INSIDE LOWEST 4GB SPACE OF DISK.

Cheers
 

Offline Thomas

Re: 64-bit AmigaDOS operations?
« Reply #9 on: February 04, 2004, 03:24:47 PM »

Well, the 4GB limit as described above applies only to the internal IDE driver of the Amiga. If you have a third-party IDE controller like the Elbox FasATA or the Buddha Flash which allows to use 64bit commands without any patch, you can create one big partition on a HDD of any size up to 2TB (2'32 * 512).

Physical block size is still 512 bytes and AFAIK both IDE and SCSI refer to 512 bytes blocks by 32 bit block numbers, so 2TB is the physical limit until someone expands the SCSI norm.

Just for correctness, the IDE driver is called scsi.device, not trackdisk.device. OS3.5+ does not change anything on trackdisk.device, it replaces scsi.device.

So, in conclusion, if you boot from the internal IDE bus, your boot partition has to be smaller than 4GB and *it has to reside below the 4GB limit*. People usually don't see that the 4GB limit applies to the entire HDD, not only to partitions.

Bye,
Thomas

Offline Minuous

Re: 64-bit AmigaDOS operations?
« Reply #10 on: February 04, 2004, 11:15:20 PM »
Yes, sorry, it's scsi.device and not trackdisk.device of course...
 

Offline Minuous

Re: 64-bit AmigaDOS operations?
« Reply #11 on: February 06, 2004, 01:18:59 PM »
OK, SAS/C doesn't seem to support long longs, so I have ported the program to StormC 3.0.  All modules compile without errors/warnings, but it won't link, it says things like "Symbol _AllocVec is undefined", "Symbol _AllocAslRequestTags is undefined", etc. but only for some library calls, not for all of them.

This is a bit odd because the code compiled and linked fine under SAS/C. I am reasonably sure that I am using the right pragmas, etc.? So what else would be causing this problem? It was not mentioned in the section of the StormC manual about "Porting from SAS/C". Is there something obvious that I am overlooking?

How I determine what linker libraries are being linked in with the program? (I assume stormc.lib and amiga.lib are being inked, but there doesn't seem to be a way of checking and/or changing what linker libraries are included?) This wasn't explained in the manual either :-(

Thanks.

 

Offline Thomas

Re: 64-bit AmigaDOS operations?
« Reply #12 on: February 06, 2004, 02:20:49 PM »

Well, AllocVec is a library function which was introdused in version 2.0 of AmigaOS, so you probably use pragmas from OS1.3.

AllocAslRequestTags is not a library function at all but a stub program for AllocAslRequest. It is contained in amiga.lib so you should make sure you add amiga.lib to your library list.

IMHO you shouldn't use 64bit operations at all. These large data types cannot be output by printf or handled in any other meaningful way. I'd rather suggest to determine how many blocks fit into one kilobyte or one megabyte and output the free space in KB or MB. So for blocks of 512 byte you divide the number of blocks by 2 to get the kilobytes. Or for blocks of 1024 bytes you don't need to calculate at all.

Bye,
Thomas

Offline Piru

  • \' union select name,pwd--
  • Hero Member
  • *****
  • Join Date: Aug 2002
  • Posts: 6946
  • Total likes: 0
    • http://www.iki.fi/sintonen/
Re: 64-bit AmigaDOS operations?
« Reply #13 on: February 06, 2004, 03:00:40 PM »
Quote
These large data types cannot be output by printf or handled in any other meaningful way.

long long x = 10000000000000;
printf("%lld\n", x);

...works with any real compiler.

(Sidenote: MorphOS exec/RawDoFmt() supports "ll" and "L" for 64bit data aswell (and thus dos/Printf and friends). Also, the next release of MorphOS libnix supports 64bit formatting for printf and scanf family functions. ixemul supports 64-bit printf/scanf functions already, for AmigaOS too.)

Quote
I'd rather suggest to determine how many blocks fit into one kilobyte or one megabyte and output the free space in KB or MB.

That's a good suggestion. Usually this is enough.

Here is an example how to format such numbers: largefmt.c
 

Offline Minuous

Re: 64-bit AmigaDOS operations?
« Reply #14 on: February 07, 2004, 04:48:10 AM »
Yes, I thought amiga.lib might have something to do with it, that is why I was wondering how to check what is being linked in...now I know: you just use the 'Add library' menu item to add them. It was crashing before whenever I tried this. But I reinstalled StormC and it seemed to work, this has also fixed the other problem about the pragmas, I think I was using the NDK includes rather than those that are provided with StormC.

I'm not using any printf()-style functions for the 64-bit output, I've written a custom function which inserts thousands separators, etc. as necessary. And the user is already able to choose to view sizes in bytes, kilobytes, megabytes, or blocks.

Thanks to all those who have helped out...