+
+#if defined(CONFIG_USER_ONLY)
+static inline target_ulong get_phys_addr_code(CPUState *env, target_ulong addr)
+{
+ return addr;
+}
+#else
+/* NOTE: this function can trigger an exception */
+/* XXX: i386 target specific */
+static inline target_ulong get_phys_addr_code(CPUState *env, target_ulong addr)
+{
+ int is_user, index;
+
+ index = (addr >> TARGET_PAGE_BITS) & (CPU_TLB_SIZE - 1);
+ is_user = ((env->hflags & HF_CPL_MASK) == 3);
+ if (__builtin_expect(env->tlb_read[is_user][index].address !=
+ (addr & TARGET_PAGE_MASK), 0)) {
+ ldub_code((void *)addr);
+ }
+ return addr + env->tlb_read[is_user][index].addend - (unsigned long)phys_ram_base;
+}
+#endif
+