diff options
author | nwhitehorn <nwhitehorn@FreeBSD.org> | 2015-02-01 02:02:50 +0000 |
---|---|---|
committer | nwhitehorn <nwhitehorn@FreeBSD.org> | 2015-02-01 02:02:50 +0000 |
commit | 2a6b615dd7667a073a5923f9fa0cfc7bf0ad7f0d (patch) | |
tree | 7fec1b9f8324b71fdd1cc95a17acaae5054a06fc /sys/boot/powerpc/kboot | |
parent | 86d69c3d82531ea11c08fd6aa551c04cbd9dbc6e (diff) | |
download | FreeBSD-src-2a6b615dd7667a073a5923f9fa0cfc7bf0ad7f0d.zip FreeBSD-src-2a6b615dd7667a073a5923f9fa0cfc7bf0ad7f0d.tar.gz |
Allow this to work with disks greater than 4 GB and with names not beginning
with "s".
Diffstat (limited to 'sys/boot/powerpc/kboot')
-rw-r--r-- | sys/boot/powerpc/kboot/host_syscall.S | 10 | ||||
-rw-r--r-- | sys/boot/powerpc/kboot/host_syscall.h | 2 | ||||
-rw-r--r-- | sys/boot/powerpc/kboot/hostdisk.c | 19 |
3 files changed, 19 insertions, 12 deletions
diff --git a/sys/boot/powerpc/kboot/host_syscall.S b/sys/boot/powerpc/kboot/host_syscall.S index 9e8a797..3607fdb 100644 --- a/sys/boot/powerpc/kboot/host_syscall.S +++ b/sys/boot/powerpc/kboot/host_syscall.S @@ -1,3 +1,8 @@ +/* + * + * $FreeBSD$ + */ + #include <machine/asm.h> ENTRY(host_read) @@ -16,7 +21,10 @@ ENTRY(host_write) blr ENTRY(host_seek) - li %r0, 19 # SYS_lseek + mr %r4,%r5 + mr %r5,%r6 + mr %r6,%r7 + li %r0, 140 # SYS_llseek sc blr diff --git a/sys/boot/powerpc/kboot/host_syscall.h b/sys/boot/powerpc/kboot/host_syscall.h index 58518a9..0d47bd5 100644 --- a/sys/boot/powerpc/kboot/host_syscall.h +++ b/sys/boot/powerpc/kboot/host_syscall.h @@ -32,7 +32,7 @@ ssize_t host_read(int fd, void *buf, size_t nbyte); ssize_t host_write(int fd, const void *buf, size_t nbyte); -ssize_t host_seek(int fd, int offset, int whence); +ssize_t host_seek(int fd, int64_t offset, int whence); int host_open(char *path, int flags, int mode); int host_close(int fd); void *host_mmap(void *addr, size_t len, int prot, int flags, int fd, int); diff --git a/sys/boot/powerpc/kboot/hostdisk.c b/sys/boot/powerpc/kboot/hostdisk.c index c6be8af..2deb956 100644 --- a/sys/boot/powerpc/kboot/hostdisk.c +++ b/sys/boot/powerpc/kboot/hostdisk.c @@ -40,7 +40,7 @@ static int hostdisk_ioctl(struct open_file *f, u_long cmd, void *data); static void hostdisk_print(int verbose); struct devsw hostdisk = { - "s", + "/dev", DEVT_DISK, hostdisk_init, hostdisk_strategy, @@ -67,8 +67,10 @@ hostdisk_strategy(void *devdata, int flag, daddr_t dblk, size_t size, pos = dblk * 512; - if (host_seek(desc->d_unit, pos, 0) < 0) + if (host_seek(desc->d_unit, pos, 0) < 0) { + printf("Seek error\n"); return (EIO); + } n = host_read(desc->d_unit, buf, size); if (n < 0) @@ -82,22 +84,19 @@ static int hostdisk_open(struct open_file *f, ...) { struct devdesc *desc; - char *path; va_list vl; va_start(vl, f); desc = va_arg(vl, struct devdesc *); va_end(vl); - path = malloc(strlen((char *)(desc->d_opendata)) + 6); - strcpy(path, "/dev/"); - strcat(path, (char *)(desc->d_opendata)); + desc->d_unit = host_open(desc->d_opendata, O_RDONLY, 0); - desc->d_unit = host_open(path, O_RDONLY, 0); - free(path); - - if (desc->d_unit <= 0) + if (desc->d_unit <= 0) { + printf("hostdisk_open: couldn't open %s: %d\n", + desc->d_opendata, desc->d_unit); return (ENOENT); + } return (0); } |