summaryrefslogtreecommitdiffstats
path: root/src/net/tcp
diff options
context:
space:
mode:
authorMichael Brown2006-05-19 17:06:51 +0200
committerMichael Brown2006-05-19 17:06:51 +0200
commitd48d0fb1bb53262bf44a03dbe8388529f1566a1c (patch)
tree31081f33dbeb48c42d2e4cf806570853162781d9 /src/net/tcp
parentUse typeof(sizeof(...)) to define a size_t. This stops gcc complaining (diff)
downloadipxe-d48d0fb1bb53262bf44a03dbe8388529f1566a1c.tar.gz
ipxe-d48d0fb1bb53262bf44a03dbe8388529f1566a1c.tar.xz
ipxe-d48d0fb1bb53262bf44a03dbe8388529f1566a1c.zip
Add the concept of a "user pointer" (similar to the void __user * in
the kernel), which encapsulates the information needed to refer to an external buffer. Under normal operation, this can just be a void * equivalent, but under -DKEEP_IT_REAL it would be a segoff_t equivalent. Use this concept to avoid the need for bounce buffers in int13.c, which reduces memory usage and opens up the possibility of using multi-sector reads. Extend the block-device API and the SCSI block device implementation to support multi-sector reads. Update iscsi.c to use user buffers. Move the obsolete portions of realmode.h to old_realmode.h. MS-DOS now boots an order of magnitude faster over iSCSI (~10 seconds from power-up to C:> prompt in bochs).
Diffstat (limited to 'src/net/tcp')
-rw-r--r--src/net/tcp/iscsi.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/net/tcp/iscsi.c b/src/net/tcp/iscsi.c
index 633c895c..d7c4b120 100644
--- a/src/net/tcp/iscsi.c
+++ b/src/net/tcp/iscsi.c
@@ -24,6 +24,7 @@
#include <byteswap.h>
#include <gpxe/scsi.h>
#include <gpxe/process.h>
+#include <gpxe/uaccess.h>
#include <gpxe/iscsi.h>
/** @file
@@ -130,7 +131,7 @@ static void iscsi_rx_data_in ( struct iscsi_session *iscsi, void *data,
assert ( iscsi->command != NULL );
assert ( iscsi->command->data_in != NULL );
assert ( ( offset + len ) <= iscsi->command->data_in_len );
- memcpy ( ( iscsi->command->data_in + offset ), data, len );
+ copy_to_user ( iscsi->command->data_in, offset, data, len );
/* Record SCSI status, if present */
if ( data_in->flags & ISCSI_DATA_FLAG_STATUS )
@@ -234,7 +235,11 @@ static void iscsi_tx_data_out ( struct iscsi_session *iscsi ) {
assert ( iscsi->command->data_out != NULL );
assert ( ( offset + len ) <= iscsi->command->data_out_len );
- tcp_send ( &iscsi->tcp, iscsi->command->data_out + offset, len );
+ if ( len > tcp_buflen )
+ len = tcp_buflen;
+ copy_from_user ( tcp_buffer, iscsi->command->data_out, offset, len );
+
+ tcp_send ( &iscsi->tcp, tcp_buffer, len );
}
/****************************************************************************