Date: Tue, 30 Dec 2014 14:50:04 +0000 (UTC) From: Nathan Whitehorn <nwhitehorn@FreeBSD.org> To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r276410 - user/nwhitehorn/kboot/powerpc/kboot Message-ID: <201412301450.sBUEo4rg074564@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: nwhitehorn Date: Tue Dec 30 14:50:03 2014 New Revision: 276410 URL: https://svnweb.freebsd.org/changeset/base/276410 Log: Port to Linux. Modified: user/nwhitehorn/kboot/powerpc/kboot/host_syscall.S user/nwhitehorn/kboot/powerpc/kboot/host_syscall.h user/nwhitehorn/kboot/powerpc/kboot/hostcons.c user/nwhitehorn/kboot/powerpc/kboot/hostdisk.c user/nwhitehorn/kboot/powerpc/kboot/main.c Modified: user/nwhitehorn/kboot/powerpc/kboot/host_syscall.S ============================================================================== --- user/nwhitehorn/kboot/powerpc/kboot/host_syscall.S Tue Dec 30 12:47:44 2014 (r276409) +++ user/nwhitehorn/kboot/powerpc/kboot/host_syscall.S Tue Dec 30 14:50:03 2014 (r276410) @@ -11,13 +11,17 @@ ENTRY(host_write) blr ENTRY(host_seek) - li %r0, 478 # SYS_lseek + li %r0, 19 # SYS_lseek sc blr ENTRY(host_open) li %r0, 5 # SYS_open sc + bso 1f + blr +1: + li %r3, 0 blr ENTRY(host_close) @@ -26,17 +30,17 @@ ENTRY(host_close) blr ENTRY(host_mmap) - li %r0, 477 # SYS_mmap + li %r0, 90 # SYS_mmap sc blr ENTRY(host_gettimeofday) - li %r0, 116 # SYS_gettimeofday + li %r0, 78 # SYS_gettimeofday sc blr ENTRY(host_select) - li %r0, 93 # SYS_select + li %r0, 82 # SYS_select sc blr Modified: user/nwhitehorn/kboot/powerpc/kboot/host_syscall.h ============================================================================== --- user/nwhitehorn/kboot/powerpc/kboot/host_syscall.h Tue Dec 30 12:47:44 2014 (r276409) +++ user/nwhitehorn/kboot/powerpc/kboot/host_syscall.h Tue Dec 30 14:50:03 2014 (r276410) @@ -1,5 +1,5 @@ /*- - * Copyright (C) 2010 Nathan Whitehorn + * Copyright (C) 2014 Nathan Whitehorn * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -32,11 +32,11 @@ 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, uint64_t offset, int whence); +ssize_t host_seek(int fd, int 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, off_t); -#define host_getmem(size) host_mmap(0, size, 3 /* RW */, 0x1000 /* ANON */, -1, 0); +void *host_mmap(void *addr, size_t len, int prot, int flags, int fd, int); +#define host_getmem(size) host_mmap(0, size, 3 /* RW */, 0x22 /* ANON */, -1, 0); struct host_timeval { int tv_sec; int tv_usec; Modified: user/nwhitehorn/kboot/powerpc/kboot/hostcons.c ============================================================================== --- user/nwhitehorn/kboot/powerpc/kboot/hostcons.c Tue Dec 30 12:47:44 2014 (r276409) +++ user/nwhitehorn/kboot/powerpc/kboot/hostcons.c Tue Dec 30 14:50:03 2014 (r276410) @@ -59,6 +59,7 @@ hostcons_init(int arg) { /* XXX: set nonblocking */ + /* tcsetattr(~(ICANON | ECHO)) */ return (0); } Modified: user/nwhitehorn/kboot/powerpc/kboot/hostdisk.c ============================================================================== --- user/nwhitehorn/kboot/powerpc/kboot/hostdisk.c Tue Dec 30 12:47:44 2014 (r276409) +++ user/nwhitehorn/kboot/powerpc/kboot/hostdisk.c Tue Dec 30 14:50:03 2014 (r276410) @@ -40,7 +40,7 @@ static int hostdisk_ioctl(struct open_fi static void hostdisk_print(int verbose); struct devsw hostdisk = { - "a", + "s", DEVT_DISK, hostdisk_init, hostdisk_strategy, @@ -96,7 +96,7 @@ hostdisk_open(struct open_file *f, ...) desc->d_unit = host_open(path, O_RDONLY, 0); free(path); - if (desc->d_unit < 0) + if (desc->d_unit <= 0) return (ENOENT); return (0); Modified: user/nwhitehorn/kboot/powerpc/kboot/main.c ============================================================================== --- user/nwhitehorn/kboot/powerpc/kboot/main.c Tue Dec 30 12:47:44 2014 (r276409) +++ user/nwhitehorn/kboot/powerpc/kboot/main.c Tue Dec 30 14:50:03 2014 (r276410) @@ -93,6 +93,7 @@ main(int argc, const char **argv) { void *heapbase; const size_t heapsize = 15*1024*1024; + const char *bootdev = argv[1]; /* * Set the heap to one page after the end of the loader. @@ -105,7 +106,7 @@ main(int argc, const char **argv) */ cons_probe(); - printf("Boot device: %s\n", argv[1]); + printf("Boot device: %s\n", bootdev); archsw.arch_getdev = kboot_getdev; archsw.arch_copyin = kboot_copyin; @@ -117,8 +118,8 @@ main(int argc, const char **argv) printf("%s, Revision %s\n", bootprog_name, bootprog_rev); printf("(%s, %s)\n", bootprog_maker, bootprog_date); - setenv("currdev", argv[1], 1); - setenv("loaddev", argv[1], 1); + setenv("currdev", bootdev, 1); + setenv("loaddev", bootdev, 1); setenv("LINES", "24", 1); interact(NULL); /* doesn't return */ @@ -281,6 +282,7 @@ kboot_autoload(void) void _start(int argc, const char **argv, char **env) { - main(argc, argv); + register volatile void **sp asm("r1"); + main((int)sp[0], (const char **)&sp[1]); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201412301450.sBUEo4rg074564>