/[gxemul]/trunk/src/cpus/cpu_x86.c
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/src/cpus/cpu_x86.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 21 by dpavlin, Mon Oct 8 16:19:23 2007 UTC revision 22 by dpavlin, Mon Oct 8 16:19:37 2007 UTC
# Line 25  Line 25 
25   *  SUCH DAMAGE.   *  SUCH DAMAGE.
26   *   *
27   *   *
28   *  $Id: cpu_x86.c,v 1.5 2005/11/13 00:14:07 debug Exp $   *  $Id: cpu_x86.c,v 1.7 2006/02/17 18:38:30 debug Exp $
29   *   *
30   *  x86 (and amd64) CPU emulation.   *  x86 (and amd64) CPU emulation.
31   *   *
# Line 168  void x86_cpu_list_available_types(void) Line 168  void x86_cpu_list_available_types(void)
168          while (models[i].model_number != 0) {          while (models[i].model_number != 0) {
169                  debug("%s", models[i].name);                  debug("%s", models[i].name);
170    
171                  for (j=0; j<10-strlen(models[i].name); j++)                  for (j=0; j<10-(int)strlen(models[i].name); j++)
172                          debug(" ");                          debug(" ");
173                  i++;                  i++;
174                  if ((i % 6) == 0 || models[i].name == NULL)                  if ((i % 6) == 0 || models[i].name == NULL)
# Line 508  static uint32_t read_imm_and_print(unsig Line 508  static uint32_t read_imm_and_print(unsig
508  }  }
509    
510    
511  static uint32_t read_imm(unsigned char **instrp, uint64_t *newpcp,  uint32_t read_imm(unsigned char **instrp, uint64_t *newpcp,
512          int mode)          int mode)
513  {  {
514          return read_imm_common(instrp, newpcp, mode, 0);          return read_imm_common(instrp, newpcp, mode, 0);
515  }  }
516    
517    
518  static void print_csip(struct cpu *cpu)  void print_csip(struct cpu *cpu)
519  {  {
520          fatal("0x%04x:", cpu->cd.x86.s[X86_S_CS]);          fatal("0x%04x:", cpu->cd.x86.s[X86_S_CS]);
521          if (PROTECTED_MODE)          if (PROTECTED_MODE)
# Line 713  void reload_segment_descriptor(struct cp Line 713  void reload_segment_descriptor(struct cp
713          int segment = 1, rpl, orig_selector = selector;          int segment = 1, rpl, orig_selector = selector;
714          unsigned char descr[8];          unsigned char descr[8];
715          char *table_name = "GDT";          char *table_name = "GDT";
716          uint64_t base, limit, table_base, table_limit;          uint64_t base, limit, table_base;
717            int64_t table_limit;
718    
719          if (segnr > 0x100)      /*  arbitrary, larger than N_X86_SEGS  */          if (segnr > 0x100)      /*  arbitrary, larger than N_X86_SEGS  */
720                  segment = 0;                  segment = 0;
# Line 2428  int x86_cpu_disassemble_instr(struct cpu Line 2429  int x86_cpu_disassemble_instr(struct cpu
2429   *   *
2430   *  TODO: Level 1 and 2 info.   *  TODO: Level 1 and 2 info.
2431   */   */
2432  static void x86_cpuid(struct cpu *cpu)  void x86_cpuid(struct cpu *cpu)
2433  {  {
2434          switch (cpu->cd.x86.r[X86_R_AX]) {          switch (cpu->cd.x86.r[X86_R_AX]) {
2435          /*  Normal CPU id:  */          /*  Normal CPU id:  */
# Line 2596  int x86_interrupt(struct cpu *cpu, int n Line 2597  int x86_interrupt(struct cpu *cpu, int n
2597          if (PROTECTED_MODE) {          if (PROTECTED_MODE) {
2598                  int i, int_type = 0;                  int i, int_type = 0;
2599    
2600                  if (nr * 8 > cpu->cd.x86.idtr_limit) {                  if (nr * 8 > (int)cpu->cd.x86.idtr_limit) {
2601                          fatal("TODO: protected mode int 0x%02x outside idtr"                          fatal("TODO: protected mode int 0x%02x outside idtr"
2602                              " limit (%i)?\n", nr, (int)cpu->cd.x86.idtr_limit);                              " limit (%i)?\n", nr, (int)cpu->cd.x86.idtr_limit);
2603                          cpu->running = 0;                          cpu->running = 0;
# Line 2738  int x86_interrupt(struct cpu *cpu, int n Line 2739  int x86_interrupt(struct cpu *cpu, int n
2739          /*          /*
2740           *  Real mode:           *  Real mode:
2741           */           */
2742          if (nr * 4 > cpu->cd.x86.idtr_limit) {          if (nr * 4 > (int)cpu->cd.x86.idtr_limit) {
2743                  fatal("TODO: real mode int 0x%02x outside idtr limit ("                  fatal("TODO: real mode int 0x%02x outside idtr limit ("
2744                      "%i)?\n", nr, (int)cpu->cd.x86.idtr_limit);                      "%i)?\n", nr, (int)cpu->cd.x86.idtr_limit);
2745                  cpu->running = 0;                  cpu->running = 0;

Legend:
Removed from v.21  
changed lines
  Added in v.22

  ViewVC Help
Powered by ViewVC 1.1.26