Hi,

Here are the two patches for NetBSD and FreeBSD users based on
todays CVS.

1) Fixes for loff_t.
I've re-attached the patch submitted recently under the title
"NetBSD Patch"

This patch is is needed for NetBSD and for FreeBSD which do
not have loff_t for lseek(). They still use off_t.

2) FreeBSD header file fix.
A simple patch to host-freebsd.c to build on FreeBSD 4.x


I have also copied the patches to my ftp site, at
 ftp://telepresence.dmem.strath.ac.uk/pub/general/patch1
 ftp://telepresence.dmem.strath.ac.uk/pub/general/patch2


Please can someone commit these to the CVS source.


Thanks
Roger
--
Roger Hardiman
Strathclyde Uni Telepresence Research Group, Glasgow, Scotland.
http://www.telepresence.strath.ac.uk      0141 548 2897
[EMAIL PROTECTED]
diff -r -p -c plex86.orig/config.h.in plex86/config.h.in
*** plex86.orig/config.h.in     Thu Dec 14 06:13:36 2000
--- plex86/config.h.in  Tue Feb 27 08:24:39 2001
***************
*** 41,46 ****
--- 41,48 ----
  #  error "can't find data type of 8 bytes"
  #endif
  
+ #define LOFF_T loff_t
+ 
  typedef unsigned int Boolean;
  
  #define PLEX86    1
Only in plex86: config.h.in.orig
diff -r -p -c plex86.orig/configure.in plex86/configure.in
*** plex86.orig/configure.in    Sun Jan 21 16:17:15 2001
--- plex86/configure.in Tue Feb 27 08:23:44 2001
*************** AC_CHECK_LIB(dl, dlopen,
*** 26,31 ****
--- 26,37 ----
    LIBDL='')
  AC_SUBST(LIBDL)
  
+ dnl Use loff_t if available
+ AC_MSG_CHECKING(type of file offsets)
+ AC_EGREP_CPP(loff_t, [#include <sys/types.h>], LOFF_T=loff_t, LOFF_T=off_t)
+ AC_MSG_RESULT($LOFF_T)
+ AC_DEFINE_UNQUOTED(LOFF_T, $LOFF_T)
+ 
  dnl When compiling with gcc, use appropriate warning level
  if test "$GCC" = "yes"; then
    CFLAGS="$CFLAGS -Wall -Wstrict-prototypes"
Only in plex86: configure.in.orig
diff -r -p -c plex86.orig/user/plugins/bochs/iodev/harddrv.cc 
plex86/user/plugins/bochs/iodev/harddrv.cc
*** plex86.orig/user/plugins/bochs/iodev/harddrv.cc     Mon Jan  1 15:58:28 2001
--- plex86/user/plugins/bochs/iodev/harddrv.cc  Tue Feb 27 08:19:57 2001
*************** bx_hard_drive_c::read(Bit32u address, un
*** 313,326 ****
                }
              else { /* read next one into controller buffer */
                unsigned long logical_sector;
!               loff_t ret;
  
                BX_SELECTED_CONTROLLER.status.drq = 1;
                BX_SELECTED_CONTROLLER.status.seek_complete = 1;
  
              logical_sector = calculate_logical_address();
  
!             ret = BX_SELECTED_HD.hard_drive->lseek((loff_t)logical_sector * 512, 
SEEK_SET);
  
                if (ret == -1)
                  bx_panic("disk: could lseek() hard drive image file\n");
--- 313,326 ----
                }
              else { /* read next one into controller buffer */
                unsigned long logical_sector;
!               LOFF_T ret;
  
                BX_SELECTED_CONTROLLER.status.drq = 1;
                BX_SELECTED_CONTROLLER.status.seek_complete = 1;
  
              logical_sector = calculate_logical_address();
  
!             ret = BX_SELECTED_HD.hard_drive->lseek((LOFF_T)logical_sector * 512, 
SEEK_SET);
  
                if (ret == -1)
                  bx_panic("disk: could lseek() hard drive image file\n");
*************** bx_hard_drive_c::write(Bit32u address, B
*** 668,678 ****
            /* if buffer completely writtten */
            if (BX_SELECTED_CONTROLLER.buffer_index >= 512) {
              unsigned long logical_sector;
!             loff_t ret;
  
            logical_sector = calculate_logical_address();
  
!           ret = BX_SELECTED_HD.hard_drive->lseek((loff_t)logical_sector * 512, 
SEEK_SET);
              if (ret == -1)
                bx_panic("disk: could lseek() hard drive image file\n");
  
--- 668,678 ----
            /* if buffer completely writtten */
            if (BX_SELECTED_CONTROLLER.buffer_index >= 512) {
              unsigned long logical_sector;
!             LOFF_T ret;
  
            logical_sector = calculate_logical_address();
  
!           ret = BX_SELECTED_HD.hard_drive->lseek((LOFF_T)logical_sector * 512, 
SEEK_SET);
              if (ret == -1)
                bx_panic("disk: could lseek() hard drive image file\n");
  
*************** bx_hard_drive_c::write(Bit32u address, B
*** 1293,1299 ****
  
          logical_sector = calculate_logical_address();
  
!         ret = BX_SELECTED_HD.hard_drive->lseek((loff_t)logical_sector * 512, 
SEEK_SET);
  
            if (ret == -1) {
              bx_panic("disk: could not lseek() hard drive image file\n");
--- 1293,1299 ----
  
          logical_sector = calculate_logical_address();
  
!         ret = BX_SELECTED_HD.hard_drive->lseek((LOFF_T)logical_sector * 512, 
SEEK_SET);
  
            if (ret == -1) {
              bx_panic("disk: could not lseek() hard drive image file\n");
*************** void default_image_t::close ()
*** 2307,2313 ****
        }
  }
  
! loff_t default_image_t::lseek (loff_t offset, int whence)
  {
        return pluginWCLSeek(fd, offset, whence);
  }
--- 2307,2313 ----
        }
  }
  
! LOFF_T default_image_t::lseek (LOFF_T offset, int whence)
  {
        return pluginWCLSeek(fd, offset, whence);
  }
diff -r -p -c plex86.orig/user/plugins/bochs/iodev/harddrv.h 
plex86/user/plugins/bochs/iodev/harddrv.h
*** plex86.orig/user/plugins/bochs/iodev/harddrv.h      Mon Jan  1 15:58:28 2001
--- plex86/user/plugins/bochs/iodev/harddrv.h   Tue Feb 27 08:20:29 2001
*************** class device_image_t
*** 45,51 ****
  
        // Position ourselves. Return the resulting offset from the
        // beginning of the file.
!       virtual loff_t lseek (loff_t offset, int whence) = 0;
  
        // Read count bytes to the buffer buf. Return the number of
        // bytes read (count).
--- 45,51 ----
  
        // Position ourselves. Return the resulting offset from the
        // beginning of the file.
!       virtual LOFF_T lseek (LOFF_T offset, int whence) = 0;
  
        // Read count bytes to the buffer buf. Return the number of
        // bytes read (count).
*************** class default_image_t : public device_im
*** 71,77 ****
  
        // Position ourselves. Return the resulting offset from the
        // beginning of the file.
!       loff_t lseek (loff_t offset, int whence);
  
        // Read count bytes to the buffer buf. Return the number of
        // bytes read (count).
--- 71,77 ----
  
        // Position ourselves. Return the resulting offset from the
        // beginning of the file.
!       LOFF_T lseek (LOFF_T offset, int whence);
  
        // Read count bytes to the buffer buf. Return the number of
        // bytes read (count).
diff -r -p -c plex86.orig/user/plugins/write-cache/write-cache.cc 
plex86/user/plugins/write-cache/write-cache.cc
*** plex86.orig/user/plugins/write-cache/write-cache.cc Sun Jan  7 04:38:16 2001
--- plex86/user/plugins/write-cache/write-cache.cc      Tue Feb 27 08:20:52 2001
*************** extern "C" long long llseek (int fd, lon
*** 167,173 ****
  
  void WriteCache::DoSeek()
  {
!   loff_t result;
  
  #if 1
    if (!mustseek)
--- 167,173 ----
  
  void WriteCache::DoSeek()
  {
!   LOFF_T result;
  
  #if 1
    if (!mustseek)
*** plex86.orig/kernel/host-freebsd.c   Sat Dec 30 15:17:49 2000
--- plex86/kernel/host-freebsd.c        Tue Feb 27 08:46:27 2001
***************
*** 44,49 ****
--- 44,53 ----
  
  #include <vm/vm.h>
  
+ #if (__FreeBSD_version < 500000)
+ #include <machine/ipl.h>
+ #endif
+ 
  #include <machine/cpu.h>
  
  #undef timer_t

Reply via email to