Skip to content

Instantly share code, notes, and snippets.

@adukot
Last active August 29, 2015 14:15
Show Gist options
  • Save adukot/9f84dc0e09a9ceac8e93 to your computer and use it in GitHub Desktop.
Save adukot/9f84dc0e09a9ceac8e93 to your computer and use it in GitHub Desktop.
U-Boot 1.1.4-linino-gdd727126 (Mar 19 2014 - 19:37:10)
Linino Board (ar9331) U-boot
DRAM: 64 MB
Top of RAM usable for U-Boot at: 84000000
Reserving 217k for U-Boot at: 83fc8000
Reserving 192k for malloc() at: 83f98000
Reserving 44 Bytes for Board Info at: 83f97fd4
Reserving 36 Bytes for Global Data at: 83f97fb0
Reserving 128k for boot params() at: 83f77fb0
Stack Pointer at: 83f77f98
Now running in RAM - U-Boot at: 83fc8000
Flash Manuf Id 0xef, DeviceId0 0x40, DeviceId1 0x18
flash size 16777216, sector count = 256
Flash: 16 MB
In: serial
Out: serial
Err: serial
Net: eth0: 00:03:7f:11:40:00
eth1: 00:03:7f:11:40:01
eth0, eth1
autoboot in 4 seconds (stop with 'lin')...
linino> loadb 80020000; go 80020000
## Ready for binary (kermit) download to 0x80020000 at 250000 bps...
## Total Size = 0x00162fb0 = 1454000 Bytes
## Start Addr = 0x80020000
## Starting application at 0x80020000 ...
@00000111,00000011,Early console started!
freqs: cpu=400000000 bus=200000000 mem=400000000 ref=25000000 pll=400000000
MIPS32/64 params: cpu arch: 128
MIPS32/64 params: TLB entries: 16
MIPS32/64 params: Icache: line = 32, total = 65536, ways = 4
sets = 512
MIPS32/64 params: Dcache: line = 32, total = 32768, ways = 4
sets = 256
picache_stride = 4096
picache_loopcount = 16
mips_fixup_addr: unexpected mips insn 0x27bdffe0 at 0x801331b0
mips_fixup_addr: unexpected mips insn 0x27bdffe0 at 0x801331b0
mips_fixup_addr: unexpected mips insn 0x27bdffe0 at 0x801331b0
mips_fixup_addr: unexpected mips insn 0x27bdffe0 at 0x801331b0
mips_fixup_stubs: 3281 fixups done in 4948432 cycles
Memory size: 0x04000000
phys segment: 0x3fff000 @ 0x1000
adding 0x3e6e000 @ 0x192000 to freelist 0
pmap_steal_memory: seg 0: 0x192 0x192 0x3fff 0x3fff
pmap_steal_memory: seg 0: 0x1b5 0x1b5 0x3fff 0x3fff
splsw 800b02c0
&lwp0 8017f560
lwp0.l_cpu 8017cf90
lwp0.l_cpu.ci_cpl 00000006
r24 8017f560
pmap_steal_memory: seg 0: 0x1b7 0x1b7 0x3fff 0x3fff
Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015
The NetBSD Foundation, Inc. All rights reserved.
Copyright (c) 1982, 1986, 1989, 1991, 1993
The Regents of the University of California. All rights reserved.
NetBSD 7.99.5 (LININO1) #29: Mon Mar 9 17:20:54 UTC 2015
root@aug:/usr/obj/sys/arch/evbmips/compile/LININO1
Atheros AR9331
total memory = 65536 KB
avail memory = 62504 KB
pid 0(system): trap: cpu0, reserved instruction in kernel mode
status=0x10000003, cause=0x70008028, epc=0x8006fe50, vaddr=0xc0001ff8
tf=0x801b6a90 ksp=0x801b6b30 ra=0x8006fe24 ppl=0x2800
kernel: reserved instruction trap
Stopped in pid 0.1 (system) at 8006fe50: sw s0,0(s2)
db> tr
0x801b6b30: 0+8006fe50 (80190000,c0001000,1,8017cf90) ra 0 sz 0
User-level: pid 0.1
db> ps
PID LID S CPU FLAGS STRUCT LWP * NAME WAIT
db_read_ptr: cannot find `allproc'
db> help
b delete match search w
break dmesg next set watch
bt dwatch p show whatis
c examine print sifting write
call exit ps step x
callout help quit sync
continue kill reboot trace
d machine s until
db> dmesg
db_read_int: cannot find `msgbufenabled'
db> continue
mainbus0 (root)
cpu0 at mainbus0: 400.00MHz (hz cycles = 2000000, delay divisor = 200)
cpu0: MIPS 24K (0x19374) Rev. 116 with software emulated floating point
cpu0: 16 TLB entries, 256MB max page size
cpu0: 64KB/32B 4-way set-associative L1 instruction cache
cpu0: 32KB/32B 4-way set-associative write-back L1 data cache
wdog0 at mainbus0: 5 second period
arbus0 at mainbus0
----
8006fea0 <kern_malloc>:
8006fea0: 27bdffd8 addiu sp,sp,-40
8006fea4: 24030001 li v1,1
8006fea8: 24020002 li v0,2
8006feac: afb30020 sw s3,32(sp)
8006feb0: 00a09821 move s3,a1
8006feb4: 30a50001 andi a1,a1,0x1
8006feb8: 0065100a movz v0,v1,a1
8006febc: 2c831000 sltiu v1,a0,4096
8006fec0: afbf0024 sw ra,36(sp)
8006fec4: afb2001c sw s2,28(sp)
8006fec8: afb10018 sw s1,24(sp)
8006fecc: 14600004 bnez v1,8006fee0 <kern_malloc+0x40>
8006fed0: afb00014 sw s0,20(sp)
8006fed4: 24901000 addiu s0,a0,4096
8006fed8: 0801bfba j 8006fee8 <kern_malloc+0x48>
8006fedc: 24110ff8 li s1,4088
8006fee0: 24900008 addiu s0,a0,8
8006fee4: 00008821 move s1,zero
8006fee8: 02002021 move a0,s0
8006feec: 0c02f3fc jal 800bcff0 <kmem_intr_alloc>
8006fef0: 00402821 move a1,v0
8006fef4: 1040000d beqz v0,8006ff2c <kern_malloc+0x8c>
8006fef8: 00409021 move s2,v0
8006fefc: 32730002 andi s3,s3,0x2
8006ff00: 52600006 beqzl s3,8006ff1c <kern_malloc+0x7c>
8006ff04: 02519021 addu s2,s2,s1
8006ff08: 00402021 move a0,v0
8006ff0c: 00002821 move a1,zero
8006ff10: 0c04aeac jal 8012bab0 <memset>
8006ff14: 02003021 move a2,s0
8006ff18: 02519021 addu s2,s2,s1
8006ff1c: 02118023 subu s0,s0,s1
8006ff20: ae500000 sw s0,0(s2)
8006ff24: 0801bfcc j 8006ff30 <kern_malloc+0x90>
8006ff28: 26420008 addiu v0,s2,8
8006ff2c: 00001021 move v0,zero
8006ff30: 8fbf0024 lw ra,36(sp)
8006ff34: 8fb30020 lw s3,32(sp)
8006ff38: 8fb2001c lw s2,28(sp)
8006ff3c: 8fb10018 lw s1,24(sp)
8006ff40: 8fb00014 lw s0,20(sp)
8006ff44: 03e00008 jr ra
8006ff48: 27bd0028 addiu sp,sp,40
92 /*
93 * Header contains total size, including the header itself.
94 */
95 struct malloc_header {
96 size_t mh_size;
97 } __aligned(ALIGNBYTES + 1);
98
99 void *
100 kern_malloc(unsigned long size, int flags)
101 {
102 const int kmflags = (flags & M_NOWAIT) ? KM_NOSLEEP : KM_SLEEP;
103 size_t allocsize, hdroffset;
104 struct malloc_header *mh;
105 void *p;
106
107 if (size >= PAGE_SIZE) {
108 allocsize = PAGE_SIZE + size; /* for page alignment */
109 hdroffset = PAGE_SIZE - sizeof(struct malloc_header);
110 } else {
111 allocsize = sizeof(struct malloc_header) + size;
112 hdroffset = 0;
113 }
114
115 p = kmem_intr_alloc(allocsize, kmflags);
116 if (p == NULL)
117 return NULL;
118
119 if ((flags & M_ZERO) != 0) {
120 memset(p, 0, allocsize);
121 }
122 mh = (void *)((char *)p + hdroffset);
123 mh->mh_size = allocsize - hdroffset;
124
125 return mh + 1;
126 }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment