|
|
1.1 root 1: /*
2: * Copyright (c) 1995-1994 The University of Utah and
3: * the Computer Systems Laboratory at the University of Utah (CSL).
4: * All rights reserved.
5: *
6: * Permission to use, copy, modify and distribute this software is hereby
7: * granted provided that (1) source code retains these copyright, permission,
8: * and disclaimer notices, and (2) redistributions including binaries
9: * reproduce the notices in supporting documentation, and (3) all advertising
10: * materials mentioning features or use of this software display the following
11: * acknowledgement: ``This product includes software developed by the
12: * Computer Systems Laboratory at the University of Utah.''
13: *
14: * THE UNIVERSITY OF UTAH AND CSL ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS
15: * IS" CONDITION. THE UNIVERSITY OF UTAH AND CSL DISCLAIM ANY LIABILITY OF
16: * ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
17: *
18: * CSL requests users of this software to return to [email protected] any
19: * improvements that they make and grant CSL redistribution rights.
20: *
21: * Author: Bryan Ford, University of Utah CSL
22: */
23: #ifndef _i386_kernel_dos_dos_io_h_
24: #define _i386_kernel_dos_dos_io_h_
25:
26: #include <mach/machine/vm_types.h>
27:
28: #include "real.h"
29: #include "debug.h"
30:
31: struct stat;
32: struct timeval;
33: struct timezone;
34: struct termios;
35:
36: typedef int dos_fd_t;
37:
38: /* Maximum number of bytes we can read or write with one DOS call
39: to or from memory not in the low 1MB accessible to DOS.
40: Must be less than 64KB.
41: Try to keep this size on a sector (512-byte) boundary for performance. */
42: #ifndef DOS_BUF_SIZE
43: #define DOS_BUF_SIZE 0x1000
44: #endif
45:
46: /* If DOS_BUF_DYNAMIC is set, then dos_buf is a pointer
47: which must be provided and initialized by calling code.
48: Otherwise, the dos_buf is a statically-allocated bss array. */
49: #ifdef DOS_BUF_DYNAMIC
50: extern char *dos_buf;
51: #else
52: extern char dos_buf[DOS_BUF_SIZE];
53: #endif
54:
55: int dos_check_err(struct real_call_data *rcd);
56:
57: int dos_open(const char *s, int flags, int create_mode, dos_fd_t *out_fh);
58: int dos_close(dos_fd_t fd);
59: int dos_read(dos_fd_t fd, void *buf, vm_size_t size, vm_size_t *out_actual);
60: int dos_write(dos_fd_t fd, const void *buf, vm_size_t size, vm_size_t *out_actual);
61: int dos_seek(dos_fd_t fd, vm_offset_t offset, int whence, vm_offset_t *out_newpos);
62: int dos_fstat(dos_fd_t fd, struct stat *st);
63: int dos_tcgetattr(dos_fd_t fd, struct termios *t);
64: int dos_rename(const char *oldpath, const char *newpath);
65: int dos_unlink(const char *filename);
66:
67: int dos_gettimeofday(struct timeval *tv, struct timezone *tz);
68:
69: #define dos_init_rcd(rcd) real_call_data_init(rcd)
70:
71: #define real_set_ds_dx(ptr) \
72: ({ unsigned ofs = (unsigned)(ptr); \
73: assert(ofs < 0x10000); \
74: real_call_data.ds = real_cs; \
75: real_call_data.edx = ofs; \
76: })
77: #define real_set_es_di(ptr) \
78: ({ unsigned ofs = (unsigned)(ptr); \
79: assert(ofs < 0x10000); \
80: real_call_data.es = real_cs; \
81: real_call_data.edi = ofs; \
82: })
83:
84:
85: #endif _i386_kernel_dos_dos_io_h_
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.