+ (* This is basically the same algorithm from printk.c:do_syslog
+ * type=3, translated into OCaml. Unlike the kernel version
+ * however we don't copy the buffer backwards.
+ *)
+ let get_log_buf idx =
+ let addr = log_buf +^ (idx &^ (log_buf_len -^ 1L)) in
+ Char.chr (get_byte mem addr)
+ in
+
+ let count = log_buf_len in
+ let count = if count > logged_chars then logged_chars else count in
+ let limit = log_end in