/[gxemul]/trunk/src/include/cpu_hppa.h
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/include/cpu_hppa.h

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

revision 14 by dpavlin, Mon Oct 8 16:18:51 2007 UTC revision 22 by dpavlin, Mon Oct 8 16:19:37 2007 UTC
# Line 2  Line 2 
2  #define CPU_HPPA_H  #define CPU_HPPA_H
3    
4  /*  /*
5   *  Copyright (C) 2005  Anders Gavare.  All rights reserved.   *  Copyright (C) 2005-2006  Anders Gavare.  All rights reserved.
6   *   *
7   *  Redistribution and use in source and binary forms, with or without   *  Redistribution and use in source and binary forms, with or without
8   *  modification, are permitted provided that the following conditions are met:   *  modification, are permitted provided that the following conditions are met:
# Line 18  Line 18 
18   *  THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND   *  THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
19   *  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE   *  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20   *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE   *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21   *  ARE DISCLAIMED.  IN NO EVENT HPPAALL THE AUTHOR OR CONTRIBUTORS BE LIABLE     *  ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE  
22   *  FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL   *  FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23   *  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS   *  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24   *  OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)   *  OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# Line 28  Line 28 
28   *  SUCH DAMAGE.   *  SUCH DAMAGE.
29   *   *
30   *   *
31   *  $Id: cpu_hppa.h,v 1.5 2005/09/07 07:10:17 debug Exp $   *  $Id: cpu_hppa.h,v 1.15 2006/02/13 04:23:25 debug Exp $
32   */   */
33    
34  #include "misc.h"  #include "misc.h"
# Line 40  struct cpu_family; Line 40  struct cpu_family;
40  #define HPPA_N_IC_ARGS                  3  #define HPPA_N_IC_ARGS                  3
41  #define HPPA_INSTR_ALIGNMENT_SHIFT      2  #define HPPA_INSTR_ALIGNMENT_SHIFT      2
42  #define HPPA_IC_ENTRIES_SHIFT           10  #define HPPA_IC_ENTRIES_SHIFT           10
43  #define HPPA_IC_ENTRIES_PER_PAGE                (1 << HPPA_IC_ENTRIES_SHIFT)  #define HPPA_IC_ENTRIES_PER_PAGE        (1 << HPPA_IC_ENTRIES_SHIFT)
44  #define HPPA_PC_TO_IC_ENTRY(a)          (((a)>>HPPA_INSTR_ALIGNMENT_SHIFT) \  #define HPPA_PC_TO_IC_ENTRY(a)          (((a)>>HPPA_INSTR_ALIGNMENT_SHIFT) \
45                                          & (HPPA_IC_ENTRIES_PER_PAGE-1))                                          & (HPPA_IC_ENTRIES_PER_PAGE-1))
46  #define HPPA_ADDR_TO_PAGENR(a)          ((a) >> (HPPA_IC_ENTRIES_SHIFT \  #define HPPA_ADDR_TO_PAGENR(a)          ((a) >> (HPPA_IC_ENTRIES_SHIFT \
47                                          + HPPA_INSTR_ALIGNMENT_SHIFT))                                          + HPPA_INSTR_ALIGNMENT_SHIFT))
48    
49  struct hppa_instr_call {  DYNTRANS_MISC_DECLARATIONS(hppa,HPPA,uint64_t)
         void    (*f)(struct cpu *, struct hppa_instr_call *);  
         size_t  arg[HPPA_N_IC_ARGS];  
 };  
50    
51  /*  Translation cache struct for each physical page:  */  #define HPPA_MAX_VPH_TLB_ENTRIES                128
 struct hppa_tc_physpage {  
         uint32_t        next_ofs;       /*  or 0 for end of chain  */  
         uint64_t        physaddr;  
         int             flags;  
         struct hppa_instr_call ics[HPPA_IC_ENTRIES_PER_PAGE + 1];  
 };  
52    
 #define HPPA_N_VPH_ENTRIES              1048576  
53    
54  #define HPPA_MAX_VPH_TLB_ENTRIES                256  #define HPPA_NREGS              32
 struct hppa_vpg_tlb_entry {  
         int             valid;  
         int             writeflag;  
         int64_t         timestamp;  
         unsigned char   *host_page;  
         uint64_t        vaddr_page;  
         uint64_t        paddr_page;  
 };  
55    
56  struct hppa_cpu {  struct hppa_cpu {
57          int             bits;           /*  32 or 64  */          int             bits;           /*  32 or 64  */
58    
59          uint64_t        r[32];          uint64_t        r[HPPA_NREGS];
60    
61    
62          /*          /*
63           *  Instruction translation cache:           *  Instruction translation cache and Virtual->Physical->Host
64             *  address translation:
65           */           */
66            DYNTRANS_ITC(hppa)
67          /*  cur_ic_page is a pointer to an array of HPPA_IC_ENTRIES_PER_PAGE          VPH_TLBS(hppa,HPPA)
68              instruction call entries. next_ic points to the next such          VPH32(hppa,HPPA,uint64_t,uint8_t)
69              call to be executed.  */          VPH64(hppa,HPPA,uint8_t)
         struct hppa_tc_physpage *cur_physpage;  
         struct hppa_instr_call  *cur_ic_page;  
         struct hppa_instr_call  *next_ic;  
   
   
         /*  
          *  Virtual -> physical -> host address translation:  
          *  
          *  host_load and host_store point to arrays of HPPA_N_VPH_ENTRIES  
          *  pointers (to host pages); phys_addr points to an array of  
          *  HPPA_N_VPH_ENTRIES uint32_t.  
          */  
   
         struct hppa_vpg_tlb_entry  vph_tlb_entry[HPPA_MAX_VPH_TLB_ENTRIES];  
         unsigned char               *host_load[HPPA_N_VPH_ENTRIES];  
         unsigned char               *host_store[HPPA_N_VPH_ENTRIES];  
         uint32_t                    phys_addr[HPPA_N_VPH_ENTRIES];  
         struct hppa_tc_physpage    *phys_page[HPPA_N_VPH_ENTRIES];  
70  };  };
71    
72    
73  /*  cpu_hppa.c:  */  /*  cpu_hppa.c:  */
74  void hppa_update_translation_table(struct cpu *cpu, uint64_t vaddr_page,  void hppa_update_translation_table(struct cpu *cpu, uint64_t vaddr_page,
75          unsigned char *host_page, int writeflag, uint64_t paddr_page);          unsigned char *host_page, int writeflag, uint64_t paddr_page);
76  void hppa_invalidate_translation_caches_paddr(struct cpu *cpu, uint64_t, int);  void hppa_invalidate_translation_caches(struct cpu *cpu, uint64_t, int);
77  void hppa_invalidate_code_translation(struct cpu *cpu, uint64_t, int);  void hppa_invalidate_code_translation(struct cpu *cpu, uint64_t, int);
78  void hppa32_update_translation_table(struct cpu *cpu, uint64_t vaddr_page,  void hppa32_update_translation_table(struct cpu *cpu, uint64_t vaddr_page,
79          unsigned char *host_page, int writeflag, uint64_t paddr_page);          unsigned char *host_page, int writeflag, uint64_t paddr_page);
80  void hppa32_invalidate_translation_caches_paddr(struct cpu *cpu, uint64_t, int);  void hppa32_invalidate_translation_caches(struct cpu *cpu, uint64_t, int);
81  void hppa32_invalidate_code_translation(struct cpu *cpu, uint64_t, int);  void hppa32_invalidate_code_translation(struct cpu *cpu, uint64_t, int);
82  int hppa_memory_rw(struct cpu *cpu, struct memory *mem, uint64_t vaddr,  int hppa_memory_rw(struct cpu *cpu, struct memory *mem, uint64_t vaddr,
83          unsigned char *data, size_t len, int writeflag, int cache_flags);          unsigned char *data, size_t len, int writeflag, int cache_flags);

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

  ViewVC Help
Powered by ViewVC 1.1.26