OpenCores
URL https://opencores.org/ocsvn/zet86/zet86/trunk

Subversion Repositories zet86

[/] [zet86/] [trunk/] [src/] [bochs-diff-2.3.7/] [iodev/] [iodev.h] - Blame information for rev 52

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 39 zeus
/////////////////////////////////////////////////////////////////////////
2 52 zeus
// $Id: iodev.h,v 1.92 2008/04/17 14:39:32 sshwarts Exp $
3 39 zeus
/////////////////////////////////////////////////////////////////////////
4
//
5
//  Copyright (C) 2002  MandrakeSoft S.A.
6
//
7
//    MandrakeSoft S.A.
8
//    43, rue d'Aboukir
9
//    75002 Paris - France
10
//    http://www.linux-mandrake.com/
11
//    http://www.mandrakesoft.com/
12
//
13
//  I/O port handlers API Copyright (C) 2003 by Frank Cornelis
14
//
15
//  This library is free software; you can redistribute it and/or
16
//  modify it under the terms of the GNU Lesser General Public
17
//  License as published by the Free Software Foundation; either
18
//  version 2 of the License, or (at your option) any later version.
19
//
20
//  This library is distributed in the hope that it will be useful,
21
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
22
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
23
//  Lesser General Public License for more details.
24
//
25
//  You should have received a copy of the GNU Lesser General Public
26
//  License along with this library; if not, write to the Free Software
27
//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
28
//
29
/////////////////////////////////////////////////////////////////////////
30
 
31
#ifndef IODEV_H
32
#define IODEV_H
33
 
34
#include "bochs.h"
35
 
36
/* maximum number of emulated devices allowed.  floppy, vga, etc...
37
   you can increase this to anything below 256 since an 8-bit handle
38
   is used for each device */
39
#define BX_MAX_IO_DEVICES 30
40
 
41
/* the last device in the array is the "default" I/O device */
42
#define BX_DEFAULT_IO_DEVICE   (BX_MAX_IO_DEVICES-1)
43
 
44
/* number of IRQ lines supported.  In an ISA PC there are two
45
   PIC chips cascaded together.  each has 8 IRQ lines, so there
46
   should be 16 IRQ's total */
47
#define BX_MAX_IRQS 16
48
#define BX_NO_IRQ  -1
49
 
50
class bx_pit_c;
51
#if BX_SUPPORT_APIC
52
class bx_ioapic_c;
53
#endif
54
#if BX_SUPPORT_IODEBUG
55
class bx_iodebug_c;
56
#endif
57
#if 0
58
class bx_g2h_c;
59
#endif
60
 
61
typedef Bit32u (*bx_read_handler_t)(void *, Bit32u, unsigned);
62
typedef void   (*bx_write_handler_t)(void *, Bit32u, Bit32u, unsigned);
63
 
64
#if BX_USE_DEV_SMF
65
#  define BX_DEV_SMF  static
66
#  define BX_DEV_THIS bx_devices.
67
#else
68
#  define BX_DEV_SMF
69
#  define BX_DEV_THIS this->
70
#endif
71
 
72
//////////////////////////////////////////////////////////////////////
73
// bx_devmodel_c declaration
74
//////////////////////////////////////////////////////////////////////
75
 
76
// This class defines virtual methods that are common to all devices.
77
// Child classes do not need to implement all of them, because in this
78
// definition they are defined as empty, as opposed to being pure
79
// virtual (= 0).
80
class BOCHSAPI bx_devmodel_c : public logfunctions {
81
  public:
82
  virtual ~bx_devmodel_c() {}
83
  virtual void init_mem(BX_MEM_C *) {}
84
  virtual void init(void) {}
85
  virtual void reset(unsigned type) {}
86
  virtual void register_state(void) {}
87
  virtual void after_restore_state(void) {}
88
};
89
 
90
//////////////////////////////////////////////////////////////////////
91
// declare stubs for PCI devices
92
//////////////////////////////////////////////////////////////////////
93
 
94
class bx_list_c;
95
 
96
// the best should be deriving of bx_pci_device_stub_c from bx_devmodel_c
97
// but it make serious problems for cirrus_svga device
98
class BOCHSAPI bx_pci_device_stub_c {
99
public:
100
  virtual ~bx_pci_device_stub_c() {}
101
 
102
  virtual Bit32u pci_read_handler(Bit8u address, unsigned io_len) {
103
    return 0;
104
  }
105
 
106
  virtual void pci_write_handler(Bit8u address, Bit32u value, unsigned io_len) {}
107
 
108
  void register_pci_state(bx_list_c *list, Bit8u *pci_conf);
109
};
110
 
111
//////////////////////////////////////////////////////////////////////
112
// declare stubs for devices
113
//////////////////////////////////////////////////////////////////////
114
 
115
//////////////////////////////////////////////////////////////////////
116
#define STUBFUNC(dev,method) \
117
   pluginlog->panic("%s called in %s stub. you must not have loaded the %s plugin", #dev, #method, #dev)
118
//////////////////////////////////////////////////////////////////////
119
 
120
class BOCHSAPI bx_keyb_stub_c : public bx_devmodel_c {
121
public:
122
  virtual ~bx_keyb_stub_c() {}
123
  // stubs for bx_keyb_c methods
124
  virtual void mouse_motion(int delta_x, int delta_y, int delta_z, unsigned button_state) {
125
    STUBFUNC(keyboard, mouse_motion);
126
  }
127
  virtual void gen_scancode(Bit32u key) {
128
    STUBFUNC(keyboard, gen_scancode);
129
  }
130
  virtual void paste_bytes(Bit8u *data, Bit32s length) {
131
    STUBFUNC(keyboard, paste_bytes);
132
  }
133
};
134
 
135
class BOCHSAPI bx_hard_drive_stub_c : public bx_devmodel_c {
136
public:
137
  virtual void   init() {
138
    STUBFUNC(HD, init);
139
  }
140
  virtual void   reset(unsigned type) {
141
    STUBFUNC(HD, reset);
142
  }
143
  virtual Bit32u   get_device_handle(Bit8u channel, Bit8u device) {
144
    STUBFUNC(HD, get_device_handle); return 0;
145
  }
146
  virtual Bit32u   get_first_cd_handle(void) {
147
    STUBFUNC(HD, get_first_cd_handle); return 0;
148
  }
149
  virtual unsigned get_cd_media_status(Bit32u handle) {
150
    STUBFUNC(HD, get_cd_media_status); return 0;
151
  }
152
  virtual unsigned set_cd_media_status(Bit32u handle, unsigned status) {
153
    STUBFUNC(HD, set_cd_media_status); return 0;
154
  }
155
  virtual Bit32u virt_read_handler(Bit32u address, unsigned io_len)
156
  {
157
    STUBFUNC(HD, virt_read_handler); return 0;
158
  }
159
  virtual void   virt_write_handler(Bit32u address,
160
      Bit32u value, unsigned io_len)
161
  {
162
    STUBFUNC(HD, virt_write_handler);
163
  }
164
  virtual bx_bool bmdma_read_sector(Bit8u channel, Bit8u *buffer, Bit32u *sector_size) {
165
    STUBFUNC(HD, bmdma_read_sector); return 0;
166
  }
167
  virtual bx_bool bmdma_write_sector(Bit8u channel, Bit8u *buffer) {
168
    STUBFUNC(HD, bmdma_write_sector); return 0;
169
  }
170
  virtual void bmdma_complete(Bit8u channel) {
171
    STUBFUNC(HD, bmdma_complete);
172
  }
173
};
174
 
175
class BOCHSAPI bx_floppy_stub_c : public bx_devmodel_c {
176
public:
177
  virtual unsigned get_media_status(unsigned drive) {
178
    STUBFUNC(floppy,  get_media_status); return 0;
179
  }
180
  virtual unsigned set_media_status(unsigned drive, unsigned status) {
181
    STUBFUNC(floppy, set_media_status); return 0;
182
  }
183
};
184
 
185
class BOCHSAPI bx_cmos_stub_c : public bx_devmodel_c {
186
public:
187
  virtual Bit32u get_reg(unsigned reg) {
188
    STUBFUNC(cmos, get_reg); return 0;
189
  }
190
  virtual void set_reg(unsigned reg, Bit32u val) {
191
    STUBFUNC(cmos, set_reg);
192
  }
193
  virtual time_t get_timeval() {
194
    return 0;
195
  }
196
  virtual void checksum_cmos(void) {
197
    STUBFUNC(cmos, checksum);
198
  }
199
};
200
 
201
class BOCHSAPI bx_dma_stub_c : public bx_devmodel_c {
202
public:
203
  virtual unsigned registerDMA8Channel(
204
    unsigned channel,
205
    void (* dmaRead)(Bit8u *data_byte),
206
    void (* dmaWrite)(Bit8u *data_byte),
207
    const char *name)
208
  {
209
    STUBFUNC(dma, registerDMA8Channel); return 0;
210
  }
211
  virtual unsigned registerDMA16Channel(
212
    unsigned channel,
213
    void (* dmaRead)(Bit16u *data_word),
214
    void (* dmaWrite)(Bit16u *data_word),
215
    const char *name)
216
  {
217
    STUBFUNC(dma, registerDMA16Channel); return 0;
218
  }
219
  virtual unsigned unregisterDMAChannel(unsigned channel) {
220
    STUBFUNC(dma, unregisterDMAChannel); return 0;
221
  }
222
  virtual unsigned get_TC(void) {
223
    STUBFUNC(dma, get_TC); return 0;
224
  }
225
  virtual void set_DRQ(unsigned channel, bx_bool val) {
226
    STUBFUNC(dma, set_DRQ);
227
  }
228
  virtual void raise_HLDA(void) {
229
    STUBFUNC(dma, raise_HLDA);
230
  }
231
};
232
 
233
class BOCHSAPI bx_pic_stub_c : public bx_devmodel_c {
234
public:
235
  virtual void raise_irq(unsigned irq_no) {
236
    STUBFUNC(pic, raise_irq);
237
  }
238
  virtual void lower_irq(unsigned irq_no) {
239
    STUBFUNC(pic, lower_irq);
240
  }
241
  virtual void set_mode(bx_bool ma_sl, Bit8u mode) {
242
    STUBFUNC(pic, set_mode);
243
  }
244
  virtual Bit8u IAC(void) {
245
    STUBFUNC(pic, IAC); return 0;
246
  }
247
  virtual void show_pic_state(void) {
248
    STUBFUNC(pic, show_pic_state);
249
  }
250
};
251
 
252
class BOCHSAPI bx_vga_stub_c : public bx_devmodel_c {
253
public:
254
  virtual void redraw_area(unsigned x0, unsigned y0,
255
                           unsigned width, unsigned height) {
256
    STUBFUNC(vga, redraw_area);
257
  }
258
  virtual Bit8u mem_read(Bit32u addr) {
259
    STUBFUNC(vga, mem_read);  return 0;
260
  }
261
  virtual void mem_write(Bit32u addr, Bit8u value) {
262
    STUBFUNC(vga, mem_write);
263
  }
264
  virtual void get_text_snapshot(Bit8u **text_snapshot,
265
                                 unsigned *txHeight, unsigned *txWidth) {
266
    STUBFUNC(vga, get_text_snapshot);
267
  }
268
  virtual void trigger_timer(void *this_ptr) {
269
    STUBFUNC(vga, trigger_timer);
270
  }
271
  virtual Bit8u get_actl_palette_idx(Bit8u index) {
272
    return 0;
273
  }
274
  virtual void dump_status(void) {}
275
};
276
 
277
class BOCHSAPI bx_pci_bridge_stub_c : public bx_devmodel_c, public bx_pci_device_stub_c {
278
public:
279
  virtual bx_bool register_pci_handlers(bx_pci_device_stub_c *device,
280
                                        Bit8u *devfunc, const char *name,
281
                                        const char *descr)
282
  {
283
    STUBFUNC(pci, register_pci_handlers); return 0;
284
  }
285
  virtual bx_bool is_pci_device(const char *name) {
286
    return 0;
287
  }
288
  virtual bx_bool pci_set_base_mem(void *this_ptr, memory_handler_t f1, memory_handler_t f2,
289
                                   Bit32u *addr, Bit8u *pci_conf, unsigned size) {
290
    STUBFUNC(pci, pci_set_base_mem);
291
    return 0;
292
  }
293
 
294
  virtual bx_bool pci_set_base_io(void *this_ptr, bx_read_handler_t f1, bx_write_handler_t f2,
295
                                  Bit32u *addr, Bit8u *pci_conf, unsigned size,
296
                                  const Bit8u *iomask, const char *name) {
297
    STUBFUNC(pci, pci_set_base_io);
298
    return 0;
299
  }
300
 
301
  virtual Bit8u rd_memType(Bit32u addr) { return 0; }
302
  virtual Bit8u wr_memType(Bit32u addr) { return 0; }
303
  virtual void print_i440fx_state(void) {}
304
};
305
 
306
class BOCHSAPI bx_pci2isa_stub_c : public bx_devmodel_c, public bx_pci_device_stub_c {
307
public:
308
  virtual void pci_set_irq (Bit8u devfunc, unsigned line, bx_bool level) {
309
    STUBFUNC(pci2isa, pci_set_irq);
310
  }
311
};
312
 
313
class BOCHSAPI bx_pci_ide_stub_c : public bx_devmodel_c, public bx_pci_device_stub_c {
314
public:
315
  virtual bx_bool bmdma_present(void) {
316
    return 0;
317
  }
318
  virtual void bmdma_set_irq(Bit8u channel) {}
319
};
320
 
321
class BOCHSAPI bx_ne2k_stub_c : public bx_devmodel_c {
322
public:
323
  virtual void print_info(FILE *file, int page, int reg, int nodups) {}
324
};
325
 
326
class BOCHSAPI bx_speaker_stub_c : public bx_devmodel_c {
327
public:
328
  virtual void beep_on(float frequency) {}
329
  virtual void beep_off() {}
330
};
331
 
332
class BOCHSAPI bx_serial_stub_c : public bx_devmodel_c {
333
public:
334
  virtual void serial_mouse_enq(int delta_x, int delta_y, int delta_z, unsigned button_state) {
335
    STUBFUNC(serial, serial_mouse_enq);
336
  }
337
};
338
 
339
#if BX_SUPPORT_PCIUSB
340
class BOCHSAPI bx_pci_usb_stub_c : public bx_devmodel_c, public bx_pci_device_stub_c {
341
public:
342
  virtual void usb_mouse_enq(int delta_x, int delta_y, int delta_z, unsigned button_state) {
343
    STUBFUNC(pciusb, usb_mouse_enq);
344
  }
345
  virtual void usb_mouse_enabled_changed(bx_bool enable) {
346
    STUBFUNC(pciusb, usb_mouse_enabled_changed);
347
  }
348
  virtual bx_bool usb_key_enq(Bit8u *scan_code) {
349
    STUBFUNC(pciusb, usb_key_enq);
350
    return 0;
351
  }
352
  virtual bx_bool usb_keyboard_connected() { return 0; }
353
  virtual bx_bool usb_mouse_connected() { return 0; }
354
};
355
#endif
356
 
357
#if BX_SUPPORT_ACPI
358
class BOCHSAPI bx_acpi_ctrl_stub_c : public bx_devmodel_c, public bx_pci_device_stub_c {
359
public:
360
  virtual void generate_smi(Bit8u value) {}
361
};
362
#endif
363
 
364
#if BX_SUPPORT_BUSMOUSE
365
class BOCHSAPI bx_busm_stub_c : public bx_devmodel_c {
366
public:
367
  virtual void bus_mouse_enq(int delta_x, int delta_y, int delta_z, unsigned button_state) {
368
    STUBFUNC(busmouse, bus_mouse_enq);
369
  }
370
};
371
#endif
372
 
373
class BOCHSAPI bx_devices_c : public logfunctions {
374
public:
375
  bx_devices_c(void);
376
 ~bx_devices_c(void);
377
  // Initialize the device stubs (in constructur and exit())
378
  void init_stubs(void);
379
  // Register I/O addresses and IRQ lines. Initialize any internal
380
  // structures.  init() is called only once, even if the simulator
381
  // reboots or is restarted.
382
  void init(BX_MEM_C *);
383
  // Enter reset state in response to a reset condition.
384
  // The types of reset conditions are defined in bochs.h:
385
  // power-on, hardware, or software.
386
  void reset(unsigned type);
387
  // Cleanup the devices when the simulation quits.
388
  void exit(void);
389
  void register_state(void);
390
  void after_restore_state(void);
391
  BX_MEM_C *mem;  // address space associated with these devices
392
  bx_bool register_io_read_handler(void *this_ptr, bx_read_handler_t f,
393
                                   Bit32u addr, const char *name, Bit8u mask);
394
  bx_bool unregister_io_read_handler(void *this_ptr, bx_read_handler_t f,
395
                                     Bit32u addr, Bit8u mask);
396
  bx_bool register_io_write_handler(void *this_ptr, bx_write_handler_t f,
397
                                    Bit32u addr, const char *name, Bit8u mask);
398
  bx_bool unregister_io_write_handler(void *this_ptr, bx_write_handler_t f,
399
                                      Bit32u addr, Bit8u mask);
400
  bx_bool register_io_read_handler_range(void *this_ptr, bx_read_handler_t f,
401
                                         Bit32u begin_addr, Bit32u end_addr,
402
                                         const char *name, Bit8u mask);
403
  bx_bool register_io_write_handler_range(void *this_ptr, bx_write_handler_t f,
404
                                          Bit32u begin_addr, Bit32u end_addr,
405
                                          const char *name, Bit8u mask);
406
  bx_bool unregister_io_read_handler_range(void *this_ptr, bx_read_handler_t f,
407
                                           Bit32u begin, Bit32u end, Bit8u mask);
408
  bx_bool unregister_io_write_handler_range(void *this_ptr, bx_write_handler_t f,
409
                                            Bit32u begin, Bit32u end, Bit8u mask);
410
  bx_bool register_default_io_read_handler(void *this_ptr, bx_read_handler_t f, const char *name, Bit8u mask);
411
  bx_bool register_default_io_write_handler(void *this_ptr, bx_write_handler_t f, const char *name, Bit8u mask);
412
  bx_bool register_irq(unsigned irq, const char *name);
413
  bx_bool unregister_irq(unsigned irq, const char *name);
414
  Bit32u inp(Bit16u addr, unsigned io_len) BX_CPP_AttrRegparmN(2);
415
  void   outp(Bit16u addr, Bit32u value, unsigned io_len) BX_CPP_AttrRegparmN(3);
416
 
417
  static void timer_handler(void *);
418
  void timer(void);
419
 
420
  bx_devmodel_c     *pluginBiosDevice;
421
#if BX_SUPPORT_APIC
422
  bx_ioapic_c       *ioapic;
423
#endif
424
  bx_pci_bridge_stub_c *pluginPciBridge;
425
  bx_pci2isa_stub_c *pluginPci2IsaBridge;
426
  bx_pci_ide_stub_c *pluginPciIdeController;
427
#if BX_SUPPORT_ACPI
428
  bx_acpi_ctrl_stub_c *pluginACPIController;
429
#endif
430
  bx_devmodel_c     *pluginPciVgaAdapter;
431
  bx_devmodel_c     *pluginPciDevAdapter;
432
  bx_devmodel_c     *pluginPciPNicAdapter;
433
  bx_pit_c          *pit;
434
  bx_keyb_stub_c    *pluginKeyboard;
435
  bx_dma_stub_c     *pluginDmaDevice;
436
  bx_floppy_stub_c  *pluginFloppyDevice;
437
  bx_cmos_stub_c    *pluginCmosDevice;
438
  bx_serial_stub_c  *pluginSerialDevice;
439
#if BX_SUPPORT_PCIUSB
440
  bx_pci_usb_stub_c *pluginPciUSBAdapter;
441
#endif
442
  bx_devmodel_c     *pluginParallelDevice;
443
  bx_devmodel_c     *pluginHdemuDevice;
444
  bx_devmodel_c     *pluginUnmapped;
445
  bx_vga_stub_c     *pluginVgaDevice;
446
  bx_pic_stub_c     *pluginPicDevice;
447
  bx_hard_drive_stub_c *pluginHardDrive;
448
  bx_devmodel_c     *pluginSB16Device;
449
  bx_ne2k_stub_c    *pluginNE2kDevice;
450
  bx_devmodel_c     *pluginExtFpuIrq;
451
  bx_devmodel_c     *pluginGameport;
452
  bx_speaker_stub_c *pluginSpeaker;
453
#if BX_SUPPORT_BUSMOUSE
454
  bx_busm_stub_c    *pluginBusMouse;
455
#endif
456
#if BX_SUPPORT_IODEBUG
457
  bx_iodebug_c      *iodebug;
458
#endif
459
#if 0
460
  bx_g2h_c          *g2h;
461
#endif
462
 
463
  // stub classes that the pointers (above) can point to until a plugin is
464
  // loaded
465
  bx_cmos_stub_c stubCmos;
466
  bx_keyb_stub_c stubKeyboard;
467
#if BX_SUPPORT_BUSMOUSE
468
  bx_busm_stub_c stubBusMouse;
469
#endif
470
  bx_hard_drive_stub_c stubHardDrive;
471
  bx_dma_stub_c  stubDma;
472
  bx_pic_stub_c  stubPic;
473
  bx_floppy_stub_c  stubFloppy;
474
  bx_vga_stub_c  stubVga;
475
  bx_pci_bridge_stub_c  stubPci;
476
  bx_pci2isa_stub_c stubPci2Isa;
477
  bx_pci_ide_stub_c stubPciIde;
478
  bx_ne2k_stub_c    stubNE2k;
479
  bx_speaker_stub_c stubSpeaker;
480
  bx_serial_stub_c  stubSerial;
481
#if BX_SUPPORT_PCIUSB
482
  bx_pci_usb_stub_c stubUsbAdapter;
483
#endif
484
#if BX_SUPPORT_ACPI
485
  bx_acpi_ctrl_stub_c stubACPIController;
486
#endif
487
 
488
  // Some info to pass to devices which can handled bulk IO.  This allows
489
  // the interface to remain the same for IO devices which can't handle
490
  // bulk IO.  We should probably implement special INPBulk() and OUTBulk()
491
  // functions which stick these values in the bx_devices_c class, and
492
  // then call the normal functions rather than having gross globals
493
  // variables.
494
  Bit8u*   bulkIOHostAddr;
495
  unsigned bulkIOQuantumsRequested;
496
  unsigned bulkIOQuantumsTransferred;
497
 
498
private:
499
 
500
  struct io_handler_struct {
501
        struct io_handler_struct *next;
502
        struct io_handler_struct *prev;
503
        void *funct; // C++ type checking is great, but annoying
504
        void *this_ptr;
505
        char *handler_name;  // name of device
506
        int usage_count;
507
        Bit8u mask;          // io_len mask
508
  };
509
  struct io_handler_struct io_read_handlers;
510
  struct io_handler_struct io_write_handlers;
511
#define PORTS 0x10000
512
  struct io_handler_struct **read_port_to_handler;
513
  struct io_handler_struct **write_port_to_handler;
514
 
515
  // more for informative purposes, the names of the devices which
516
  // are use each of the IRQ 0..15 lines are stored here
517
  char *irq_handler_name[BX_MAX_IRQS];
518
 
519
  static Bit32u read_handler(void *this_ptr, Bit32u address, unsigned io_len);
520
  static void   write_handler(void *this_ptr, Bit32u address, Bit32u value, unsigned io_len);
521
  BX_DEV_SMF Bit32u port92_read(Bit32u address, unsigned io_len);
522
  BX_DEV_SMF void   port92_write(Bit32u address, Bit32u value, unsigned io_len);
523
 
524
  static Bit32u default_read_handler(void *this_ptr, Bit32u address, unsigned io_len);
525
  static void   default_write_handler(void *this_ptr, Bit32u address, Bit32u value, unsigned io_len);
526
 
527
  int timer_handle;
528
  bx_bool is_serial_enabled();
529
  bx_bool is_usb_enabled();
530
  bx_bool is_parallel_enabled();
531
};
532
 
533
// memory stub has an assumption that there are no memory accesses splitting 4K page
534
BX_CPP_INLINE void DEV_MEM_READ_PHYSICAL(bx_phy_address phy_addr, unsigned len, Bit8u *ptr)
535
{
536
  while(len > 0) {
537
    unsigned remainingInPage = 0x1000 - (phy_addr & 0xfff);
538
    if (len < remainingInPage) remainingInPage = len;
539
    BX_MEM(0)->readPhysicalPage(NULL, phy_addr, remainingInPage, ptr);
540
    ptr += remainingInPage;
541
    phy_addr += remainingInPage;
542
    len -= remainingInPage;
543
  }
544
}
545
 
546
// memory stub has an assumption that there are no memory accesses splitting 4K page
547
BX_CPP_INLINE void DEV_MEM_WRITE_PHYSICAL(bx_phy_address phy_addr, unsigned len, Bit8u *ptr)
548
{
549
  while(len > 0) {
550
    unsigned remainingInPage = 0x1000 - (phy_addr & 0xfff);
551
    if (len < remainingInPage) remainingInPage = len;
552
    BX_MEM(0)->writePhysicalPage(NULL, phy_addr, remainingInPage, ptr);
553
    ptr += remainingInPage;
554
    phy_addr += remainingInPage;
555
    len -= remainingInPage;
556
  }
557
}
558
 
559
#ifndef NO_DEVICE_INCLUDES
560
 
561
#if BX_SUPPORT_PCI
562
#include "iodev/pci.h"
563
#include "iodev/pci2isa.h"
564
#include "iodev/pci_ide.h"
565
#if BX_SUPPORT_ACPI
566
#include "iodev/acpi.h"
567
#endif
568
#if BX_SUPPORT_PCIVGA
569
#include "iodev/pcivga.h"
570
#endif
571
#if BX_SUPPORT_PCIDEV
572
#include "iodev/pcidev.h"
573
#endif
574
#if BX_SUPPORT_PCIUSB
575
#include "iodev/pciusb.h"
576
#endif
577
#endif
578
#include "iodev/vga.h"
579
#if BX_SUPPORT_APIC
580
#  include "iodev/ioapic.h"
581
#endif
582
#include "iodev/biosdev.h"
583
#include "iodev/cmos.h"
584
#include "iodev/dma.h"
585
#include "iodev/floppy.h"
586
#include "iodev/harddrv.h"
587
#if BX_SUPPORT_IODEBUG
588
#   include "iodev/iodebug.h"
589
#endif
590
#include "iodev/keyboard.h"
591
#if BX_SUPPORT_BUSMOUSE
592
#   include "iodev/busmouse.h"
593
#endif
594
#include "iodev/parallel.h"
595
#include "iodev/hdemu.h"
596
#include "iodev/pic.h"
597
#include "iodev/pit_wrap.h"
598
#include "iodev/virt_timer.h"
599
#include "iodev/serial.h"
600
#if BX_SUPPORT_SB16
601
#  include "iodev/sb16.h"
602
#endif
603
#include "iodev/unmapped.h"
604
#include "iodev/ne2k.h"
605
#if BX_SUPPORT_PCIPNIC
606
#include "iodev/pcipnic.h"
607
#endif
608
#include "iodev/guest2host.h"
609
#include "iodev/slowdown_timer.h"
610
#include "iodev/extfpuirq.h"
611
#include "iodev/gameport.h"
612
 
613
#endif /* NO_DEVICE_INCLUDES */
614
 
615
#if BX_PROVIDE_DEVICE_MODELS
616
BOCHSAPI extern bx_devices_c bx_devices;
617
#endif
618
 
619
#endif /* IODEV_H */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.