Revision 8417845e target-alpha/cpu.h

b/target-alpha/cpu.h
317 317
    IPR_LAST,
318 318
};
319 319

  
320
typedef struct CPUAlphaState CPUAlphaState;
320
/* MMU modes definitions */
321

  
322
/* Alpha has 5 MMU modes: PALcode, kernel, executive, supervisor, and user.
323
   The Unix PALcode only exposes the kernel and user modes; presumably
324
   executive and supervisor are used by VMS.
325

  
326
   PALcode itself uses physical mode for code and kernel mode for data;
327
   there are PALmode instructions that can access data via physical mode
328
   or via an os-installed "alternate mode", which is one of the 4 above.
329

  
330
   QEMU does not currently properly distinguish between code/data when
331
   looking up addresses.  To avoid having to address this issue, our
332
   emulated PALcode will cheat and use the KSEG mapping for its code+data
333
   rather than physical addresses.
334

  
335
   Moreover, we're only emulating Unix PALcode, and not attempting VMS.
336

  
337
   All of which allows us to drop all but kernel and user modes.
338
   Elide the unused MMU modes to save space.  */
321 339

  
322
#define NB_MMU_MODES 4
340
#define NB_MMU_MODES 2
341

  
342
#define MMU_MODE0_SUFFIX _kernel
343
#define MMU_MODE1_SUFFIX _user
344
#define MMU_KERNEL_IDX   0
345
#define MMU_USER_IDX     1
346

  
347
typedef struct CPUAlphaState CPUAlphaState;
323 348

  
324 349
struct CPUAlphaState {
325 350
    uint64_t ir[31];
......
370 395
#define cpu_gen_code cpu_alpha_gen_code
371 396
#define cpu_signal_handler cpu_alpha_signal_handler
372 397

  
373
/* MMU modes definitions */
374
#define MMU_MODE0_SUFFIX _kernel
375
#define MMU_MODE1_SUFFIX _executive
376
#define MMU_MODE2_SUFFIX _supervisor
377
#define MMU_MODE3_SUFFIX _user
378
#define MMU_USER_IDX 3
379 398
static inline int cpu_mmu_index (CPUState *env)
380 399
{
381
    return (env->ps >> 3) & 3;
400
    return (env->ps >> 3) & 1;
382 401
}
383 402

  
384 403
#include "cpu-all.h"

Also available in: Unified diff