Removal of u64.h
Change-Id: I895b530a44d80ffbab40466b360981d39b06e9a5
This commit is contained in:
parent
0c745990d9
commit
984a00592c
|
|
@ -27,7 +27,6 @@
|
|||
#include <minix/config.h>
|
||||
#include <minix/const.h>
|
||||
#include <minix/partition.h>
|
||||
#include <minix/u64.h>
|
||||
#include <minix/com.h>
|
||||
#include <machine/partition.h>
|
||||
#include <termios.h>
|
||||
|
|
@ -525,8 +524,8 @@ void geometry(void)
|
|||
if (ioctl(device, DIOCGETP, &geometry) < 0)
|
||||
err= errno;
|
||||
else {
|
||||
table[0].lowsec= div64u(geometry.base, SECTOR_SIZE);
|
||||
table[0].size= div64u(geometry.size, SECTOR_SIZE);
|
||||
table[0].lowsec= (unsigned long)(geometry.base / SECTOR_SIZE);
|
||||
table[0].size= (unsigned long)(geometry.size / SECTOR_SIZE);
|
||||
cylinders= geometry.cylinders;
|
||||
heads= geometry.heads;
|
||||
sectors= geometry.sectors;
|
||||
|
|
@ -578,8 +577,8 @@ exit(1);
|
|||
* This makes sense for subpartitioning primary partitions.
|
||||
*/
|
||||
if (precise && ioctl(device, DIOCGETP, &geometry) >= 0) {
|
||||
table[0].lowsec= div64u(geometry.base, SECTOR_SIZE);
|
||||
table[0].size= div64u(geometry.size, SECTOR_SIZE);
|
||||
table[0].lowsec= (unsigned long)(geometry.base / SECTOR_SIZE);
|
||||
table[0].size= (unsigned long)(geometry.size / SECTOR_SIZE);
|
||||
} else {
|
||||
precise= 0;
|
||||
}
|
||||
|
|
@ -2149,8 +2148,8 @@ sanitycheck_failed(char *dev, struct part_entry *pe)
|
|||
|
||||
close(fd);
|
||||
|
||||
it_lowsec = div64u(part.base, SECTOR_SIZE);
|
||||
it_secsize = div64u(part.size, SECTOR_SIZE);
|
||||
it_lowsec = (unsigned long)(part.base / SECTOR_SIZE);
|
||||
it_secsize = (unsigned long)(part.size / SECTOR_SIZE);
|
||||
|
||||
if(it_lowsec != pe->lowsec || it_secsize != pe->size) {
|
||||
fprintf(stderr, "\nReturned and set numbers don't match up!\n");
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@
|
|||
#include <fcntl.h>
|
||||
#include <sys/types.h>
|
||||
#include <minix/btrace.h>
|
||||
#include <minix/u64.h>
|
||||
#include <sys/ioc_block.h>
|
||||
|
||||
static btrace_entry buf[BTBUF_SIZE];
|
||||
|
|
@ -144,7 +143,8 @@ static void dump_entry(btrace_entry *entry)
|
|||
case BTREQ_GATHER:
|
||||
case BTREQ_SCATTER:
|
||||
printf("- position:\t%08lx%08lx\n",
|
||||
ex64hi(entry->position), ex64lo(entry->position));
|
||||
(unsigned long)(entry->position>>32),
|
||||
(unsigned long)(entry->position));
|
||||
printf("- size:\t\t%u\n", entry->size);
|
||||
printf("- flags:\t%x\n", entry->flags);
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <minix/ioctl.h>
|
||||
#include <minix/u64.h>
|
||||
#include <sys/ioc_fbd.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
|
|
@ -32,8 +31,8 @@ static int usage(char *name)
|
|||
static void print_rule(struct fbd_rule *rule)
|
||||
{
|
||||
printf("%-2d %04lX%08lX-%04lX%08lX %-4d %-5d %c%c ",
|
||||
rule->num, ex64hi(rule->start), ex64lo(rule->start),
|
||||
ex64hi(rule->end), ex64lo(rule->end), rule->skip,
|
||||
rule->num, (unsigned long)(rule->start>>32), (unsigned long)(rule->start),
|
||||
(unsigned long)(rule->end>>32), (unsigned long)(rule->end), rule->skip,
|
||||
rule->count, (rule->flags & FBD_FLAG_READ) ? 'r' : ' ',
|
||||
(rule->flags & FBD_FLAG_WRITE) ? 'w' : ' ');
|
||||
|
||||
|
|
@ -67,10 +66,10 @@ static void print_rule(struct fbd_rule *rule)
|
|||
|
||||
case FBD_ACTION_MISDIR:
|
||||
printf("%-7s %04lX%08lX-%04lX%08lX %u",
|
||||
"misdir", ex64hi(rule->params.misdir.start),
|
||||
ex64lo(rule->params.misdir.start),
|
||||
ex64hi(rule->params.misdir.end),
|
||||
ex64lo(rule->params.misdir.end),
|
||||
"misdir", (unsigned long)(rule->params.misdir.start>>32),
|
||||
(unsigned long)(rule->params.misdir.start),
|
||||
(unsigned long)(rule->params.misdir.end>>32),
|
||||
(unsigned long)(rule->params.misdir.end),
|
||||
rule->params.misdir.align);
|
||||
break;
|
||||
|
||||
|
|
@ -128,7 +127,7 @@ static int scan_hex64(char *input, u64_t *val)
|
|||
|
||||
lo = strtoul(input, NULL, 16);
|
||||
|
||||
*val = make64(lo, hi);
|
||||
*val = (u64_t)lo | ((u64_t)hi << 32);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,7 +46,6 @@
|
|||
#include <minix/config.h>
|
||||
#include <minix/const.h>
|
||||
#include <minix/type.h>
|
||||
#include <minix/u64.h>
|
||||
#include "mfs/const.h"
|
||||
#include "mfs/inode.h"
|
||||
#include "mfs/type.h"
|
||||
|
|
@ -97,7 +96,7 @@ static struct super_block sb;
|
|||
* btoa64 gives the byte address of a block
|
||||
*/
|
||||
#define ztob(z) ((block_nr) (z) << sb.s_log_zone_size)
|
||||
#define btoa64(b) (mul64u(b, block_size))
|
||||
#define btoa64(b) ((u64_t)(b) * block_size)
|
||||
#define SCALE ((int) ztob(1)) /* # blocks in a zone */
|
||||
#define FIRST ((zone_nr) sb.s_firstdatazone) /* as the name says */
|
||||
|
||||
|
|
@ -656,12 +655,12 @@ void chksuper()
|
|||
|
||||
int inoblock(int inn)
|
||||
{
|
||||
return div64u(mul64u(inn - 1, INODE_SIZE), block_size) + BLK_ILIST;
|
||||
return (unsigned long)(((u64_t)(inn - 1) * INODE_SIZE) / block_size) + BLK_ILIST;
|
||||
}
|
||||
|
||||
int inooff(int inn)
|
||||
{
|
||||
return rem64u(mul64u(inn - 1, INODE_SIZE), block_size);
|
||||
return (unsigned)(((u64_t)(inn - 1) * INODE_SIZE) % block_size);
|
||||
}
|
||||
|
||||
/* Make a listing of the inodes given by `clist'. If `repair' is set, ask
|
||||
|
|
|
|||
|
|
@ -22,7 +22,6 @@
|
|||
#include <minix/config.h>
|
||||
#include <minix/const.h>
|
||||
#include <minix/partition.h>
|
||||
#include <minix/u64.h>
|
||||
#include <machine/partition.h>
|
||||
#include <termios.h>
|
||||
|
||||
|
|
@ -477,8 +476,8 @@ void geometry(void)
|
|||
if (ioctl(device, DIOCGETP, &geometry) < 0)
|
||||
err= errno;
|
||||
else {
|
||||
table[0].lowsec= div64u(geometry.base, SECTOR_SIZE);
|
||||
table[0].size= div64u(geometry.size, SECTOR_SIZE);
|
||||
table[0].lowsec= (unsigned long)(geometry.base / SECTOR_SIZE);
|
||||
table[0].size= (unsigned long)(geometry.size / SECTOR_SIZE);
|
||||
cylinders= geometry.cylinders;
|
||||
heads= geometry.heads;
|
||||
sectors= geometry.sectors;
|
||||
|
|
@ -546,8 +545,8 @@ void geometry(void)
|
|||
* This makes sense for subpartitioning primary partitions.
|
||||
*/
|
||||
if (precise && ioctl(device, DIOCGETP, &geometry) >= 0) {
|
||||
table[0].lowsec= div64u(geometry.base, SECTOR_SIZE);
|
||||
table[0].size= div64u(geometry.size, SECTOR_SIZE);
|
||||
table[0].lowsec= (unsigned long)(geometry.base / SECTOR_SIZE);
|
||||
table[0].size= (unsigned long)(geometry.size / SECTOR_SIZE);
|
||||
} else {
|
||||
precise= 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,7 +20,6 @@
|
|||
#include <minix/config.h>
|
||||
#include <minix/const.h>
|
||||
#include <minix/partition.h>
|
||||
#include <minix/u64.h>
|
||||
#else
|
||||
#include "partition.h"
|
||||
#define NR_PARTITIONS 4
|
||||
|
|
@ -322,8 +321,8 @@ void geometry(void)
|
|||
geometry.cylinders= (sb.st_size-1)/SECTOR_SIZE/
|
||||
(geometry.sectors*geometry.heads) + 1;
|
||||
}
|
||||
primary.lowsec= div64u(geometry.base, SECTOR_SIZE);
|
||||
primary.size= div64u(geometry.size, SECTOR_SIZE);
|
||||
primary.lowsec= (unsigned long)(geometry.base / SECTOR_SIZE);
|
||||
primary.size= (unsigned long)(geometry.size / SECTOR_SIZE);
|
||||
cylinders= geometry.cylinders;
|
||||
heads= geometry.heads;
|
||||
sectors= geometry.sectors;
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@
|
|||
#include <unistd.h>
|
||||
#include <sys/wait.h>
|
||||
#include <minix/minlib.h>
|
||||
// #include <minix/u64.h>
|
||||
#include <stdio.h>
|
||||
|
||||
/* -DNEW prints time to 0.01 sec. */
|
||||
|
|
|
|||
|
|
@ -27,7 +27,6 @@
|
|||
#include <sys/ioctl.h>
|
||||
#include <sys/mtio.h>
|
||||
#include <minix/partition.h>
|
||||
#include <minix/u64.h>
|
||||
|
||||
/* Preferred block size to variable block length tapes, block devices or files.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -169,7 +169,7 @@ fb_do_read(endpoint_t ep, iovec_t *iov, int minor, u64_t pos, size_t *io_bytes)
|
|||
}
|
||||
|
||||
return sys_safecopyto(ep, (cp_grant_id_t) iov->iov_addr, 0,
|
||||
(vir_bytes) (dev.dv_base + ex64lo(pos)),
|
||||
(vir_bytes) (dev.dv_base + (unsigned long)(pos)),
|
||||
*io_bytes);
|
||||
}
|
||||
|
||||
|
|
@ -296,8 +296,8 @@ fb_do_write(endpoint_t ep, iovec_t *iov, int minor, u64_t pos, size_t *io_bytes)
|
|||
}
|
||||
|
||||
return sys_safecopyfrom(ep, (cp_grant_id_t) iov->iov_addr, 0,
|
||||
(vir_bytes) (dev.dv_base + ex64lo(pos)),
|
||||
*io_bytes);
|
||||
(vir_bytes) (dev.dv_base + (unsigned long)(pos)),
|
||||
*io_bytes);
|
||||
}
|
||||
|
||||
static int
|
||||
|
|
|
|||
|
|
@ -58,9 +58,9 @@ static size_t get_range(struct fbd_rule *rule, u64_t pos, size_t *size,
|
|||
|
||||
delta = rule->start - pos;
|
||||
|
||||
assert(ex64hi(delta) == 0);
|
||||
assert((unsigned long)(delta>>32) == 0);
|
||||
|
||||
off = ex64lo(delta);
|
||||
off = (unsigned long)(delta);
|
||||
}
|
||||
|
||||
if (!to_eof) {
|
||||
|
|
@ -69,7 +69,7 @@ static size_t get_range(struct fbd_rule *rule, u64_t pos, size_t *size,
|
|||
delta = rule->end - pos;
|
||||
|
||||
if (delta < *size)
|
||||
*size = ex64lo(delta);
|
||||
*size = (unsigned long)(delta);
|
||||
}
|
||||
|
||||
assert(*size > off);
|
||||
|
|
@ -121,11 +121,11 @@ static void action_io_corrupt(struct fbd_rule *rule, char *buf, size_t size,
|
|||
/* Non-dword-aligned positions and sizes are not supported;
|
||||
* not by us, and not by the driver.
|
||||
*/
|
||||
if (ex64lo(pos) & (sizeof(val) - 1)) break;
|
||||
if ((unsigned long)(pos) & (sizeof(val) - 1)) break;
|
||||
if (size & (sizeof(val) - 1)) break;
|
||||
|
||||
/* Consistently produce the same pattern for the same range. */
|
||||
val = ex64lo(skip);
|
||||
val = (unsigned long)(skip);
|
||||
|
||||
for ( ; size >= sizeof(val); size -= sizeof(val)) {
|
||||
*((u32_t *) buf) = val ^ 0xdeadbeefUL;
|
||||
|
|
|
|||
|
|
@ -264,8 +264,8 @@ static ssize_t fbd_transfer_direct(int do_write, u64_t position,
|
|||
m.BDEV_GRANT = grant;
|
||||
m.BDEV_FLAGS = flags;
|
||||
m.BDEV_ID = 0;
|
||||
m.BDEV_POS_LO = ex64lo(position);
|
||||
m.BDEV_POS_HI = ex64hi(position);
|
||||
m.BDEV_POS_LO = (unsigned long)(position);
|
||||
m.BDEV_POS_HI = (unsigned long)(position>>32);
|
||||
|
||||
if ((r = sendrec(driver_endpt, &m)) != OK)
|
||||
panic("sendrec to driver failed (%d)\n", r);
|
||||
|
|
@ -357,8 +357,8 @@ static ssize_t fbd_transfer_copy(int do_write, u64_t position,
|
|||
m.BDEV_GRANT = grant;
|
||||
m.BDEV_FLAGS = flags;
|
||||
m.BDEV_ID = 0;
|
||||
m.BDEV_POS_LO = ex64lo(position);
|
||||
m.BDEV_POS_HI = ex64hi(position);
|
||||
m.BDEV_POS_LO = (unsigned long)(position);
|
||||
m.BDEV_POS_HI = (unsigned long)(position>>32);
|
||||
|
||||
if ((r = sendrec(driver_endpt, &m)) != OK)
|
||||
panic("sendrec to driver failed (%d)\n", r);
|
||||
|
|
|
|||
|
|
@ -92,8 +92,8 @@ static int rule_match(struct fbd_rule *rule, u64_t pos, size_t size, int flag)
|
|||
*/
|
||||
|
||||
/* Ranges must overlap (start < pos+size && end > pos). */
|
||||
if (cmp64(rule->start, pos + size) >= 0 ||
|
||||
(cmp64u(rule->end, 0) && cmp64(rule->end, pos) <= 0))
|
||||
if (rule->start >= (pos + size) ||
|
||||
(rule->end != 0 && rule->end <= pos))
|
||||
return FALSE;
|
||||
|
||||
/* Flags must match. */
|
||||
|
|
|
|||
|
|
@ -918,8 +918,8 @@ int read_write(u64_t pos, char *bufa, char *bufb, size_t *sizep, int request)
|
|||
memset(&m1, 0, sizeof(m1));
|
||||
m1.m_type = (request == FLT_WRITE) ? BDEV_SCATTER : BDEV_GATHER;
|
||||
m1.BDEV_COUNT = count;
|
||||
m1.BDEV_POS_LO = ex64lo(pos);
|
||||
m1.BDEV_POS_HI = ex64hi(pos);
|
||||
m1.BDEV_POS_LO = (unsigned long)(pos);
|
||||
m1.BDEV_POS_HI = (unsigned long)(pos>>32);
|
||||
|
||||
m2 = m1;
|
||||
|
||||
|
|
|
|||
|
|
@ -136,10 +136,10 @@ static int do_rdwt(int flag_rw)
|
|||
u64_t pos;
|
||||
int r;
|
||||
|
||||
pos = make64(m_in.BDEV_POS_LO, m_in.BDEV_POS_HI);
|
||||
pos = (u64_t)m_in.BDEV_POS_LO | ((u64_t)m_in.BDEV_POS_HI<<32);
|
||||
size = m_in.BDEV_COUNT;
|
||||
|
||||
if (rem64u(pos, SECTOR_SIZE) != 0 || size % SECTOR_SIZE != 0) {
|
||||
if ((unsigned)(pos % SECTOR_SIZE) != 0 || size % SECTOR_SIZE != 0) {
|
||||
printf("Filter: unaligned request from caller!\n");
|
||||
|
||||
return EINVAL;
|
||||
|
|
@ -194,11 +194,11 @@ static int do_vrdwt(int flag_rw)
|
|||
panic("copying in grant vector failed: %d", r);
|
||||
}
|
||||
|
||||
pos = make64(m_in.BDEV_POS_LO, m_in.BDEV_POS_HI);
|
||||
pos = (u64_t)m_in.BDEV_POS_LO | ((u64_t)m_in.BDEV_POS_HI<<32);
|
||||
for(size = 0, i = 0; i < grants; i++)
|
||||
size += iov_proc[i].iov_size;
|
||||
|
||||
if (rem64u(pos, SECTOR_SIZE) != 0 || size % SECTOR_SIZE != 0) {
|
||||
if ((unsigned)(pos % SECTOR_SIZE) != 0 || size % SECTOR_SIZE != 0) {
|
||||
printf("Filter: unaligned request from caller!\n");
|
||||
return EINVAL;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,8 +8,8 @@
|
|||
#define SEC2SUM_NR(nr) ((nr)/NR_SUM_SEC*(NR_SUM_SEC+1) + NR_SUM_SEC)
|
||||
#define LOG2PHYS(nr) ((nr)/NR_SUM_SEC*(NR_SUM_SEC+1) + (nr)%NR_SUM_SEC)
|
||||
|
||||
#define POS2SEC(nr) div64u((nr), SECTOR_SIZE)
|
||||
#define SEC2POS(nr) mul64u((nr), SECTOR_SIZE)
|
||||
#define POS2SEC(nr) (unsigned long)((nr) / SECTOR_SIZE)
|
||||
#define SEC2POS(nr) (unsigned long)((nr) / SECTOR_SIZE)
|
||||
|
||||
/* Data buffers. */
|
||||
static char *ext_array, *ext_buffer; /* interspersed buffer */
|
||||
|
|
@ -543,7 +543,8 @@ int transfer(u64_t pos, char *buffer, size_t *sizep, int flag_rw)
|
|||
|
||||
#if DEBUG2
|
||||
printf("Filter: transfer: pos 0x%lx:0x%lx -> phys_pos 0x%lx:0x%lx\n",
|
||||
ex64hi(pos), ex64lo(pos), ex64hi(phys_pos), ex64lo(phys_pos));
|
||||
(unsigned long)(pos>>32), (unsigned long)(pos),
|
||||
(unsigned long)(phys_pos>>32), (unsigned long)(phys_pos));
|
||||
#endif
|
||||
|
||||
/* Compute the size for the buffer and for the user data after
|
||||
|
|
|
|||
|
|
@ -410,8 +410,8 @@ static struct device *f_prepare(dev_t device)
|
|||
if (f_fp->fl_density < NT) {
|
||||
f_dp = &fdensity[f_fp->fl_density];
|
||||
f_sectors = f_dp->secpt;
|
||||
f_fp->fl_geom.dv_size = mul64u((long) (NR_HEADS * f_sectors
|
||||
* f_dp->cyls), SECTOR_SIZE);
|
||||
f_fp->fl_geom.dv_size = (u64_t)(NR_HEADS * f_sectors
|
||||
* f_dp->cyls) * SECTOR_SIZE;
|
||||
}
|
||||
|
||||
/* A partition? */
|
||||
|
|
@ -474,7 +474,7 @@ static ssize_t f_transfer(
|
|||
fp = f_fp;
|
||||
dv_size = f_dv->dv_size;
|
||||
|
||||
if (ex64hi(pos64) != 0)
|
||||
if ((unsigned long)(pos64>>32) != 0)
|
||||
return OK; /* Way beyond EOF */
|
||||
position= pos64;
|
||||
total = 0;
|
||||
|
|
@ -500,7 +500,7 @@ static ssize_t f_transfer(
|
|||
/* Which block on disk and how close to EOF? */
|
||||
if (position >= dv_size) return(total); /* At EOF */
|
||||
if (position + nbytes > dv_size) nbytes = dv_size - position;
|
||||
block = div64u(f_dv->dv_base + position, SECTOR_SIZE);
|
||||
block = (unsigned long)((f_dv->dv_base + position) / SECTOR_SIZE);
|
||||
|
||||
if ((nbytes & SECTOR_MASK) != 0) return(EINVAL);
|
||||
|
||||
|
|
|
|||
|
|
@ -56,8 +56,8 @@ static int hello_close(message *UNUSED(m))
|
|||
|
||||
static struct device * hello_prepare(dev_t UNUSED(dev))
|
||||
{
|
||||
hello_device.dv_base = make64(0, 0);
|
||||
hello_device.dv_size = make64(strlen(HELLO_MESSAGE), 0);
|
||||
hello_device.dv_base = (u64_t)0;
|
||||
hello_device.dv_size = (u64_t)(strlen(HELLO_MESSAGE));
|
||||
return &hello_device;
|
||||
}
|
||||
|
||||
|
|
@ -75,8 +75,8 @@ static int hello_transfer(endpoint_t endpt, int opcode, u64_t position,
|
|||
printf("HELLO: vectored transfer request, using first element only\n");
|
||||
}
|
||||
|
||||
bytes = strlen(HELLO_MESSAGE) - ex64lo(position) < iov->iov_size ?
|
||||
strlen(HELLO_MESSAGE) - ex64lo(position) : iov->iov_size;
|
||||
bytes = strlen(HELLO_MESSAGE) - (unsigned long)(position) < iov->iov_size ?
|
||||
strlen(HELLO_MESSAGE) - (unsigned long)(position) : iov->iov_size;
|
||||
|
||||
if (bytes <= 0)
|
||||
{
|
||||
|
|
@ -86,8 +86,8 @@ static int hello_transfer(endpoint_t endpt, int opcode, u64_t position,
|
|||
{
|
||||
case DEV_GATHER_S:
|
||||
ret = sys_safecopyto(endpt, (cp_grant_id_t) iov->iov_addr, 0,
|
||||
(vir_bytes) (HELLO_MESSAGE + ex64lo(position)),
|
||||
bytes);
|
||||
(vir_bytes) (HELLO_MESSAGE + (unsigned long)(position)),
|
||||
bytes);
|
||||
iov->iov_size -= bytes;
|
||||
break;
|
||||
|
||||
|
|
|
|||
|
|
@ -357,8 +357,8 @@ struct device *
|
|||
i2c_prepare(dev_t dev)
|
||||
{
|
||||
/* NOP */
|
||||
i2c_device.dv_base = make64(0, 0);
|
||||
i2c_device.dv_size = make64(0, 0);
|
||||
i2c_device.dv_base = (u64_t)0;
|
||||
i2c_device.dv_size = (u64_t)0;
|
||||
|
||||
return &i2c_device;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -238,7 +238,7 @@ static int m_transfer(
|
|||
vir_bytes dev_vaddr;
|
||||
|
||||
/* ZERO_DEV and NULL_DEV are infinite in size. */
|
||||
if (m_device != ZERO_DEV && m_device != NULL_DEV && ex64hi(pos64) != 0)
|
||||
if (m_device != ZERO_DEV && m_device != NULL_DEV && (unsigned long)(pos64>>32) != 0)
|
||||
return OK; /* Beyond EOF */
|
||||
position= pos64;
|
||||
|
||||
|
|
@ -447,7 +447,7 @@ static int m_block_transfer(
|
|||
dv_size = dv->dv_size;
|
||||
dev_vaddr = m_vaddrs[minor];
|
||||
|
||||
if (ex64hi(pos64) != 0)
|
||||
if ((unsigned long)(pos64>>32) != 0)
|
||||
return OK; /* Beyond EOF */
|
||||
position= pos64;
|
||||
|
||||
|
|
@ -554,7 +554,7 @@ static int m_block_ioctl(dev_t minor, unsigned int request, endpoint_t endpt,
|
|||
return s;
|
||||
if(is_imgrd)
|
||||
ramdev_size = 0;
|
||||
if(m_vaddrs[minor] && !cmp64(dv->dv_size, ((u64_t)(ramdev_size)))) {
|
||||
if(m_vaddrs[minor] && dv->dv_size == (u64_t)(ramdev_size)) {
|
||||
return(OK);
|
||||
}
|
||||
/* openct is 1 for the ioctl(). */
|
||||
|
|
@ -567,7 +567,7 @@ static int m_block_ioctl(dev_t minor, unsigned int request, endpoint_t endpt,
|
|||
u32_t a, o;
|
||||
u64_t size;
|
||||
int r;
|
||||
if(ex64hi(dv->dv_size)) {
|
||||
if((unsigned long)(dv->dv_size>>32)) {
|
||||
panic("huge old ramdisk");
|
||||
}
|
||||
size = dv->dv_size;
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ INCS+= acpi.h audio_fw.h bitmap.h \
|
|||
reboot.h rs.h safecopies.h sched.h sef.h sffs.h \
|
||||
sound.h spin.h sys_config.h sysinfo.h \
|
||||
syslib.h sysutil.h termios.h timers.h type.h \
|
||||
tty.h u64.h usb.h usb_ch9.h vbox.h \
|
||||
tty.h usb.h usb_ch9.h vbox.h \
|
||||
vboxfs.h vboxif.h vboxtype.h vm.h \
|
||||
vfsif.h vtreefs.h libminixfs.h netsock.h \
|
||||
virtio.h
|
||||
|
|
|
|||
|
|
@ -23,7 +23,6 @@
|
|||
#include <stddef.h>
|
||||
#include <errno.h>
|
||||
#include <sys/param.h>
|
||||
#include <minix/u64.h>
|
||||
#include <minix/partition.h>
|
||||
|
||||
/* Base and size of a partition in bytes. */
|
||||
|
|
|
|||
|
|
@ -32,11 +32,11 @@
|
|||
c ^= b; c -= hash_rot(b,24); \
|
||||
}
|
||||
|
||||
#define hash_i_64(a, u, v) { \
|
||||
u32_t i1 = (a), i2 = ex64lo(u), i3 = ex64hi(u); \
|
||||
hash_mix(i1, i2, i3); \
|
||||
hash_final(i1, i2, i3); \
|
||||
(v) = i3; \
|
||||
#define hash_i_64(a, u, v) { \
|
||||
u32_t i1 = (a), i2 = (unsigned long)(u), i3 = (unsigned long)(u>>32); \
|
||||
hash_mix(i1, i2, i3); \
|
||||
hash_final(i1, i2, i3); \
|
||||
(v) = i3; \
|
||||
}
|
||||
|
||||
#define hash_32(n, v) { \
|
||||
|
|
|
|||
|
|
@ -8,8 +8,6 @@
|
|||
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <minix/u64.h>
|
||||
|
||||
int minix_sizeup(char *name, u64_t *bytes);
|
||||
|
||||
struct part_geom {
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@
|
|||
|
||||
#include <sys/types.h>
|
||||
#include <sys/time.h>
|
||||
#include <minix/u64.h>
|
||||
|
||||
typedef void *sffs_file_t; /* handle to open file */
|
||||
typedef void *sffs_dir_t; /* handle to directory search */
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@
|
|||
#include <sys/sigtypes.h>
|
||||
|
||||
#include <minix/ipc.h>
|
||||
#include <minix/u64.h>
|
||||
#include <minix/devio.h>
|
||||
|
||||
#include <minix/safecopies.h>
|
||||
|
|
|
|||
|
|
@ -1,131 +0,0 @@
|
|||
/* minix/u64.h Author: Kees J. Bot
|
||||
* 7 Dec 1995
|
||||
* Functions to manipulate 64 bit disk addresses.
|
||||
*/
|
||||
#ifndef _MINIX__U64_H
|
||||
#define _MINIX__U64_H
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <limits.h>
|
||||
|
||||
static inline int bsr64(u64_t i)
|
||||
{
|
||||
int index;
|
||||
u64_t mask;
|
||||
|
||||
for (index = 63, mask = 1ULL << 63; index >= 0; --index, mask >>= 1) {
|
||||
if (i & mask)
|
||||
return index;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
static inline int cmp64(u64_t i, u64_t j)
|
||||
{
|
||||
if (i > j)
|
||||
return 1;
|
||||
else if (i < j)
|
||||
return -1;
|
||||
else /* (i == j) */
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int cmp64u(u64_t i, unsigned j)
|
||||
{
|
||||
if (i > j)
|
||||
return 1;
|
||||
else if (i < j)
|
||||
return -1;
|
||||
else /* (i == j) */
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int cmp64ul(u64_t i, unsigned long j)
|
||||
{
|
||||
if (i > j)
|
||||
return 1;
|
||||
else if (i < j)
|
||||
return -1;
|
||||
else /* (i == j) */
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline unsigned diff64(u64_t i, u64_t j)
|
||||
{
|
||||
return (unsigned)(i - j);
|
||||
}
|
||||
|
||||
static inline u64_t div64(u64_t i, u64_t j)
|
||||
{
|
||||
return i / j;
|
||||
}
|
||||
|
||||
static inline u64_t rem64(u64_t i, u64_t j)
|
||||
{
|
||||
return i % j;
|
||||
}
|
||||
|
||||
static inline unsigned long div64u(u64_t i, unsigned j)
|
||||
{
|
||||
return (unsigned long)(i / j);
|
||||
}
|
||||
|
||||
static inline u64_t div64u64(u64_t i, unsigned j)
|
||||
{
|
||||
return i / j;
|
||||
}
|
||||
|
||||
static inline unsigned rem64u(u64_t i, unsigned j)
|
||||
{
|
||||
return (unsigned)(i % j);
|
||||
}
|
||||
|
||||
static inline unsigned long ex64lo(u64_t i)
|
||||
{
|
||||
return (unsigned long)i;
|
||||
}
|
||||
|
||||
static inline unsigned long ex64hi(u64_t i)
|
||||
{
|
||||
return (unsigned long)(i>>32);
|
||||
}
|
||||
|
||||
static inline u64_t make64(unsigned long lo, unsigned long hi)
|
||||
{
|
||||
return ((u64_t)hi << 32) | (u64_t)lo;
|
||||
}
|
||||
|
||||
static inline u64_t mul64(u64_t i, u64_t j)
|
||||
{
|
||||
return i * j;
|
||||
}
|
||||
|
||||
static inline u64_t mul64u(unsigned long i, unsigned j)
|
||||
{
|
||||
return (u64_t)i * j;
|
||||
}
|
||||
|
||||
static inline u64_t sub64(u64_t i, u64_t j)
|
||||
{
|
||||
return i - j;
|
||||
}
|
||||
|
||||
static inline u64_t sub64u(u64_t i, unsigned j)
|
||||
{
|
||||
return i - j;
|
||||
}
|
||||
|
||||
static inline u64_t sub64ul(u64_t i, unsigned long j)
|
||||
{
|
||||
return i - j;
|
||||
}
|
||||
|
||||
u64_t rrotate64(u64_t x, unsigned short b);
|
||||
u64_t rshift64(u64_t x, unsigned short b);
|
||||
u64_t xor64(u64_t a, u64_t b);
|
||||
u64_t and64(u64_t a, u64_t b);
|
||||
u64_t not64(u64_t a);
|
||||
|
||||
#endif /* _MINIX__U64_H */
|
||||
|
|
@ -18,7 +18,6 @@
|
|||
#include <limits.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <minix/u64.h>
|
||||
#include <minix/minlib.h>
|
||||
#include <minix/endpoint.h>
|
||||
|
||||
|
|
@ -64,17 +63,17 @@ clock_t tmrs_settimer(timer_t **tmrs, timer_t *tp, clock_t exp_time,
|
|||
tmr_func_t watchdog, clock_t *new_head);
|
||||
|
||||
#define PRINT_STATS(cum_spenttime, cum_instances) { \
|
||||
if(ex64hi(cum_spenttime)) { util_stacktrace(); printf(" ( ??? %lu %lu)\n", \
|
||||
ex64hi(cum_spenttime), ex64lo(cum_spenttime)); } \
|
||||
if((unsigned long)(cum_spenttime>>32)) { util_stacktrace(); printf(" ( ??? %lu %lu)\n", \
|
||||
(unsigned long)(cum_spenttime>>32), (unsigned long)(cum_spenttime)); } \
|
||||
printf("%s:%d,%lu,%lu\n", \
|
||||
__FILE__, __LINE__, cum_instances, \
|
||||
ex64lo(cum_spenttime)); \
|
||||
(unsigned long)(cum_spenttime)); \
|
||||
}
|
||||
|
||||
#define RESET_STATS(starttime, cum_instances, cum_spenttime, cum_starttime) { \
|
||||
cum_instances = 0; \
|
||||
cum_starttime = starttime; \
|
||||
cum_spenttime = make64(0,0); \
|
||||
cum_spenttime = (u64_t)0; \
|
||||
}
|
||||
|
||||
#define TIME_BLOCK_VAR(timed_code_block, time_interval) do { \
|
||||
|
|
@ -85,21 +84,21 @@ clock_t tmrs_settimer(timer_t **tmrs, timer_t *tp, clock_t exp_time,
|
|||
read_tsc_64(&_starttime); \
|
||||
do { timed_code_block } while(0); \
|
||||
read_tsc_64(&_endtime); \
|
||||
_dt = sub64(_endtime, _starttime); \
|
||||
_dt = _endtime - _starttime; \
|
||||
if(_cum_instances == 0) { \
|
||||
RESET_STATS(_starttime, _cum_instances, _cum_spenttime, _cum_starttime); \
|
||||
} \
|
||||
_next_cum_spent = _cum_spenttime + _dt; \
|
||||
if(ex64hi(_next_cum_spent)) { \
|
||||
if((unsigned long)(_next_cum_spent>>32)) { \
|
||||
PRINT_STATS(_cum_spenttime, _cum_instances); \
|
||||
RESET_STATS(_starttime, _cum_instances, _cum_spenttime, _cum_starttime); \
|
||||
} \
|
||||
_cum_spenttime += _dt; \
|
||||
_cum_instances++; \
|
||||
_cum_dt = sub64(_endtime, _cum_starttime); \
|
||||
if(cmp64(_cum_dt, make64(0, 120)) > 0) { \
|
||||
_cum_dt = _endtime - _cum_starttime; \
|
||||
if(_cum_dt > ((u64_t)120<<32) { \
|
||||
PRINT_STATS(_cum_spenttime, _cum_instances); \
|
||||
RESET_STATS(_starttime, _cum_instances, _cum_spenttime, _cum_starttime); \
|
||||
RESET_STATS(_starttime, _cum_instances, _cum_spenttime, _cum_starttime); \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@
|
|||
#include "kernel/clock.h"
|
||||
#include "kernel/proc.h"
|
||||
#include "kernel/interrupt.h"
|
||||
#include <minix/u64.h>
|
||||
#include "kernel/glo.h"
|
||||
#include "kernel/profile.h"
|
||||
|
||||
|
|
@ -126,12 +125,12 @@ int register_local_timer_handler(const irq_handler_t handler)
|
|||
|
||||
u64_t ms_2_cpu_time(unsigned ms)
|
||||
{
|
||||
return mul64u(tsc_per_ms[cpuid], ms);
|
||||
return (u64_t)tsc_per_ms[cpuid] * ms;
|
||||
}
|
||||
|
||||
unsigned cpu_time_2_ms(u64_t cpu_time)
|
||||
{
|
||||
return div64u(cpu_time, tsc_per_ms[cpuid]);
|
||||
return (unsigned long)(cpu_time / tsc_per_ms[cpuid]);
|
||||
}
|
||||
|
||||
short cpu_load(void)
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@
|
|||
#include <io.h>
|
||||
|
||||
#include <minix/reboot.h>
|
||||
#include <minix/u64.h>
|
||||
|
||||
#include "archconst.h"
|
||||
#include "arch_proto.h"
|
||||
|
|
|
|||
|
|
@ -10,8 +10,6 @@
|
|||
#include <signal.h>
|
||||
#include <machine/vm.h>
|
||||
|
||||
#include <minix/u64.h>
|
||||
|
||||
#include "archconst.h"
|
||||
#include "arch_proto.h"
|
||||
#include "serial.h"
|
||||
|
|
|
|||
|
|
@ -12,8 +12,6 @@
|
|||
|
||||
#include "arch_proto.h"
|
||||
|
||||
#include <minix/u64.h>
|
||||
|
||||
#include "apic.h"
|
||||
#include "apic_asm.h"
|
||||
#include "kernel/clock.h"
|
||||
|
|
@ -515,14 +513,14 @@ static void apic_calibrate_clocks(unsigned cpu)
|
|||
rm_irq_handler(&spurious_irq);
|
||||
|
||||
lapic_delta = lapic_tctr0 - lapic_tctr1;
|
||||
tsc_delta = sub64(tsc1, tsc0);
|
||||
tsc_delta = tsc1 - tsc0;
|
||||
|
||||
lapic_bus_freq[cpuid] = system_hz * lapic_delta / (PROBE_TICKS - 1);
|
||||
BOOT_VERBOSE(printf("APIC bus freq %u MHz\n",
|
||||
lapic_bus_freq[cpuid] / 1000000));
|
||||
cpu_freq = mul64(div64u64(tsc_delta, PROBE_TICKS - 1), make64(system_hz, 0));
|
||||
cpu_freq = (tsc_delta / (PROBE_TICKS - 1)) * (u64_t)(system_hz);
|
||||
cpu_set_freq(cpuid, cpu_freq);
|
||||
cpu_info[cpuid].freq = div64u(cpu_freq, 1000000);
|
||||
cpu_info[cpuid].freq = (unsigned long)(cpu_freq / 1000000);
|
||||
BOOT_VERBOSE(cpu_print_freq(cpuid));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@
|
|||
|
||||
#include "kernel/clock.h"
|
||||
#include "kernel/interrupt.h"
|
||||
#include <minix/u64.h>
|
||||
#include "glo.h"
|
||||
#include "kernel/profile.h"
|
||||
|
||||
|
|
@ -287,9 +286,9 @@ void context_stop(struct proc * p)
|
|||
p->p_cpu_time_left = 0;
|
||||
#else
|
||||
/* if (tsc_delta < p->p_cpu_time_left) in 64bit */
|
||||
if (ex64hi(tsc_delta) < ex64hi(p->p_cpu_time_left) ||
|
||||
(ex64hi(tsc_delta) == ex64hi(p->p_cpu_time_left) &&
|
||||
ex64lo(tsc_delta) < ex64lo(p->p_cpu_time_left)))
|
||||
if ((unsigned long)(tsc_delta>>32) < (unsigned long)(p->p_cpu_time_left>>32) ||
|
||||
((unsigned long)(tsc_delta>>32) == (unsigned long)(p->p_cpu_time_left>>32) &&
|
||||
(unsigned long)(tsc_delta) < (unsigned long)(p->p_cpu_time_left)))
|
||||
p->p_cpu_time_left = p->p_cpu_time_left - tsc_delta;
|
||||
else {
|
||||
p->p_cpu_time_left = 0;
|
||||
|
|
@ -362,7 +361,7 @@ short cpu_load(void)
|
|||
|
||||
busy = tsc_delta - idle_delta;
|
||||
busy = busy * 100;
|
||||
load = ex64lo(busy / tsc_delta);
|
||||
load = (unsigned long)(busy / tsc_delta);
|
||||
|
||||
if (load > 100)
|
||||
load = 100;
|
||||
|
|
|
|||
|
|
@ -13,8 +13,6 @@
|
|||
#include <signal.h>
|
||||
#include <machine/vm.h>
|
||||
|
||||
#include <minix/u64.h>
|
||||
|
||||
#include "archconst.h"
|
||||
#include "arch_proto.h"
|
||||
#include "serial.h"
|
||||
|
|
|
|||
|
|
@ -14,8 +14,6 @@
|
|||
#include <signal.h>
|
||||
#include <machine/vm.h>
|
||||
|
||||
#include <minix/u64.h>
|
||||
|
||||
#include "archconst.h"
|
||||
#include "arch_proto.h"
|
||||
#include "serial.h"
|
||||
|
|
@ -347,10 +345,10 @@ static void dump_bkl_usage(void)
|
|||
printf("--- BKL usage ---\n");
|
||||
for (cpu = 0; cpu < ncpus; cpu++) {
|
||||
printf("cpu %3d kernel ticks 0x%x%08x bkl ticks 0x%x%08x succ %d tries %d\n", cpu,
|
||||
ex64hi(kernel_ticks[cpu]),
|
||||
ex64lo(kernel_ticks[cpu]),
|
||||
ex64hi(bkl_ticks[cpu]),
|
||||
ex64lo(bkl_ticks[cpu]),
|
||||
(unsigned long)(kernel_ticks[cpu]>>32),
|
||||
(unsigned long)(kernel_ticks[cpu]),
|
||||
(unsigned long)(bkl_ticks[cpu]>>32),
|
||||
(unsigned long)(bkl_ticks[cpu]),
|
||||
bkl_succ[cpu], bkl_tries[cpu]);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
#include "arch_proto.h"
|
||||
#include "glo.h"
|
||||
#include <minix/minlib.h>
|
||||
#include <minix/u64.h>
|
||||
|
||||
#include "apic.h"
|
||||
|
||||
|
|
@ -32,12 +31,12 @@ static void intel_arch_watchdog_init(const unsigned cpu)
|
|||
* lowest 31 bits writable :(
|
||||
*/
|
||||
cpuf = cpu_get_freq(cpu);
|
||||
while (ex64hi(cpuf) || ex64lo(cpuf) > 0x7fffffffU)
|
||||
cpuf = div64u64(cpuf, 2);
|
||||
cpuf = make64(-ex64lo(cpuf), ex64hi(cpuf));
|
||||
while ((unsigned long)(cpuf>>32) || (unsigned long)(cpuf) > 0x7fffffffU)
|
||||
cpuf /= 2;
|
||||
cpuf = (u64_t)(-(unsigned long)(cpuf)) | ((u64_t)((unsigned long)(cpuf>>32))<<32);
|
||||
watchdog->resetval = watchdog->watchdog_resetval = cpuf;
|
||||
|
||||
ia32_msr_write(INTEL_MSR_PERFMON_CRT0, 0, ex64lo(cpuf));
|
||||
ia32_msr_write(INTEL_MSR_PERFMON_CRT0, 0, (unsigned long)(cpuf));
|
||||
|
||||
ia32_msr_write(INTEL_MSR_PERFMON_SEL0, 0,
|
||||
val | INTEL_MSR_PERFMON_SEL0_ENABLE);
|
||||
|
|
@ -49,7 +48,7 @@ static void intel_arch_watchdog_init(const unsigned cpu)
|
|||
static void intel_arch_watchdog_reinit(const unsigned cpu)
|
||||
{
|
||||
lapic_write(LAPIC_LVTPCR, APIC_ICR_DM_NMI);
|
||||
ia32_msr_write(INTEL_MSR_PERFMON_CRT0, 0, ex64lo(watchdog->resetval));
|
||||
ia32_msr_write(INTEL_MSR_PERFMON_CRT0, 0, (unsigned long)(watchdog->resetval));
|
||||
}
|
||||
|
||||
int arch_watchdog_init(void)
|
||||
|
|
@ -159,18 +158,18 @@ static int intel_arch_watchdog_profile_init(const unsigned freq)
|
|||
|
||||
/* FIXME works only if all CPUs have the same freq */
|
||||
cpuf = cpu_get_freq(cpuid);
|
||||
cpuf = div64u64(cpuf, freq);
|
||||
cpuf /= freq;
|
||||
|
||||
/*
|
||||
* if freq is too low and the cpu freq too high we may get in a range of
|
||||
* insane value which cannot be handled by the 31bit CPU perf counter
|
||||
*/
|
||||
if (ex64hi(cpuf) != 0 || ex64lo(cpuf) > 0x7fffffffU) {
|
||||
if ((unsigned long)(cpuf>>32) != 0 || (unsigned long)(cpuf) > 0x7fffffffU) {
|
||||
printf("ERROR : nmi watchdog ticks exceed 31bits, use higher frequency\n");
|
||||
return EINVAL;
|
||||
}
|
||||
|
||||
cpuf = make64(-ex64lo(cpuf), ex64hi(cpuf));
|
||||
cpuf = (u64_t)(-(unsigned long)(cpuf)) | (u64_t)((unsigned long)(cpuf>>32))<<32;
|
||||
watchdog->profile_resetval = cpuf;
|
||||
|
||||
return OK;
|
||||
|
|
@ -201,7 +200,7 @@ static void amd_watchdog_init(const unsigned cpu)
|
|||
watchdog->resetval = watchdog->watchdog_resetval = cpuf;
|
||||
|
||||
ia32_msr_write(AMD_MSR_EVENT_CTR0,
|
||||
ex64hi(watchdog->resetval), ex64lo(watchdog->resetval));
|
||||
(unsigned long)(watchdog->resetval>>32), (unsigned long)(watchdog->resetval));
|
||||
|
||||
ia32_msr_write(AMD_MSR_EVENT_SEL0, 0,
|
||||
val | AMD_MSR_EVENT_SEL0_ENABLE);
|
||||
|
|
@ -214,7 +213,7 @@ static void amd_watchdog_reinit(const unsigned cpu)
|
|||
{
|
||||
lapic_write(LAPIC_LVTPCR, APIC_ICR_DM_NMI);
|
||||
ia32_msr_write(AMD_MSR_EVENT_CTR0,
|
||||
ex64hi(watchdog->resetval), ex64lo(watchdog->resetval));
|
||||
(unsigned long)(watchdog->resetval>>32), (unsigned long)(watchdog->resetval));
|
||||
}
|
||||
|
||||
static int amd_watchdog_profile_init(const unsigned freq)
|
||||
|
|
@ -223,7 +222,7 @@ static int amd_watchdog_profile_init(const unsigned freq)
|
|||
|
||||
/* FIXME works only if all CPUs have the same freq */
|
||||
cpuf = cpu_get_freq(cpuid);
|
||||
cpuf = -div64u64(cpuf, freq);
|
||||
cpuf /= -freq;
|
||||
|
||||
watchdog->profile_resetval = cpuf;
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@
|
|||
|
||||
#include <minix/callnr.h>
|
||||
#include <minix/sysutil.h>
|
||||
#include <minix/u64.h>
|
||||
#include <limits.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
|
|
@ -255,8 +254,8 @@ void print_proc(struct proc *pp)
|
|||
"pdbr 0x%lx rts %s misc %s sched %s ",
|
||||
proc_nr(pp), pp->p_name, pp->p_endpoint,
|
||||
pp->p_priority, pp->p_user_time,
|
||||
pp->p_sys_time, ex64hi(pp->p_cycles),
|
||||
ex64lo(pp->p_cycles), pp->p_cpu,
|
||||
pp->p_sys_time, (unsigned long)(pp->p_cycles>>32),
|
||||
(unsigned long)(pp->p_cycles), pp->p_cpu,
|
||||
#if defined(__i386__)
|
||||
pp->p_seg.p_cr3,
|
||||
#elif defined(__arm__)
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@
|
|||
#include <minix/com.h>
|
||||
#include <minix/endpoint.h>
|
||||
#include <machine/vmparam.h>
|
||||
#include <minix/u64.h>
|
||||
#include <minix/type.h>
|
||||
#include <minix/reboot.h>
|
||||
#include "clock.h"
|
||||
|
|
@ -507,7 +506,7 @@ void cpu_print_freq(unsigned cpu)
|
|||
u64_t freq;
|
||||
|
||||
freq = cpu_get_freq(cpu);
|
||||
printf("CPU %d freq %lu MHz\n", cpu, div64u(freq, 1000000));
|
||||
printf("CPU %d freq %lu MHz\n", cpu, (unsigned long)(freq / 1000000));
|
||||
}
|
||||
|
||||
int is_fpu(void)
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@
|
|||
#include <assert.h>
|
||||
|
||||
#include <minix/endpoint.h>
|
||||
#include <minix/u64.h>
|
||||
|
||||
#if USE_FORK
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@
|
|||
|
||||
#if USE_GETINFO
|
||||
|
||||
#include <minix/u64.h>
|
||||
#include <sys/resource.h>
|
||||
|
||||
/*===========================================================================*
|
||||
|
|
@ -27,7 +26,7 @@ static void update_idle_time(void)
|
|||
int i;
|
||||
struct proc * idl = proc_addr(IDLE);
|
||||
|
||||
idl->p_cycles = make64(0, 0);
|
||||
idl->p_cycles = (u64_t)0;
|
||||
|
||||
for (i = 0; i < CONFIG_MAX_CPUS ; i++) {
|
||||
idl->p_cycles += get_cpu_var(i, idle_proc).p_cycles;
|
||||
|
|
|
|||
|
|
@ -135,8 +135,8 @@ static int bdev_rdwt_setup(int req, dev_t dev, u64_t pos, char *buf,
|
|||
memset(m, 0, sizeof(*m));
|
||||
m->m_type = req;
|
||||
m->BDEV_MINOR = minor(dev);
|
||||
m->BDEV_POS_LO = ex64lo(pos);
|
||||
m->BDEV_POS_HI = ex64hi(pos);
|
||||
m->BDEV_POS_LO = (unsigned long)(pos);
|
||||
m->BDEV_POS_HI = (unsigned long)(pos>>32);
|
||||
m->BDEV_COUNT = count;
|
||||
m->BDEV_GRANT = grant;
|
||||
m->BDEV_FLAGS = flags;
|
||||
|
|
@ -227,8 +227,8 @@ static int bdev_vrdwt_setup(int req, dev_t dev, u64_t pos, iovec_t *vec,
|
|||
memset(m, 0, sizeof(*m));
|
||||
m->m_type = req;
|
||||
m->BDEV_MINOR = minor(dev);
|
||||
m->BDEV_POS_LO = ex64lo(pos);
|
||||
m->BDEV_POS_HI = ex64hi(pos);
|
||||
m->BDEV_POS_LO = (unsigned long)(pos);
|
||||
m->BDEV_POS_HI = (unsigned long)(pos>>32);
|
||||
m->BDEV_COUNT = count;
|
||||
m->BDEV_GRANT = grant;
|
||||
m->BDEV_FLAGS = flags;
|
||||
|
|
@ -602,7 +602,7 @@ int bdev_restart_asyn(bdev_call_t *call)
|
|||
bdev_rdwt_cleanup(&call->msg);
|
||||
|
||||
r = bdev_rdwt_setup(type, call->dev,
|
||||
make64(call->msg.BDEV_POS_LO, call->msg.BDEV_POS_HI),
|
||||
(u64_t)call->msg.BDEV_POS_LO | ((u64_t)call->msg.BDEV_POS_HI<<32),
|
||||
(char *) call->vec[0].iov_addr, call->msg.BDEV_COUNT,
|
||||
call->msg.BDEV_FLAGS, &call->msg);
|
||||
|
||||
|
|
@ -613,7 +613,7 @@ int bdev_restart_asyn(bdev_call_t *call)
|
|||
bdev_vrdwt_cleanup(&call->msg, call->gvec);
|
||||
|
||||
r = bdev_vrdwt_setup(type, call->dev,
|
||||
make64(call->msg.BDEV_POS_LO, call->msg.BDEV_POS_HI),
|
||||
(u64_t)call->msg.BDEV_POS_LO | ((u64_t)call->msg.BDEV_POS_HI<<32),
|
||||
call->vec, call->msg.BDEV_COUNT, call->msg.BDEV_FLAGS,
|
||||
&call->msg, call->gvec);
|
||||
|
||||
|
|
|
|||
|
|
@ -204,7 +204,7 @@ static int do_rdwt(struct blockdriver *bdp, message *mp)
|
|||
|
||||
/* Transfer bytes from/to the device. */
|
||||
do_write = (mp->m_type == BDEV_WRITE);
|
||||
position = make64(mp->BDEV_POS_LO, mp->BDEV_POS_HI);
|
||||
position = (u64_t)mp->BDEV_POS_LO | ((u64_t)mp->BDEV_POS_HI<<32);
|
||||
|
||||
r = (*bdp->bdr_transfer)(mp->BDEV_MINOR, do_write, position, mp->m_source,
|
||||
&iovec1, 1, mp->BDEV_FLAGS);
|
||||
|
|
@ -245,7 +245,7 @@ static int do_vrdwt(struct blockdriver *bdp, message *mp, thread_id_t id)
|
|||
|
||||
/* Transfer bytes from/to the device. */
|
||||
do_write = (mp->m_type == BDEV_SCATTER);
|
||||
position = make64(mp->BDEV_POS_LO, mp->BDEV_POS_HI);
|
||||
position = (u64_t)mp->BDEV_POS_LO | ((u64_t)mp->BDEV_POS_HI<<32);
|
||||
|
||||
r = (*bdp->bdr_transfer)(mp->BDEV_MINOR, do_write, position, mp->m_source,
|
||||
iovec, nr_req, mp->BDEV_FLAGS);
|
||||
|
|
@ -290,7 +290,7 @@ static int do_dioctl(struct blockdriver *bdp, dev_t minor,
|
|||
(*bdp->bdr_geometry)(minor, &entry);
|
||||
} else {
|
||||
/* The driver doesn't care -- make up fake geometry. */
|
||||
entry.cylinders = div64u(entry.size, SECTOR_SIZE);
|
||||
entry.cylinders = (unsigned long)(entry.size / SECTOR_SIZE);
|
||||
entry.heads = 64;
|
||||
entry.sectors = 32;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -72,9 +72,9 @@ u8_t *tmp_buf; /* temporary buffer */
|
|||
|
||||
/* Get the geometry of the device to partition */
|
||||
if ((dv = (*bdp->bdr_part)(device)) == NULL
|
||||
|| cmp64u(dv->dv_size, 0) == 0) return;
|
||||
base = div64u(dv->dv_base, SECTOR_SIZE);
|
||||
limit = base + div64u(dv->dv_size, SECTOR_SIZE);
|
||||
|| dv->dv_size == (u64_t)(0)) return;
|
||||
base = (unsigned long)(dv->dv_base / SECTOR_SIZE);
|
||||
limit = base + (unsigned long)(dv->dv_size / SECTOR_SIZE);
|
||||
|
||||
/* Read the partition table for the device. */
|
||||
if(!get_part_table(bdp, device, 0L, table, tmp_buf)) {
|
||||
|
|
@ -109,8 +109,8 @@ u8_t *tmp_buf; /* temporary buffer */
|
|||
if (pe->lowsec < base) pe->lowsec = base;
|
||||
if (part_limit < pe->lowsec) part_limit = pe->lowsec;
|
||||
|
||||
dv->dv_base = mul64u(pe->lowsec, SECTOR_SIZE);
|
||||
dv->dv_size = mul64u(part_limit - pe->lowsec, SECTOR_SIZE);
|
||||
dv->dv_base = (u64_t)pe->lowsec * SECTOR_SIZE;
|
||||
dv->dv_size = (u64_t)(part_limit - pe->lowsec) * SECTOR_SIZE;
|
||||
|
||||
if (style == P_PRIMARY) {
|
||||
/* Each Minix primary partition can be subpartitioned. */
|
||||
|
|
@ -163,9 +163,9 @@ u8_t *tmp_buf; /* temporary buffer */
|
|||
if (pe->sysind != NO_PART) {
|
||||
if ((dv = (*bdp->bdr_part)(subdev)) == NULL) return;
|
||||
|
||||
dv->dv_base = mul64u(extbase + offset + pe->lowsec,
|
||||
SECTOR_SIZE);
|
||||
dv->dv_size = mul64u(pe->size, SECTOR_SIZE);
|
||||
dv->dv_base = (u64_t)(extbase + offset + pe->lowsec) *
|
||||
SECTOR_SIZE;
|
||||
dv->dv_size = (u64_t)pe->size * SECTOR_SIZE;
|
||||
|
||||
/* Out of devices? */
|
||||
if (++subdev % NR_PARTITIONS == 0) return;
|
||||
|
|
@ -191,7 +191,7 @@ u8_t *tmp_buf; /* temporary buffer */
|
|||
u64_t position;
|
||||
int r;
|
||||
|
||||
position = mul64u(offset, SECTOR_SIZE);
|
||||
position = (u64_t)offset * SECTOR_SIZE;
|
||||
iovec1.iov_addr = (vir_bytes) tmp_buf;
|
||||
iovec1.iov_size = CD_SECTOR_SIZE;
|
||||
r = (*bdp->bdr_transfer)(device, FALSE /*do_write*/, position, SELF,
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ static u32_t trace_gettime(void)
|
|||
|
||||
read_tsc_64(&tsc);
|
||||
|
||||
tsc = sub64(tsc, trace_tsc);
|
||||
tsc -= trace_tsc;
|
||||
|
||||
return tsc_64_to_micros(tsc);
|
||||
}
|
||||
|
|
@ -205,7 +205,7 @@ void trace_start(thread_id_t id, message *m_ptr)
|
|||
case BDEV_WRITE:
|
||||
case BDEV_GATHER:
|
||||
case BDEV_SCATTER:
|
||||
pos = make64(m_ptr->BDEV_POS_LO, m_ptr->BDEV_POS_HI);
|
||||
pos = (u64_t)m_ptr->BDEV_POS_LO | ((u64_t)m_ptr->BDEV_POS_HI<<32);
|
||||
size = m_ptr->BDEV_COUNT;
|
||||
flags = m_ptr->BDEV_FLAGS;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
#include <minix/u64.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
/* malloc-debug.c */
|
||||
|
|
|
|||
|
|
@ -129,7 +129,7 @@ static struct block *block_alloc(size_t size)
|
|||
/* read_tsc_64(&tsc); */
|
||||
totalsize = block_get_totalsize(size);
|
||||
page_index_max = (ptr_max - ptr_min - totalsize) / PAGE_SIZE;
|
||||
page_index = (page_index_max > 0) ? (ex64lo(tsc) % page_index_max) : 0;
|
||||
page_index = (page_index_max > 0) ? ((unsigned long)(tsc) % page_index_max) : 0;
|
||||
ptr = ptr_min + page_index * PAGE_SIZE;
|
||||
|
||||
/* allocate block */
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
#include <lib.h>
|
||||
|
||||
#include <unistd.h>
|
||||
#include <minix/u64.h>
|
||||
|
||||
int lseek64(fd, offset, whence, newpos)
|
||||
int fd;
|
||||
|
|
@ -14,11 +13,11 @@ u64_t *newpos;
|
|||
message m;
|
||||
|
||||
m.m2_i1 = fd;
|
||||
m.m2_l1 = ex64lo(offset);
|
||||
m.m2_l2 = ex64hi(offset);
|
||||
m.m2_l1 = (unsigned long)(offset);
|
||||
m.m2_l2 = (unsigned long)(offset>>32);
|
||||
m.m2_i2 = whence;
|
||||
if (_syscall(VFS_PROC_NR, LLSEEK, &m) < 0) return -1;
|
||||
if (newpos)
|
||||
*newpos= make64(m.m2_l1, m.m2_l2);
|
||||
*newpos= (u64_t)m.m2_l1 | ((u64_t)m.m2_l2<<32);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@
|
|||
#include <sys/cdefs.h>
|
||||
#include "namespace.h"
|
||||
#include <lib.h>
|
||||
#include <minix/u64.h>
|
||||
#include <minix/vm.h>
|
||||
|
||||
/* INCLUDES HERE */
|
||||
|
|
@ -33,13 +32,13 @@ void *minix_mmap_for(endpoint_t forwhom,
|
|||
m.VMM_PROT = prot;
|
||||
m.VMM_FLAGS = flags;
|
||||
m.VMM_FD = fd;
|
||||
m.VMM_OFFSET_LO = ex64lo(offset);
|
||||
m.VMM_OFFSET_LO = (unsigned long)(offset);
|
||||
|
||||
if(forwhom != SELF) {
|
||||
m.VMM_FLAGS |= MAP_THIRDPARTY;
|
||||
m.VMM_FORWHOM = forwhom;
|
||||
} else {
|
||||
m.VMM_OFFSET_HI = ex64hi(offset);
|
||||
m.VMM_OFFSET_HI = (unsigned long)(offset>>32);
|
||||
}
|
||||
|
||||
r = _syscall(VM_PROC_NR, VM_MMAP, &m);
|
||||
|
|
|
|||
|
|
@ -10,14 +10,13 @@ __weak_alias(pread, _pread)
|
|||
|
||||
#include <lib.h>
|
||||
#include <unistd.h>
|
||||
#include <minix/u64.h>
|
||||
|
||||
ssize_t pread64(int fd, void *buffer, size_t nbytes, u64_t where)
|
||||
{
|
||||
u64_t here;
|
||||
ssize_t r;
|
||||
|
||||
if (lseek64(fd, make64(0,0), SEEK_CUR, &here) < 0) return(-1);
|
||||
if (lseek64(fd, (u64_t)0, SEEK_CUR, &here) < 0) return(-1);
|
||||
if (lseek64(fd, where, SEEK_SET, NULL) < 0) return(-1);
|
||||
if ((r = read(fd, buffer, nbytes)) < 0) {
|
||||
int e = errno;
|
||||
|
|
|
|||
|
|
@ -8,14 +8,12 @@
|
|||
__weak_alias(pwrite, _pwrite)
|
||||
#endif
|
||||
|
||||
#include <minix/u64.h>
|
||||
|
||||
ssize_t pwrite64(int fd, const void *buffer, size_t nbytes, u64_t where)
|
||||
{
|
||||
u64_t here;
|
||||
ssize_t w;
|
||||
|
||||
if (lseek64(fd, make64(0,0), SEEK_CUR, &here) < 0) return(-1);
|
||||
if (lseek64(fd, (u64_t)0, SEEK_CUR, &here) < 0) return(-1);
|
||||
if (lseek64(fd, where, SEEK_SET, NULL) < 0) return(-1);
|
||||
if ((w = write(fd, buffer, nbytes)) < 0) {
|
||||
int e = errno;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
#include <sys/cdefs.h>
|
||||
#include "namespace.h"
|
||||
#include <lib.h>
|
||||
#include <minix/u64.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <stdio.h>
|
||||
|
|
|
|||
|
|
@ -252,7 +252,7 @@ static int do_rdwt(struct chardriver *cdp, message *mp)
|
|||
iovec1.iov_size = mp->COUNT;
|
||||
|
||||
/* Transfer bytes from/to the device. */
|
||||
position= make64(mp->POSITION, mp->HIGHPOS);
|
||||
position= (u64_t)mp->POSITION | ((u64_t)mp->HIGHPOS<<32);
|
||||
r = (*cdp->cdr_transfer)(mp->m_source, opcode, position, &iovec1, 1,
|
||||
mp->USER_ENDPT, mp->FLAGS);
|
||||
|
||||
|
|
@ -292,7 +292,7 @@ static int do_vrdwt(struct chardriver *cdp, message *mp)
|
|||
|
||||
/* Transfer bytes from/to the device. */
|
||||
opcode = mp->m_type;
|
||||
position= make64(mp->POSITION, mp->HIGHPOS);
|
||||
position= (u64_t)mp->POSITION | ((u64_t)mp->HIGHPOS<<32);
|
||||
r = (*cdp->cdr_transfer)(mp->m_source, opcode, position, iovec, nr_req,
|
||||
mp->USER_ENDPT, mp->FLAGS);
|
||||
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ struct sffs_attr *attr;
|
|||
size_lo = RPC_NEXT32;
|
||||
size_hi = RPC_NEXT32;
|
||||
if (attr->a_mask & SFFS_ATTR_SIZE)
|
||||
attr->a_size = make64(size_lo, size_hi);
|
||||
attr->a_size = (u64_t)size_lo | ((u64_t)size_hi<<32);
|
||||
|
||||
time_get((attr->a_mask & SFFS_ATTR_CRTIME) ? &attr->a_crtime : NULL);
|
||||
time_get((attr->a_mask & SFFS_ATTR_ATIME) ? &attr->a_atime : NULL);
|
||||
|
|
@ -86,8 +86,8 @@ struct sffs_attr *attr;
|
|||
RPC_NEXT8 = mask;
|
||||
|
||||
RPC_NEXT32 = !!(S_ISDIR(attr->a_mode));
|
||||
RPC_NEXT32 = ex64lo(attr->a_size);
|
||||
RPC_NEXT32 = ex64hi(attr->a_size);
|
||||
RPC_NEXT32 = (unsigned long)(attr->a_size);
|
||||
RPC_NEXT32 = (unsigned long)(attr->a_size>>32);
|
||||
|
||||
time_put((attr->a_mask & HGFS_ATTR_CRTIME) ? &attr->a_crtime : NULL);
|
||||
time_put((attr->a_mask & HGFS_ATTR_ATIME) ? &attr->a_atime : NULL);
|
||||
|
|
|
|||
|
|
@ -62,8 +62,8 @@ u64_t off; /* file offset */
|
|||
|
||||
RPC_REQUEST(HGFS_REQ_READ);
|
||||
RPC_NEXT32 = (u32_t)handle;
|
||||
RPC_NEXT32 = ex64lo(off);
|
||||
RPC_NEXT32 = ex64hi(off);
|
||||
RPC_NEXT32 = (unsigned long)(off);
|
||||
RPC_NEXT32 = (unsigned long)(off>>32);
|
||||
|
||||
max = RPC_BUF_SIZE - RPC_LEN - sizeof(u32_t);
|
||||
RPC_NEXT32 = (size < max) ? size : max;
|
||||
|
|
@ -97,8 +97,8 @@ u64_t off; /* file offset */
|
|||
RPC_REQUEST(HGFS_REQ_WRITE);
|
||||
RPC_NEXT32 = (u32_t)handle;
|
||||
RPC_NEXT8 = 0; /* append flag */
|
||||
RPC_NEXT32 = ex64lo(off);
|
||||
RPC_NEXT32 = ex64hi(off);
|
||||
RPC_NEXT32 = (unsigned long)(off);
|
||||
RPC_NEXT32 = (unsigned long)(off>>32);
|
||||
RPC_NEXT32 = len;
|
||||
|
||||
/* Only copy in data if we're not operating directly on the RPC buffer. */
|
||||
|
|
|
|||
|
|
@ -28,11 +28,11 @@ u64_t *total;
|
|||
|
||||
lo = RPC_NEXT32;
|
||||
hi = RPC_NEXT32;
|
||||
*free = make64(lo, hi);
|
||||
*free = (u64_t)lo | ((u64_t)hi << 32);
|
||||
|
||||
lo = RPC_NEXT32;
|
||||
hi = RPC_NEXT32;
|
||||
*total = make64(lo, hi);
|
||||
*total = (u64_t)lo | ((u64_t)hi << 32);
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ void time_init(void)
|
|||
* the difference between that time and the UNIX epoch, in 100ns units.
|
||||
*/
|
||||
/* FIXME: we currently do not take into account timezones. */
|
||||
time_offset = mul64u(116444736, 1000000000);
|
||||
time_offset = (u64_t)116444736 * 1000000000;
|
||||
}
|
||||
|
||||
/*===========================================================================*
|
||||
|
|
@ -33,11 +33,11 @@ void time_put(struct timespec *tsp)
|
|||
u64_t hgfstime;
|
||||
|
||||
if (tsp != NULL) {
|
||||
hgfstime = mul64u(tsp->tv_sec, 10000000) + (tsp->tv_nsec / 100);
|
||||
hgfstime = ((u64_t)tsp->tv_sec * 10000000) + (tsp->tv_nsec / 100);
|
||||
hgfstime += time_offset;
|
||||
|
||||
RPC_NEXT32 = ex64lo(hgfstime);
|
||||
RPC_NEXT32 = ex64hi(hgfstime);
|
||||
RPC_NEXT32 = (unsigned long)(hgfstime);
|
||||
RPC_NEXT32 = (unsigned long)(hgfstime>>32);
|
||||
} else {
|
||||
RPC_NEXT32 = 0;
|
||||
RPC_NEXT32 = 0;
|
||||
|
|
@ -60,10 +60,10 @@ void time_get(struct timespec *tsp)
|
|||
time_lo = RPC_NEXT32;
|
||||
time_hi = RPC_NEXT32;
|
||||
|
||||
hgfstime = sub64(make64(time_lo, time_hi), time_offset);
|
||||
hgfstime = ((u64_t)time_lo | ((u64_t)time_hi<<32)) - time_offset;
|
||||
|
||||
tsp->tv_sec = div64u(hgfstime, 10000000);
|
||||
tsp->tv_nsec = rem64u(hgfstime, 10000000) * 100;
|
||||
tsp->tv_sec = (unsigned long)(hgfstime / 10000000);
|
||||
tsp->tv_nsec = (unsigned)(hgfstime % 10000000) * 100;
|
||||
}
|
||||
else RPC_ADVANCE(sizeof(u32_t) * 2);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,7 +13,6 @@
|
|||
#include <minix/libminixfs.h>
|
||||
#include <minix/syslib.h>
|
||||
#include <minix/sysutil.h>
|
||||
#include <minix/u64.h>
|
||||
#include <minix/bdev.h>
|
||||
|
||||
#define BUFHASH(b) ((b) % nr_bufs)
|
||||
|
|
@ -75,8 +74,8 @@ u32_t fs_bufs_heuristic(int minbufs, u32_t btotal, u32_t bfree,
|
|||
vsi.vsi_pagesize / 1024;
|
||||
|
||||
/* check fs usage. */
|
||||
kbytes_used_fs = div64u(mul64u(bused, blocksize), 1024);
|
||||
kbytes_total_fs = div64u(mul64u(btotal, blocksize), 1024);
|
||||
kbytes_used_fs = (unsigned long)(((u64_t)bused * blocksize) / 1024);
|
||||
kbytes_total_fs = (unsigned long)(((u64_t)btotal * blocksize) / 1024);
|
||||
|
||||
/* heuristic for a desired cache size based on FS usage;
|
||||
* but never bigger than half of the total filesystem
|
||||
|
|
@ -510,7 +509,7 @@ register struct buf *bp; /* buffer pointer */
|
|||
ASSERT(bp->lmfs_bytes == fs_block_size);
|
||||
ASSERT(fs_block_size > 0);
|
||||
|
||||
pos = mul64u(bp->lmfs_blocknr, fs_block_size);
|
||||
pos = (u64_t)bp->lmfs_blocknr * fs_block_size;
|
||||
if(fs_block_size > PAGE_SIZE) {
|
||||
#define MAXPAGES 20
|
||||
vir_bytes vaddr = (vir_bytes) bp->data;
|
||||
|
|
@ -687,7 +686,7 @@ void lmfs_rw_scattered(
|
|||
assert(nblocks > 0);
|
||||
assert(niovecs > 0);
|
||||
|
||||
pos = mul64u(bufq[0]->lmfs_blocknr, fs_block_size);
|
||||
pos = (u64_t)bufq[0]->lmfs_blocknr * fs_block_size;
|
||||
if (rw_flag == READING)
|
||||
r = bdev_gather(dev, pos, iovec, niovecs, BDEV_NOFLAGS);
|
||||
else
|
||||
|
|
@ -924,7 +923,7 @@ int lmfs_do_bpeek(message *m)
|
|||
{
|
||||
block_t startblock, b, limitblock;
|
||||
dev_t dev = m->REQ_DEV2;
|
||||
u64_t extra, pos = make64(m->REQ_SEEK_POS_LO, m->REQ_SEEK_POS_HI);
|
||||
u64_t extra, pos = (u64_t)m->REQ_SEEK_POS_LO | ((u64_t)m->REQ_SEEK_POS_HI<<32);
|
||||
size_t len = m->REQ_NBYTES;
|
||||
struct buf *bp;
|
||||
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ SRCS+= dhcp_gettag.c dhcp_settag.c
|
|||
SRCS+= gcov.c gcov_flush.c
|
||||
|
||||
# Various utils
|
||||
SRCS+= itoa.c u64util.c read_tsc_64.c
|
||||
SRCS+= itoa.c read_tsc_64.c
|
||||
|
||||
# svrctl
|
||||
SRCS+= svrctl.c
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
|
||||
#include <minix/u64.h>
|
||||
#include <minix/minlib.h>
|
||||
|
||||
/* Utility function to work directly with u64_t
|
||||
|
|
@ -10,6 +9,6 @@ u64_t* t;
|
|||
{
|
||||
u32_t lo, hi;
|
||||
read_tsc (&hi, &lo);
|
||||
*t = make64 (lo, hi);
|
||||
*t = (u64_t)lo | ((u64_t)hi<<32);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,34 +0,0 @@
|
|||
/* Few u64 utils implemented in C
|
||||
* Author: Gautam BT
|
||||
*/
|
||||
#include <minix/u64.h>
|
||||
|
||||
u64_t rrotate64(u64_t x, unsigned short b)
|
||||
{
|
||||
b %= 64;
|
||||
if ((b &= 63) == 0)
|
||||
return x;
|
||||
return (x >> b) | (x << (64 - b));
|
||||
}
|
||||
|
||||
u64_t rshift64(u64_t x, unsigned short b)
|
||||
{
|
||||
if (b >= 64)
|
||||
return 0;
|
||||
return x >> b;
|
||||
}
|
||||
|
||||
u64_t xor64(u64_t a, u64_t b)
|
||||
{
|
||||
return a ^ b;
|
||||
}
|
||||
|
||||
u64_t and64(u64_t a, u64_t b)
|
||||
{
|
||||
return a & b;
|
||||
}
|
||||
|
||||
u64_t not64(u64_t a)
|
||||
{
|
||||
return ~a;
|
||||
}
|
||||
|
|
@ -8,7 +8,6 @@
|
|||
#include <stdlib.h>
|
||||
#include <dirent.h>
|
||||
#include <minix/com.h>
|
||||
#include <minix/u64.h>
|
||||
#include <minix/vfsif.h>
|
||||
#include <assert.h>
|
||||
#include <sys/param.h>
|
||||
|
|
|
|||
|
|
@ -117,8 +117,8 @@ int do_create()
|
|||
|
||||
m_out.RES_INODE_NR = INODE_NR(ino);
|
||||
m_out.RES_MODE = get_mode(ino, attr.a_mode);
|
||||
m_out.RES_FILE_SIZE_HI = ex64hi(attr.a_size);
|
||||
m_out.RES_FILE_SIZE_LO = ex64lo(attr.a_size);
|
||||
m_out.RES_FILE_SIZE_HI = (unsigned long)(attr.a_size>>32);
|
||||
m_out.RES_FILE_SIZE_LO = (unsigned long)(attr.a_size);
|
||||
m_out.RES_UID = sffs_params->p_uid;
|
||||
m_out.RES_GID = sffs_params->p_gid;
|
||||
m_out.RES_DEV = NO_DEV;
|
||||
|
|
|
|||
|
|
@ -322,8 +322,8 @@ int do_lookup()
|
|||
|
||||
m_out.RES_INODE_NR = INODE_NR(cur_ino);
|
||||
m_out.RES_MODE = get_mode(cur_ino, attr.a_mode);
|
||||
m_out.RES_FILE_SIZE_HI = ex64hi(attr.a_size);
|
||||
m_out.RES_FILE_SIZE_LO = ex64lo(attr.a_size);
|
||||
m_out.RES_FILE_SIZE_HI = (unsigned long)(attr.a_size>>32);
|
||||
m_out.RES_FILE_SIZE_LO = (unsigned long)(attr.a_size);
|
||||
m_out.RES_UID = sffs_params->p_uid;
|
||||
m_out.RES_GID = sffs_params->p_gid;
|
||||
m_out.RES_DEV = NO_DEV;
|
||||
|
|
|
|||
|
|
@ -62,8 +62,8 @@ int do_statvfs()
|
|||
*/
|
||||
statvfs.f_bsize = BLOCK_SIZE;
|
||||
statvfs.f_frsize = BLOCK_SIZE;
|
||||
statvfs.f_blocks = div64u(total, BLOCK_SIZE);
|
||||
statvfs.f_bfree = div64u(free, BLOCK_SIZE);
|
||||
statvfs.f_blocks = (unsigned long)(total / BLOCK_SIZE);
|
||||
statvfs.f_bfree = (unsigned long)(free / BLOCK_SIZE);
|
||||
statvfs.f_bavail = statvfs.f_bfree;
|
||||
statvfs.f_files = 0;
|
||||
statvfs.f_ffree = 0;
|
||||
|
|
|
|||
|
|
@ -57,8 +57,8 @@ int do_readsuper()
|
|||
|
||||
m_out.RES_INODE_NR = INODE_NR(ino);
|
||||
m_out.RES_MODE = get_mode(ino, attr.a_mode);
|
||||
m_out.RES_FILE_SIZE_HI = ex64hi(attr.a_size);
|
||||
m_out.RES_FILE_SIZE_LO = ex64lo(attr.a_size);
|
||||
m_out.RES_FILE_SIZE_HI = (unsigned long)(attr.a_size>>32);
|
||||
m_out.RES_FILE_SIZE_LO = (unsigned long)(attr.a_size);
|
||||
m_out.RES_UID = sffs_params->p_uid;
|
||||
m_out.RES_GID = sffs_params->p_gid;
|
||||
m_out.RES_DEV = NO_DEV;
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ int do_read()
|
|||
if ((r = get_handle(ino)) != OK)
|
||||
return r;
|
||||
|
||||
pos = make64(m_in.REQ_SEEK_POS_LO, m_in.REQ_SEEK_POS_HI);
|
||||
pos = (u64_t)m_in.REQ_SEEK_POS_LO | ((u64_t)m_in.REQ_SEEK_POS_HI<<32);
|
||||
count = m_in.REQ_NBYTES;
|
||||
|
||||
assert(count > 0);
|
||||
|
|
@ -67,8 +67,8 @@ int do_read()
|
|||
if (r < 0)
|
||||
return r;
|
||||
|
||||
m_out.RES_SEEK_POS_HI = ex64hi(pos);
|
||||
m_out.RES_SEEK_POS_LO = ex64lo(pos);
|
||||
m_out.RES_SEEK_POS_HI = (unsigned long)(pos>>32);
|
||||
m_out.RES_SEEK_POS_LO = (unsigned long)(pos);
|
||||
m_out.RES_NBYTES = off;
|
||||
|
||||
return OK;
|
||||
|
|
|
|||
|
|
@ -70,10 +70,10 @@ int do_stat()
|
|||
stat.st_uid = sffs_params->p_uid;
|
||||
stat.st_gid = sffs_params->p_gid;
|
||||
stat.st_rdev = NO_DEV;
|
||||
if (cmp64u(attr.a_size, LONG_MAX) > 0)
|
||||
if (attr.a_size > (u64_t)(LONG_MAX))
|
||||
stat.st_size = LONG_MAX;
|
||||
else
|
||||
stat.st_size = ex64lo(attr.a_size);
|
||||
stat.st_size = (unsigned long)(attr.a_size);
|
||||
stat.st_atimespec = attr.a_atime;
|
||||
stat.st_mtimespec = attr.a_mtime;
|
||||
stat.st_ctimespec = attr.a_ctime;
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@ int do_write()
|
|||
|
||||
if (IS_DIR(ino)) return EISDIR;
|
||||
|
||||
pos = make64(m_in.REQ_SEEK_POS_LO, m_in.REQ_SEEK_POS_HI);
|
||||
pos = (u64_t)m_in.REQ_SEEK_POS_LO | ((u64_t)m_in.REQ_SEEK_POS_HI<<32);
|
||||
count = m_in.REQ_NBYTES;
|
||||
grant = m_in.REQ_GRANT;
|
||||
|
||||
|
|
@ -106,8 +106,8 @@ int do_write()
|
|||
if ((r = write_file(ino, &pos, &count, &grant)) != OK)
|
||||
return r;
|
||||
|
||||
m_out.RES_SEEK_POS_HI = ex64hi(pos);
|
||||
m_out.RES_SEEK_POS_LO = ex64lo(pos);
|
||||
m_out.RES_SEEK_POS_HI = (unsigned long)(pos>>32);
|
||||
m_out.RES_SEEK_POS_LO = (unsigned long)(pos);
|
||||
m_out.RES_NBYTES = count;
|
||||
|
||||
return OK;
|
||||
|
|
@ -135,10 +135,10 @@ int do_ftrunc()
|
|||
|
||||
if (IS_DIR(ino)) return EISDIR;
|
||||
|
||||
start = make64(m_in.REQ_TRC_START_LO, m_in.REQ_TRC_START_HI);
|
||||
end = make64(m_in.REQ_TRC_END_LO, m_in.REQ_TRC_END_HI);
|
||||
start = (u64_t)m_in.REQ_TRC_START_LO | ((u64_t)m_in.REQ_TRC_START_HI<<32);
|
||||
end = (u64_t)m_in.REQ_TRC_END_LO | ((u64_t)m_in.REQ_TRC_END_HI<<32);
|
||||
|
||||
if (cmp64u(end, 0) == 0) {
|
||||
if (end == (u64_t)(0)) {
|
||||
/* Truncate or expand the file. */
|
||||
if ((r = verify_inode(ino, path, NULL)) != OK)
|
||||
return r;
|
||||
|
|
@ -149,13 +149,13 @@ int do_ftrunc()
|
|||
r = sffs_table->t_setattr(path, &attr);
|
||||
} else {
|
||||
/* Write zeroes to the file. We can't create holes. */
|
||||
if (cmp64(end, start) <= 0) return EINVAL;
|
||||
if (end <= start) return EINVAL;
|
||||
|
||||
delta = sub64(end, start);
|
||||
delta = end - start;
|
||||
|
||||
if (ex64hi(delta) != 0) return EINVAL;
|
||||
if ((unsigned long)(delta>>32) != 0) return EINVAL;
|
||||
|
||||
count = ex64lo(delta);
|
||||
count = (unsigned long)(delta);
|
||||
|
||||
r = write_file(ino, &start, &count, NULL);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
#include <time.h>
|
||||
#include <sys/times.h>
|
||||
#include <sys/types.h>
|
||||
#include <minix/u64.h>
|
||||
#include <minix/config.h>
|
||||
#include <minix/const.h>
|
||||
#include <minix/minlib.h>
|
||||
|
|
@ -30,6 +29,6 @@ u32_t tsc_64_to_micros(u64_t tsc)
|
|||
|
||||
u32_t tsc_to_micros(u32_t low, u32_t high)
|
||||
{
|
||||
return tsc_64_to_micros(make64(low, high));
|
||||
return tsc_64_to_micros((u64_t)low | ((u64_t)high<<32));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@
|
|||
|
||||
#define _SYSTEM 1
|
||||
#include <lib.h>
|
||||
#include <minix/u64.h>
|
||||
#include <minix/sysutil.h>
|
||||
#include <minix/syslib.h>
|
||||
#include <minix/minlib.h>
|
||||
|
|
@ -33,11 +32,11 @@ static double make_double(u64_t d)
|
|||
double value;
|
||||
size_t i;
|
||||
|
||||
value = (double) ex64hi(d);
|
||||
value = (double) (unsigned long)(d>>32);
|
||||
for (i = 0; i < sizeof(unsigned long); i += 2)
|
||||
value *= 65536.0;
|
||||
|
||||
value += (double) ex64lo(d);
|
||||
value += (double) (unsigned long)(d);
|
||||
|
||||
return value;
|
||||
}
|
||||
|
|
@ -67,10 +66,10 @@ double getidle(void)
|
|||
if ((r = sys_getidletsc(&idle2)) != OK)
|
||||
return -1.0;
|
||||
|
||||
idelta = sub64(idle2, idle);
|
||||
tdelta = sub64(stop, start);
|
||||
idelta = idle2 - idle;
|
||||
tdelta = stop - start;
|
||||
|
||||
if (cmp64(idelta, tdelta) >= 0)
|
||||
if (idelta >= tdelta)
|
||||
return 100.0;
|
||||
|
||||
ifp = make_double(idelta);
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@
|
|||
#include <string.h>
|
||||
#include <minix/profile.h>
|
||||
#include <minix/sysutil.h>
|
||||
#include <minix/u64.h>
|
||||
#include <minix/minlib.h>
|
||||
|
||||
static char cpath[CPROF_CPATH_MAX_LEN]; /* current call path string */
|
||||
|
|
@ -178,7 +177,7 @@ void procexit (char *UNUSED(name))
|
|||
|
||||
/* First thing: read CPU cycle count into local variable. */
|
||||
read_tsc(&tsc_hi, &tsc_lo);
|
||||
stop = make64(tsc_lo, tsc_hi);
|
||||
stop = (u64_t)tsc_lo | ((u64_t)tsc_hi<<32);
|
||||
|
||||
/* Only continue if sane. */
|
||||
if (control.err) return;
|
||||
|
|
@ -191,9 +190,9 @@ void procexit (char *UNUSED(name))
|
|||
*/
|
||||
|
||||
/* Calculate "small" difference. */
|
||||
spent = sub64(stop, cprof_stk[cprof_stk_top].start_2);
|
||||
spent = stop - cprof_stk[cprof_stk_top].start_2;
|
||||
cprof_stk[cprof_stk_top].slot->cycles +=
|
||||
sub64(spent, cprof_stk[cprof_stk_top].spent_deeper);
|
||||
(spent - cprof_stk[cprof_stk_top].spent_deeper);
|
||||
|
||||
/* Clear spent_deeper for call level we're leaving. */
|
||||
cprof_stk[cprof_stk_top].spent_deeper = ((u64_t)(0));
|
||||
|
|
@ -213,10 +212,10 @@ void procexit (char *UNUSED(name))
|
|||
|
||||
/* Read CPU cycle count. */
|
||||
read_tsc(&tsc_hi, &tsc_lo);
|
||||
stop = make64(tsc_lo, tsc_hi);
|
||||
stop = (u64_t)tsc_lo | ((u64_t)tsc_hi<<32);
|
||||
|
||||
/* Calculate "big" difference. */
|
||||
spent = sub64(stop, cprof_stk[cprof_stk_top].start_1);
|
||||
spent = stop - cprof_stk[cprof_stk_top].start_1;
|
||||
cprof_stk_top--; /* decrease stack */
|
||||
if (cprof_stk_top >= 0) /* don't update non-existent level -1 */
|
||||
cprof_stk[cprof_stk_top].spent_deeper += spent;
|
||||
|
|
@ -265,7 +264,7 @@ static void clear_tbl()
|
|||
memset(cprof_tbl[i].cpath, '\0', CPROF_CPATH_MAX_LEN);
|
||||
cprof_tbl[i].next = 0;
|
||||
cprof_tbl[i].calls = 0;
|
||||
cprof_tbl[i].cycles = make64(0, 0);
|
||||
cprof_tbl[i].cycles = (u64_t)0;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ int spin_check(spin_t *s)
|
|||
case STATE_TS:
|
||||
read_tsc_64(&cur_tsc);
|
||||
|
||||
tsc_delta = sub64(cur_tsc, s->s_base_tsc);
|
||||
tsc_delta = cur_tsc - s->s_base_tsc;
|
||||
|
||||
micro_delta = tsc_64_to_micros(tsc_delta);
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
#include <time.h>
|
||||
#include <sys/times.h>
|
||||
#include <sys/types.h>
|
||||
#include <minix/u64.h>
|
||||
#include <minix/config.h>
|
||||
#include <minix/const.h>
|
||||
#include <minix/minlib.h>
|
||||
|
|
@ -63,7 +62,7 @@ micro_delay(u32_t micros)
|
|||
CALIBRATE;
|
||||
|
||||
/* We have to know when to end the delay. */
|
||||
end = now + mul64u(micros, calib_mhz);
|
||||
end = now + ((u64_t)micros * calib_mhz);
|
||||
|
||||
/* If we have to wait for at least one HZ tick, use the regular
|
||||
* tickdelay first. Round downwards on purpose, so the average
|
||||
|
|
@ -75,7 +74,7 @@ micro_delay(u32_t micros)
|
|||
tickdelay(micros*Hz/MICROHZ);
|
||||
|
||||
/* Wait (the rest) of the delay time using busywait. */
|
||||
while(cmp64(now, end) < 0)
|
||||
while (now < end)
|
||||
read_tsc_64(&now);
|
||||
|
||||
return OK;
|
||||
|
|
@ -87,18 +86,18 @@ u32_t tsc_64_to_micros(u64_t tsc)
|
|||
|
||||
CALIBRATE;
|
||||
|
||||
tmp = div64u64(tsc, calib_mhz);
|
||||
if (ex64hi(tmp)) {
|
||||
tmp = tsc / calib_mhz;
|
||||
if ((unsigned long)(tmp>>32)) {
|
||||
printf("tsc_64_to_micros: more than 2^32ms\n");
|
||||
return ~0UL;
|
||||
} else {
|
||||
return ex64lo(tmp);
|
||||
return (unsigned long)(tmp);
|
||||
}
|
||||
}
|
||||
|
||||
u32_t tsc_to_micros(u32_t low, u32_t high)
|
||||
{
|
||||
return tsc_64_to_micros(make64(low, high));
|
||||
return tsc_64_to_micros((u64_t)low | ((u64_t)high<<32));
|
||||
}
|
||||
|
||||
u32_t tsc_get_khz(void)
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@
|
|||
#include <stdio.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/types.h>
|
||||
#include <minix/u64.h>
|
||||
#include <minix/config.h>
|
||||
#include <minix/const.h>
|
||||
|
||||
|
|
@ -31,7 +30,7 @@ micros_to_ticks(u32_t micros)
|
|||
{
|
||||
u32_t ticks;
|
||||
|
||||
ticks = div64u(mul64u(micros, sys_hz()), 1000000);
|
||||
ticks = (unsigned long)(((u64_t)micros * sys_hz()) / 1000000);
|
||||
if(ticks < 1) ticks = 1;
|
||||
|
||||
return ticks;
|
||||
|
|
|
|||
|
|
@ -10,8 +10,8 @@ static void
|
|||
get_time(struct timespec *tsp, u64_t nsecs)
|
||||
{
|
||||
|
||||
tsp->tv_sec = div64u(nsecs, 1000000000);
|
||||
tsp->tv_nsec = rem64u(nsecs, 1000000000);
|
||||
tsp->tv_sec = (unsigned long)(nsecs / 1000000000);
|
||||
tsp->tv_nsec = (unsigned)(nsecs % 1000000000);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -21,7 +21,7 @@ static u64_t
|
|||
set_time(struct timespec *tsp)
|
||||
{
|
||||
|
||||
return mul64u(tsp->tv_sec, 1000000000) + tsp->tv_nsec;
|
||||
return ((u64_t)tsp->tv_sec * 1000000000) + tsp->tv_nsec;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -20,7 +20,6 @@
|
|||
#include <minix/vfsif.h>
|
||||
#include <minix/endpoint.h>
|
||||
#include <minix/sysinfo.h>
|
||||
#include <minix/u64.h>
|
||||
#include <minix/sysinfo.h>
|
||||
#include <minix/type.h>
|
||||
#include <minix/ipc.h>
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@
|
|||
#include <minix/vfsif.h>
|
||||
#include <minix/endpoint.h>
|
||||
#include <minix/sysinfo.h>
|
||||
#include <minix/u64.h>
|
||||
#include <minix/sysinfo.h>
|
||||
#include <minix/type.h>
|
||||
#include <minix/ipc.h>
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@
|
|||
#include <minix/vfsif.h>
|
||||
#include <minix/endpoint.h>
|
||||
#include <minix/sysinfo.h>
|
||||
#include <minix/u64.h>
|
||||
#include <minix/sysinfo.h>
|
||||
#include <minix/type.h>
|
||||
#include <minix/ipc.h>
|
||||
|
|
|
|||
|
|
@ -13,7 +13,6 @@
|
|||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <minix/com.h>
|
||||
#include <minix/u64.h>
|
||||
#include "buf.h"
|
||||
#include "inode.h"
|
||||
#include "super.h"
|
||||
|
|
|
|||
|
|
@ -12,7 +12,6 @@
|
|||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <minix/com.h>
|
||||
#include <minix/u64.h>
|
||||
#include "buf.h"
|
||||
#include "inode.h"
|
||||
#include "super.h"
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@
|
|||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <minix/com.h>
|
||||
#include <minix/u64.h>
|
||||
#include "buf.h"
|
||||
#include "inode.h"
|
||||
#include "super.h"
|
||||
|
|
@ -159,8 +158,8 @@ int fs_breadwrite(void)
|
|||
/* Get the values from the request message */
|
||||
rw_flag = (fs_m_in.m_type == REQ_BREAD ? READING : WRITING);
|
||||
gid = (cp_grant_id_t) fs_m_in.REQ_GRANT;
|
||||
position = make64((unsigned long) fs_m_in.REQ_SEEK_POS_LO,
|
||||
(unsigned long) fs_m_in.REQ_SEEK_POS_HI);
|
||||
position = (u64_t)fs_m_in.REQ_SEEK_POS_LO |
|
||||
((u64_t)fs_m_in.REQ_SEEK_POS_HI<<32);
|
||||
nrbytes = (size_t) fs_m_in.REQ_NBYTES;
|
||||
|
||||
block_size = get_block_size( (dev_t) fs_m_in.REQ_DEV2);
|
||||
|
|
@ -174,7 +173,7 @@ int fs_breadwrite(void)
|
|||
cum_io = 0;
|
||||
/* Split the transfer into chunks that don't span two blocks. */
|
||||
while (nrbytes > 0) {
|
||||
off = rem64u(position, block_size); /* offset in blk*/
|
||||
off = (unsigned)(position % block_size); /* offset in blk*/
|
||||
chunk = min(nrbytes, block_size - off);
|
||||
|
||||
/* Read or write 'chunk' bytes. */
|
||||
|
|
@ -190,8 +189,8 @@ int fs_breadwrite(void)
|
|||
position += chunk; /* position within the file */
|
||||
}
|
||||
|
||||
fs_m_out.RES_SEEK_POS_LO = ex64lo(position);
|
||||
fs_m_out.RES_SEEK_POS_HI = ex64hi(position);
|
||||
fs_m_out.RES_SEEK_POS_LO = (unsigned long)(position);
|
||||
fs_m_out.RES_SEEK_POS_HI = (unsigned long)(position>>32);
|
||||
|
||||
if (rdwt_err != OK) r = rdwt_err; /* check for disk error */
|
||||
if (rdwt_err == END_OF_FILE) r = OK;
|
||||
|
|
@ -239,12 +238,12 @@ int *completed; /* number of bytes copied */
|
|||
block_spec = (rip->i_mode & I_TYPE) == I_BLOCK_SPECIAL;
|
||||
|
||||
if (block_spec) {
|
||||
b = div64u(position, block_size);
|
||||
b = (unsigned long)(position / block_size);
|
||||
dev = (dev_t) rip->i_block[0];
|
||||
} else {
|
||||
if (ex64hi(position) != 0)
|
||||
if ((unsigned long)(position>>32) != 0)
|
||||
panic("rw_chunk: position too high");
|
||||
b = read_map(rip, (off_t) ex64lo(position), 0);
|
||||
b = read_map(rip, (off_t) (unsigned long)(position), 0);
|
||||
dev = rip->i_dev;
|
||||
ino = rip->i_num;
|
||||
assert(ino != VMC_NO_INODE);
|
||||
|
|
@ -263,7 +262,7 @@ int *completed; /* number of bytes copied */
|
|||
/* Writing to or peeking a nonexistent block.
|
||||
* Create and enter in inode.
|
||||
*/
|
||||
if ((bp = new_block(rip, (off_t) ex64lo(position))) == NULL)
|
||||
if ((bp = new_block(rip, (off_t) (unsigned long)(position))) == NULL)
|
||||
return(err_code);
|
||||
}
|
||||
} else if (rw_flag == READING || rw_flag == PEEKING) {
|
||||
|
|
@ -275,7 +274,7 @@ int *completed; /* number of bytes copied */
|
|||
* the cache, acquire it, otherwise just acquire a free buffer.
|
||||
*/
|
||||
n = (chunk == block_size ? NO_READ : NORMAL);
|
||||
if (!block_spec && off == 0 && (off_t) ex64lo(position) >= rip->i_size)
|
||||
if (!block_spec && off == 0 && (off_t) (unsigned long)(position) >= rip->i_size)
|
||||
n = NO_READ;
|
||||
if(block_spec) {
|
||||
assert(ino == VMC_NO_INODE);
|
||||
|
|
@ -292,7 +291,7 @@ int *completed; /* number of bytes copied */
|
|||
panic("bp not valid in rw_chunk, this can't happen");
|
||||
|
||||
if (rw_flag == WRITING && chunk != block_size && !block_spec &&
|
||||
(off_t) ex64lo(position) >= rip->i_size && off == 0) {
|
||||
(off_t) (unsigned long)(position) >= rip->i_size && off == 0) {
|
||||
zero_block(bp);
|
||||
}
|
||||
|
||||
|
|
@ -552,13 +551,13 @@ unsigned bytes_ahead; /* bytes beyond position for immediate use */
|
|||
if (block_spec && rip->i_size == 0) {
|
||||
blocks_left = (block_t) NR_IOREQS;
|
||||
} else {
|
||||
blocks_left = (block_t) (rip->i_size-ex64lo(position)+(block_size-1)) /
|
||||
blocks_left = (block_t) (rip->i_size-(unsigned long)(position)+(block_size-1)) /
|
||||
block_size;
|
||||
|
||||
/* Go for the first indirect block if we are in its neighborhood. */
|
||||
if (!block_spec) {
|
||||
ind1_pos = (EXT2_NDIR_BLOCKS) * block_size;
|
||||
if ((off_t) ex64lo(position) <= ind1_pos && rip->i_size > ind1_pos) {
|
||||
if ((off_t) (unsigned long)(position) <= ind1_pos && rip->i_size > ind1_pos) {
|
||||
blocks_ahead++;
|
||||
blocks_left++;
|
||||
}
|
||||
|
|
@ -591,7 +590,7 @@ unsigned bytes_ahead; /* bytes beyond position for immediate use */
|
|||
position_running += block_size;
|
||||
|
||||
if(!block_spec &&
|
||||
(thisblock = read_map(rip, (off_t) ex64lo(position_running), 1)) != NO_BLOCK) {
|
||||
(thisblock = read_map(rip, (off_t) (unsigned long)(position_running), 1)) != NO_BLOCK) {
|
||||
bp = lmfs_get_block_ino(dev, thisblock, PREFETCH, rip->i_num, position_running);
|
||||
} else {
|
||||
bp = get_block(dev, block, PREFETCH);
|
||||
|
|
|
|||
|
|
@ -13,7 +13,6 @@
|
|||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
#include <minix/com.h>
|
||||
#include <minix/u64.h>
|
||||
#include <minix/bdev.h>
|
||||
#include "buf.h"
|
||||
#include "inode.h"
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ int fs_bread(void)
|
|||
|
||||
rw_flag = (fs_m_in.m_type == REQ_BREAD ? READING : WRITING);
|
||||
gid = fs_m_in.REQ_GRANT;
|
||||
position = make64(fs_m_in.REQ_SEEK_POS_LO, fs_m_in.REQ_SEEK_POS_HI);
|
||||
position = (u64_t)fs_m_in.REQ_SEEK_POS_LO | ((u64_t)fs_m_in.REQ_SEEK_POS_HI<<32);
|
||||
nrbytes = (unsigned) fs_m_in.REQ_NBYTES;
|
||||
block_size = v_pri.logical_block_size_l;
|
||||
dir = v_pri.dir_rec_root;
|
||||
|
|
@ -106,7 +106,7 @@ int fs_bread(void)
|
|||
cum_io = 0;
|
||||
/* Split the transfer into chunks that don't span two blocks. */
|
||||
while (nrbytes != 0) {
|
||||
off = rem64u(position, block_size); /* offset in blk*/
|
||||
off = (unsigned)(position % block_size); /* offset in blk*/
|
||||
|
||||
chunk = MIN(nrbytes, block_size - off);
|
||||
if (chunk < 0) chunk = block_size - off;
|
||||
|
|
@ -124,8 +124,8 @@ int fs_bread(void)
|
|||
position += chunk; /* position within the file */
|
||||
}
|
||||
|
||||
fs_m_out.RES_SEEK_POS_LO = ex64lo(position);
|
||||
fs_m_out.RES_SEEK_POS_HI = ex64hi(position);
|
||||
fs_m_out.RES_SEEK_POS_LO = (unsigned long)(position);
|
||||
fs_m_out.RES_SEEK_POS_HI = (unsigned long)(position>>32);
|
||||
|
||||
if (rdwt_err != OK) r = rdwt_err; /* check for disk error */
|
||||
if (rdwt_err == END_OF_FILE) r = OK;
|
||||
|
|
@ -307,23 +307,24 @@ int rw; /* READING or PEEKING */
|
|||
|
||||
*completed = 0;
|
||||
|
||||
if ((ex64lo(position) <= dir->d_file_size) &&
|
||||
(ex64lo(position) > dir->data_length_l)) {
|
||||
while ((dir->d_next != NULL) && (ex64lo(position) > dir->data_length_l)) {
|
||||
position = sub64ul(position, dir->data_length_l);
|
||||
if (((unsigned long)(position) <= dir->d_file_size) &&
|
||||
((unsigned long)(position) > dir->data_length_l)) {
|
||||
while ((dir->d_next != NULL) &&
|
||||
((unsigned long)(position) > dir->data_length_l)) {
|
||||
position -= dir->data_length_l;
|
||||
dir = dir->d_next;
|
||||
}
|
||||
}
|
||||
|
||||
if (dir->inter_gap_size != 0) {
|
||||
rel_block = div64u(position, block_size);
|
||||
rel_block = (unsigned long)(position / block_size);
|
||||
file_unit = rel_block / dir->data_length_l;
|
||||
offset = rel_block % dir->file_unit_size;
|
||||
b = dir->loc_extent_l + (dir->file_unit_size +
|
||||
dir->inter_gap_size) * file_unit + offset;
|
||||
} else {
|
||||
b = dir->loc_extent_l + div64u(position, block_size); /* Physical position
|
||||
* to read. */
|
||||
/* Physical position to read. */
|
||||
b = dir->loc_extent_l + (unsigned long)(position / block_size);
|
||||
}
|
||||
|
||||
bp = get_block(b);
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@
|
|||
#include "inc.h"
|
||||
#include <string.h>
|
||||
#include <minix/com.h>
|
||||
#include <minix/u64.h>
|
||||
#include <minix/bdev.h>
|
||||
|
||||
/* This function is called when the filesystem is umounted. It releases the
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@
|
|||
*/
|
||||
|
||||
#include "fs.h"
|
||||
#include <minix/u64.h>
|
||||
#include <minix/bdev.h>
|
||||
#include <sys/param.h>
|
||||
#include <stdlib.h>
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <minix/com.h>
|
||||
#include <minix/u64.h>
|
||||
#include "buf.h"
|
||||
#include "inode.h"
|
||||
#include "super.h"
|
||||
|
|
@ -164,8 +163,8 @@ int fs_breadwrite(void)
|
|||
/* Get the values from the request message */
|
||||
rw_flag = (fs_m_in.m_type == REQ_BREAD ? READING : WRITING);
|
||||
gid = (cp_grant_id_t) fs_m_in.REQ_GRANT;
|
||||
position = make64((unsigned long) fs_m_in.REQ_SEEK_POS_LO,
|
||||
(unsigned long) fs_m_in.REQ_SEEK_POS_HI);
|
||||
position = (u64_t)fs_m_in.REQ_SEEK_POS_LO |
|
||||
((u64_t)fs_m_in.REQ_SEEK_POS_HI<<32);
|
||||
nrbytes = (size_t) fs_m_in.REQ_NBYTES;
|
||||
|
||||
block_size = get_block_size(target_dev);
|
||||
|
|
@ -183,7 +182,7 @@ int fs_breadwrite(void)
|
|||
cum_io = 0;
|
||||
/* Split the transfer into chunks that don't span two blocks. */
|
||||
while (nrbytes > 0) {
|
||||
off = rem64u(position, block_size); /* offset in blk*/
|
||||
off = (unsigned)(position % block_size); /* offset in blk*/
|
||||
chunk = min(nrbytes, block_size - off);
|
||||
|
||||
/* Read or write 'chunk' bytes. */
|
||||
|
|
@ -199,8 +198,8 @@ int fs_breadwrite(void)
|
|||
position += chunk; /* position within the file */
|
||||
}
|
||||
|
||||
fs_m_out.RES_SEEK_POS_LO = ex64lo(position);
|
||||
fs_m_out.RES_SEEK_POS_HI = ex64hi(position);
|
||||
fs_m_out.RES_SEEK_POS_LO = (unsigned long)(position);
|
||||
fs_m_out.RES_SEEK_POS_HI = (unsigned long)(position>>32);
|
||||
|
||||
if (lmfs_rdwt_err() != OK) r = lmfs_rdwt_err(); /* check for disk error */
|
||||
if (lmfs_rdwt_err() == END_OF_FILE) r = OK;
|
||||
|
|
@ -248,12 +247,12 @@ int *completed; /* number of bytes copied */
|
|||
block_spec = (rip->i_mode & I_TYPE) == I_BLOCK_SPECIAL;
|
||||
|
||||
if (block_spec) {
|
||||
b = div64u(position, block_size);
|
||||
b = (unsigned long)(position / block_size);
|
||||
dev = (dev_t) rip->i_zone[0];
|
||||
} else {
|
||||
if (ex64hi(position) != 0)
|
||||
if ((unsigned long)(position>>32) != 0)
|
||||
panic("rw_chunk: position too high");
|
||||
b = read_map(rip, (off_t) ex64lo(position), 0);
|
||||
b = read_map(rip, (off_t) (unsigned long)(position), 0);
|
||||
dev = rip->i_dev;
|
||||
ino = rip->i_num;
|
||||
assert(ino != VMC_NO_INODE);
|
||||
|
|
@ -272,7 +271,7 @@ int *completed; /* number of bytes copied */
|
|||
/* Writing to or peeking a nonexistent block.
|
||||
* Create and enter in inode.
|
||||
*/
|
||||
if ((bp = new_block(rip, (off_t) ex64lo(position))) == NULL)
|
||||
if ((bp = new_block(rip, (off_t) (unsigned long)(position))) == NULL)
|
||||
return(err_code);
|
||||
}
|
||||
} else if (rw_flag == READING || rw_flag == PEEKING) {
|
||||
|
|
@ -284,7 +283,7 @@ int *completed; /* number of bytes copied */
|
|||
* the cache, acquire it, otherwise just acquire a free buffer.
|
||||
*/
|
||||
n = (chunk == block_size ? NO_READ : NORMAL);
|
||||
if (!block_spec && off == 0 && (off_t) ex64lo(position) >= rip->i_size)
|
||||
if (!block_spec && off == 0 && (off_t) (unsigned long)(position) >= rip->i_size)
|
||||
n = NO_READ;
|
||||
if(block_spec) {
|
||||
assert(ino == VMC_NO_INODE);
|
||||
|
|
@ -300,7 +299,7 @@ int *completed; /* number of bytes copied */
|
|||
assert(bp != NULL);
|
||||
|
||||
if (rw_flag == WRITING && chunk != block_size && !block_spec &&
|
||||
(off_t) ex64lo(position) >= rip->i_size && off == 0) {
|
||||
(off_t) (unsigned long)(position) >= rip->i_size && off == 0) {
|
||||
zero_block(bp);
|
||||
}
|
||||
|
||||
|
|
@ -539,14 +538,14 @@ unsigned bytes_ahead; /* bytes beyond position for immediate use */
|
|||
if (block_spec && rip->i_size == 0) {
|
||||
blocks_left = (block_t) NR_IOREQS;
|
||||
} else {
|
||||
blocks_left = (block_t) (rip->i_size-ex64lo(position)+(block_size-1)) /
|
||||
blocks_left = (block_t) (rip->i_size-(unsigned long)(position)+(block_size-1)) /
|
||||
block_size;
|
||||
|
||||
/* Go for the first indirect block if we are in its neighborhood. */
|
||||
if (!block_spec) {
|
||||
scale = rip->i_sp->s_log_zone_size;
|
||||
ind1_pos = (off_t) rip->i_ndzones * (block_size << scale);
|
||||
if ((off_t) ex64lo(position) <= ind1_pos &&
|
||||
if ((off_t) (unsigned long)(position) <= ind1_pos &&
|
||||
rip->i_size > ind1_pos) {
|
||||
blocks_ahead++;
|
||||
blocks_left++;
|
||||
|
|
@ -581,7 +580,7 @@ unsigned bytes_ahead; /* bytes beyond position for immediate use */
|
|||
position_running += block_size;
|
||||
|
||||
if(!block_spec &&
|
||||
(thisblock = read_map(rip, (off_t) ex64lo(position_running), 1)) != NO_BLOCK) {
|
||||
(thisblock = read_map(rip, (off_t) (unsigned long)(position_running), 1)) != NO_BLOCK) {
|
||||
bp = lmfs_get_block_ino(dev, thisblock, PREFETCH, rip->i_num, position_running);
|
||||
} else {
|
||||
bp = get_block(dev, block, PREFETCH);
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@
|
|||
#include <string.h>
|
||||
#include <minix/com.h>
|
||||
#include <assert.h>
|
||||
#include <minix/u64.h>
|
||||
#include "buf.h"
|
||||
#include "inode.h"
|
||||
#include "super.h"
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@
|
|||
#include <string.h>
|
||||
#include <assert.h>
|
||||
#include <minix/com.h>
|
||||
#include <minix/u64.h>
|
||||
#include <minix/bdev.h>
|
||||
#include "buf.h"
|
||||
#include "inode.h"
|
||||
|
|
|
|||
|
|
@ -28,7 +28,6 @@
|
|||
#include <minix/vfsif.h>
|
||||
#include <minix/endpoint.h>
|
||||
#include <minix/sysinfo.h>
|
||||
#include <minix/u64.h>
|
||||
#include <minix/sysinfo.h>
|
||||
#include <minix/type.h>
|
||||
#include <minix/ipc.h>
|
||||
|
|
|
|||
|
|
@ -103,8 +103,8 @@ static void pid_psinfo(int i)
|
|||
(int) proc[i].p_priority, /* process priority */
|
||||
(long) proc[i].p_user_time, /* user time */
|
||||
(long) proc[i].p_sys_time, /* system time */
|
||||
ex64hi(proc[i].p_cycles), /* execution cycles */
|
||||
ex64lo(proc[i].p_cycles)
|
||||
(unsigned long)(proc[i].p_cycles>>32), /* execution cycles */
|
||||
(unsigned long)(proc[i].p_cycles)
|
||||
);
|
||||
|
||||
memset(&vui, 0, sizeof(vui));
|
||||
|
|
@ -160,10 +160,10 @@ static void pid_psinfo(int i)
|
|||
|
||||
/* always add kernel cycles */
|
||||
buf_printf(" %lu %lu %lu %lu",
|
||||
ex64hi(proc[i].p_kipc_cycles),
|
||||
ex64lo(proc[i].p_kipc_cycles),
|
||||
ex64hi(proc[i].p_kcall_cycles),
|
||||
ex64lo(proc[i].p_kcall_cycles));
|
||||
(unsigned long)(proc[i].p_kipc_cycles>>32),
|
||||
(unsigned long)(proc[i].p_kipc_cycles),
|
||||
(unsigned long)(proc[i].p_kcall_cycles>>32),
|
||||
(unsigned long)(proc[i].p_kcall_cycles));
|
||||
|
||||
/* add total memory for tasks at the end */
|
||||
if(task) buf_printf(" %lu", vui.vui_total);
|
||||
|
|
|
|||
|
|
@ -29,7 +29,6 @@
|
|||
#include <minix/com.h>
|
||||
#include <minix/endpoint.h>
|
||||
#include <minix/ioctl.h>
|
||||
#include <minix/u64.h>
|
||||
#include "file.h"
|
||||
#include "fproc.h"
|
||||
#include "scratchpad.h"
|
||||
|
|
@ -411,8 +410,8 @@ int dev_io(
|
|||
endpoint_t ioproc;
|
||||
int ret, is_asyn;
|
||||
|
||||
pos_lo = ex64lo(pos);
|
||||
pos_high = ex64hi(pos);
|
||||
pos_lo = (unsigned long)(pos);
|
||||
pos_high = (unsigned long)(pos>>32);
|
||||
major_dev = major(dev);
|
||||
minor_dev = minor(dev);
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,6 @@
|
|||
#include <minix/callnr.h>
|
||||
#include <minix/endpoint.h>
|
||||
#include <minix/com.h>
|
||||
#include <minix/u64.h>
|
||||
#include <signal.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@
|
|||
|
||||
#include <sys/select.h>
|
||||
#include <minix/callnr.h>
|
||||
#include <minix/u64.h>
|
||||
#include <assert.h>
|
||||
#include <sys/stat.h>
|
||||
#include "fs.h"
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@
|
|||
|
||||
#include "fs.h"
|
||||
#include <minix/com.h>
|
||||
#include <minix/u64.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include "file.h"
|
||||
|
|
@ -51,9 +50,9 @@ int req; /* either F_SETLK or F_SETLKW */
|
|||
switch (flock.l_whence) {
|
||||
case SEEK_SET: first = 0; break;
|
||||
case SEEK_CUR:
|
||||
if (ex64hi(f->filp_pos) != 0)
|
||||
if ((unsigned long)(f->filp_pos>>32) != 0)
|
||||
panic("lock_op: position in file too high");
|
||||
first = ex64lo(f->filp_pos);
|
||||
first = (unsigned long)(f->filp_pos);
|
||||
break;
|
||||
case SEEK_END: first = f->filp_vno->v_size; break;
|
||||
default: return(EINVAL);
|
||||
|
|
|
|||
|
|
@ -27,7 +27,6 @@
|
|||
#include <minix/endpoint.h>
|
||||
#include <minix/com.h>
|
||||
#include <minix/sysinfo.h>
|
||||
#include <minix/u64.h>
|
||||
#include <sys/ptrace.h>
|
||||
#include <sys/svrctl.h>
|
||||
#include <sys/resource.h>
|
||||
|
|
@ -199,9 +198,9 @@ int do_fcntl(message *UNUSED(m_out))
|
|||
switch(flock_arg.l_whence) {
|
||||
case SEEK_SET: start = 0; break;
|
||||
case SEEK_CUR:
|
||||
if (ex64hi(f->filp_pos) != 0)
|
||||
if ((unsigned long)(f->filp_pos>>32) != 0)
|
||||
panic("do_fcntl: position in file too high");
|
||||
start = ex64lo(f->filp_pos);
|
||||
start = (unsigned long)(f->filp_pos);
|
||||
break;
|
||||
case SEEK_END: start = f->filp_vno->v_size; break;
|
||||
default: r = EINVAL;
|
||||
|
|
@ -376,8 +375,8 @@ int do_vm_call(message *m_out)
|
|||
int req_fd = job_m_in.VFS_VMCALL_FD;
|
||||
u32_t req_id = job_m_in.VFS_VMCALL_REQID;
|
||||
endpoint_t ep = job_m_in.VFS_VMCALL_ENDPOINT;
|
||||
u64_t offset = make64(job_m_in.VFS_VMCALL_OFFSET_LO,
|
||||
job_m_in.VFS_VMCALL_OFFSET_HI);
|
||||
u64_t offset = (u64_t)job_m_in.VFS_VMCALL_OFFSET_LO |
|
||||
((u64_t)job_m_in.VFS_VMCALL_OFFSET_HI<<32);
|
||||
u32_t length = job_m_in.VFS_VMCALL_LENGTH;
|
||||
int result = OK;
|
||||
int slot;
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@
|
|||
#include <unistd.h>
|
||||
#include <minix/callnr.h>
|
||||
#include <minix/com.h>
|
||||
#include <minix/u64.h>
|
||||
#include "file.h"
|
||||
#include "fproc.h"
|
||||
#include "scratchpad.h"
|
||||
|
|
@ -614,21 +613,18 @@ int actual_lseek(message *m_out, int seekfd, int seekwhence, off_t offset)
|
|||
default: unlock_filp(rfilp); return(EINVAL);
|
||||
}
|
||||
|
||||
if (offset >= 0)
|
||||
newpos = pos + offset;
|
||||
else
|
||||
newpos = sub64ul(pos, -offset);
|
||||
newpos = pos + offset;
|
||||
|
||||
/* Check for overflow. */
|
||||
if (ex64hi(newpos) != 0) {
|
||||
if ((unsigned long)(newpos>>32) != 0) {
|
||||
r = EOVERFLOW;
|
||||
} else if ((off_t) ex64lo(newpos) < 0) { /* no negative file size */
|
||||
} else if ((off_t) (unsigned long)(newpos) < 0) { /* no negative file size */
|
||||
r = EOVERFLOW;
|
||||
} else {
|
||||
/* insert the new position into the output message */
|
||||
m_out->reply_l1 = ex64lo(newpos);
|
||||
m_out->reply_l1 = (unsigned long)(newpos);
|
||||
|
||||
if (cmp64(newpos, rfilp->filp_pos) != 0) {
|
||||
if (newpos != rfilp->filp_pos) {
|
||||
rfilp->filp_pos = newpos;
|
||||
|
||||
/* Inhibit read ahead request */
|
||||
|
|
@ -660,7 +656,7 @@ int actual_llseek(struct fproc *rfp, message *m_out, int seekfd, int seekwhence,
|
|||
register struct filp *rfilp;
|
||||
u64_t pos, newpos;
|
||||
int r = OK;
|
||||
long off_hi = ex64hi(offset);
|
||||
long off_hi = (unsigned long)(offset>>32);
|
||||
|
||||
/* Check to see if the file descriptor is valid. */
|
||||
if ( (rfilp = get_filp2(rfp, seekfd, VNODE_READ)) == NULL) {
|
||||
|
|
@ -684,16 +680,16 @@ int actual_llseek(struct fproc *rfp, message *m_out, int seekfd, int seekwhence,
|
|||
newpos = pos + offset;
|
||||
|
||||
/* Check for overflow. */
|
||||
if ((off_hi > 0) && cmp64(newpos, pos) < 0)
|
||||
if ((off_hi > 0) && newpos < pos)
|
||||
r = EINVAL;
|
||||
else if ((off_hi < 0) && cmp64(newpos, pos) > 0)
|
||||
else if ((off_hi < 0) && newpos > pos)
|
||||
r = EINVAL;
|
||||
else {
|
||||
/* insert the new position into the output message */
|
||||
m_out->reply_l1 = ex64lo(newpos);
|
||||
m_out->reply_l2 = ex64hi(newpos);
|
||||
m_out->reply_l1 = (unsigned long)(newpos);
|
||||
m_out->reply_l2 = (unsigned long)(newpos>>32);
|
||||
|
||||
if (cmp64(newpos, rfilp->filp_pos) != 0) {
|
||||
if (newpos != rfilp->filp_pos) {
|
||||
rfilp->filp_pos = newpos;
|
||||
|
||||
/* Inhibit read ahead request */
|
||||
|
|
@ -709,7 +705,7 @@ int actual_llseek(struct fproc *rfp, message *m_out, int seekfd, int seekwhence,
|
|||
int do_llseek(message *m_out)
|
||||
{
|
||||
return actual_llseek(fp, m_out, job_m_in.ls_fd, job_m_in.whence,
|
||||
make64(job_m_in.offset_lo, job_m_in.offset_high));
|
||||
(u64_t)job_m_in.offset_lo | ((u64_t)job_m_in.offset_high<<32));
|
||||
}
|
||||
|
||||
/*===========================================================================*
|
||||
|
|
|
|||
|
|
@ -620,7 +620,7 @@ char ename[NAME_MAX + 1];
|
|||
char buf[DIR_ENTRY_SIZE * DIR_ENTRIES];
|
||||
struct dirent *cur;
|
||||
|
||||
pos = make64(0, 0);
|
||||
pos = (u64_t)0;
|
||||
|
||||
if (!S_ISDIR(dirp->v_mode)) return(EBADF);
|
||||
|
||||
|
|
|
|||
|
|
@ -23,7 +23,6 @@
|
|||
#include <minix/callnr.h>
|
||||
#include <minix/endpoint.h>
|
||||
#include <minix/com.h>
|
||||
#include <minix/u64.h>
|
||||
#include <sys/select.h>
|
||||
#include <sys/time.h>
|
||||
#include "file.h"
|
||||
|
|
|
|||
|
|
@ -14,7 +14,6 @@
|
|||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <minix/com.h>
|
||||
#include <minix/u64.h>
|
||||
#include "file.h"
|
||||
#include "fproc.h"
|
||||
#include "scratchpad.h"
|
||||
|
|
@ -217,7 +216,7 @@ int read_write(struct fproc *rfp, int rw_flag, struct filp *f,
|
|||
rw_flag, for_e, buf, size, &new_pos, &cum_io_incr);
|
||||
|
||||
if (r >= 0) {
|
||||
if (ex64hi(new_pos))
|
||||
if ((unsigned long)(new_pos>>32))
|
||||
panic("read_write: bad new pos");
|
||||
|
||||
position = new_pos;
|
||||
|
|
@ -229,11 +228,11 @@ int read_write(struct fproc *rfp, int rw_flag, struct filp *f,
|
|||
/* On write, update file size and access time. */
|
||||
if (rw_flag == WRITING) {
|
||||
if (S_ISREG(vp->v_mode) || S_ISDIR(vp->v_mode)) {
|
||||
if (cmp64ul(position, vp->v_size) > 0) {
|
||||
if (ex64hi(position) != 0) {
|
||||
if (position > (u64_t)(vp->v_size)) {
|
||||
if ((unsigned long)(position>>32) != 0) {
|
||||
panic("read_write: file size too big ");
|
||||
}
|
||||
vp->v_size = ex64lo(position);
|
||||
vp->v_size = (unsigned long)(position);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -279,7 +278,7 @@ int do_getdents(message *UNUSED(m_out))
|
|||
r = EBADF;
|
||||
|
||||
if (r == OK) {
|
||||
if (ex64hi(rfilp->filp_pos) != 0)
|
||||
if ((unsigned long)(rfilp->filp_pos>>32) != 0)
|
||||
panic("do_getdents: can't handle large offsets");
|
||||
|
||||
r = req_getdents(rfilp->filp_vno->v_fs_e, rfilp->filp_vno->v_inode_nr,
|
||||
|
|
@ -346,14 +345,14 @@ size_t req_size;
|
|||
return(r);
|
||||
}
|
||||
|
||||
if (ex64hi(new_pos))
|
||||
if ((unsigned long)(new_pos>>32))
|
||||
panic("rw_pipe: bad new pos");
|
||||
|
||||
cum_io += cum_io_incr;
|
||||
buf += cum_io_incr;
|
||||
req_size -= cum_io_incr;
|
||||
|
||||
vp->v_size = ex64lo(new_pos);
|
||||
vp->v_size = (unsigned long)(new_pos);
|
||||
|
||||
if (partial_pipe) {
|
||||
/* partial write on pipe with */
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@
|
|||
#include <minix/com.h>
|
||||
#include <minix/const.h>
|
||||
#include <minix/endpoint.h>
|
||||
#include <minix/u64.h>
|
||||
#include <unistd.h>
|
||||
#include <time.h>
|
||||
#include "fproc.h"
|
||||
|
|
@ -53,8 +52,8 @@ int req_breadwrite(
|
|||
m.m_type = rw_flag == READING ? REQ_BREAD : REQ_BWRITE;
|
||||
m.REQ_DEV2 = dev;
|
||||
m.REQ_GRANT = grant_id;
|
||||
m.REQ_SEEK_POS_LO = ex64lo(pos);
|
||||
m.REQ_SEEK_POS_HI = ex64hi(pos);
|
||||
m.REQ_SEEK_POS_LO = (unsigned long)(pos);
|
||||
m.REQ_SEEK_POS_HI = (unsigned long)(pos>>32);
|
||||
m.REQ_NBYTES = num_of_bytes;
|
||||
|
||||
/* Send/rec request */
|
||||
|
|
@ -63,7 +62,7 @@ int req_breadwrite(
|
|||
if (r != OK) return(r);
|
||||
|
||||
/* Fill in response structure */
|
||||
*new_posp = make64(m.RES_SEEK_POS_LO, m.RES_SEEK_POS_HI);
|
||||
*new_posp = (u64_t)m.RES_SEEK_POS_LO | ((u64_t)m.RES_SEEK_POS_HI<<32);
|
||||
*cum_iop = m.RES_NBYTES;
|
||||
|
||||
return(OK);
|
||||
|
|
@ -81,8 +80,8 @@ int req_bpeek(endpoint_t fs_e, dev_t dev, u64_t pos, unsigned int num_of_bytes)
|
|||
/* Fill in request message */
|
||||
m.m_type = REQ_BPEEK;
|
||||
m.REQ_DEV2 = dev;
|
||||
m.REQ_SEEK_POS_LO = ex64lo(pos);
|
||||
m.REQ_SEEK_POS_HI = ex64hi(pos);
|
||||
m.REQ_SEEK_POS_LO = (unsigned long)(pos);
|
||||
m.REQ_SEEK_POS_HI = (unsigned long)(pos>>32);
|
||||
m.REQ_NBYTES = num_of_bytes;
|
||||
|
||||
/* Send/rec request */
|
||||
|
|
@ -323,7 +322,7 @@ int req_getdents(
|
|||
m.REQ_INODE_NR = inode_nr;
|
||||
m.REQ_GRANT = grant_id;
|
||||
m.REQ_MEM_SIZE = size;
|
||||
m.REQ_SEEK_POS_LO = ex64lo(pos);
|
||||
m.REQ_SEEK_POS_LO = (unsigned long)(pos);
|
||||
m.REQ_SEEK_POS_HI = 0; /* Not used for now, so clear it. */
|
||||
|
||||
r = fs_sendrec(fs_e, &m);
|
||||
|
|
@ -786,7 +785,7 @@ unsigned int *cum_iop;
|
|||
cp_grant_id_t grant_id;
|
||||
message m;
|
||||
|
||||
if (ex64hi(pos) != 0)
|
||||
if ((unsigned long)(pos>>32) != 0)
|
||||
panic("req_readwrite: pos too large");
|
||||
|
||||
grant_id = cpf_grant_magic(fs_e, user_e, (vir_bytes) user_addr, num_of_bytes,
|
||||
|
|
@ -798,7 +797,7 @@ unsigned int *cum_iop;
|
|||
m.m_type = rw_flag == READING ? REQ_READ : REQ_WRITE;
|
||||
m.REQ_INODE_NR = inode_nr;
|
||||
m.REQ_GRANT = grant_id;
|
||||
m.REQ_SEEK_POS_LO = ex64lo(pos);
|
||||
m.REQ_SEEK_POS_LO = (unsigned long)(pos);
|
||||
m.REQ_SEEK_POS_HI = 0; /* Not used for now, so clear it. */
|
||||
m.REQ_NBYTES = num_of_bytes;
|
||||
|
||||
|
|
@ -824,14 +823,14 @@ int req_peek(endpoint_t fs_e, ino_t inode_nr, u64_t pos, unsigned int bytes)
|
|||
|
||||
memset(&m, 0, sizeof(m));
|
||||
|
||||
if (ex64hi(pos) != 0)
|
||||
if ((unsigned long)(pos>>32) != 0)
|
||||
panic("req_peek: pos too large");
|
||||
|
||||
/* Fill in request message */
|
||||
m.m_type = REQ_PEEK;
|
||||
m.REQ_INODE_NR = inode_nr;
|
||||
m.REQ_GRANT = -1;
|
||||
m.REQ_SEEK_POS_LO = ex64lo(pos);
|
||||
m.REQ_SEEK_POS_LO = (unsigned long)(pos);
|
||||
m.REQ_SEEK_POS_HI = 0; /* Not used for now, so clear it. */
|
||||
m.REQ_NBYTES = bytes;
|
||||
|
||||
|
|
|
|||
|
|
@ -12,7 +12,6 @@
|
|||
#include <sys/select.h>
|
||||
#include <sys/stat.h>
|
||||
#include <minix/com.h>
|
||||
#include <minix/u64.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user