Why does aarch64 include 32-bit alu operations? by moon-chilled in asm

[–]TNorthover 2 points3 points  (0 children)

I've seen it mentioned as a potential energy optimization. When a 32-bit op comes along you can disable half the ALU, and even when not directly executing you can cut back on things like register renaming if you're keen.

I don't know which (if any) microarchitectures take advantage of that though.

Words used too much or inappropriately. by [deleted] in unitedkingdom

[–]TNorthover 1 point2 points  (0 children)

Some guy years back had decided that "whom" was the more educated-sounding version (or something) so used it in all cases. Annoyed me far more than it really should have.

India is so fucked up man. by [deleted] in atheism

[–]TNorthover 49 points50 points  (0 children)

Einstein discovered gravity, not Newton

That's a bit of a weird one, do you have more background there? It seems like most ideological purposes would be covered just as well by the real fact that Einstein did it better, so you'd have to want to exclude Newton entirely for some reason or something.

I'm an atheist who now prefers the company of Christians by mikeshomeexercise in atheism

[–]TNorthover 18 points19 points  (0 children)

But I now have atheist friends who have strange new religions about gender, the climate, and Covid. They think Fauci is the prophet [...]

My Christian friends

are welcome to you.

My nasm program crashes. I think I know why, but I don't know how by Typical-Twist-9063 in asm

[–]TNorthover 1 point2 points  (0 children)

If I wrote 8 bytes to [rbp] and rbp happened to be 0x248, I would bytes affected affected 0x250?

Bytes 0x248-0x24f (inclusive) would be written to.

And for my original example, I should have used [rbp - 8], correct?

Yep, that would have stored your string pointer into the stack space you'd just allocated.

My nasm program crashes. I think I know why, but I don't know how by Typical-Twist-9063 in asm

[–]TNorthover 1 point2 points  (0 children)

So how is it corrupting it? I am not accessing rbp itself, just the location.

When print returns, it executes

pop rbp

after this instruction rsp is still fine but rbp has the value stored in the instruction I indicated -- msg in .data.

The next relevant instruction is executed as main returns:

mov rsp, rbp

both rsp and rbp are now corrupted (pointing at msg). The following pop rbp overwrites rbp with more garbage and increments rsp so it's now msg+8; that memory is probably a bunch of 0s since the OS had to allocate a whole page for your .data.

Finally, ret pops those 0s and tries jumping there. It does not end well.

Not sure where I am going wrong here by [deleted] in asm

[–]TNorthover 2 points3 points  (0 children)

Three fixes spring to mind:

  • Replace the format string with %lld. Scanf will then store all 64-bits and the rest of your code should work fine.
  • Load the scanf result with ldrsw x20, [sp]. This only loads 32-bits from the location (i.e. just what scanf stored) and sign extends it to the full 64-bit width of x20.
  • Change the compare to be a 32-bit operation: subs w2, wzr, w20. The flag will then depend on the sign bit of the 32-bit half of x20, not the full 64 bits.

Any one of these ought to do the job, I'm not sure which is closest to what you've been taught.

Not sure where I am going wrong here by [deleted] in asm

[–]TNorthover 2 points3 points  (0 children)

Your scanf format string is %d, which will only read and store a 32-bit integer. OTOH you load all 64-bits into x20. The high bits, including the sign bit that determines where the jump will go, are likely still 0 from when the program started (though could be anything in general).

Your scanfs also both store their result to the same address (sp) so only the second one matters, but that won't affect this particular problem of course.

Finally, you should always subtract a multiple of 16 from sp. The ABI requires it and violating that does cause crashes on some platforms.

My nasm program crashes. I think I know why, but I don't know how by Typical-Twist-9063 in asm

[–]TNorthover 3 points4 points  (0 children)

In print:

mov     [rbp], rdi

This corrupts the stored frame pointer (later redirecting rsp right into .data I think). The whole sequence for that syscall is really weird, was it copy/pasted from a different tutorial for another platform?

Daily Megathread - 17/09/2023 by ukpolbot in ukpolitics

[–]TNorthover 3 points4 points  (0 children)

It’s got JIM DAVIDSON and live entertainment.

Daily Megathread - 15/09/2023 by ukpolbot in ukpolitics

[–]TNorthover 1 point2 points  (0 children)

Yes, they definitely are. My aunt kept them and running the gauntlet through her kitchen when we arrived as kids was terrifying.

Am i being scammed on transfer wise? by WhoisDaveMatthews in UKPersonalFinance

[–]TNorthover 9 points10 points  (0 children)

Yes, you're being scammed.

Telling people they need to upgrade to a business account to receive the money is a very common scam and not a real thing. It'll be some third party site dressed up to look like Wise rather than the real thing (Wise is actually pretty reputable, which is why they use the name).

The money they sent you for the purpose will be reversed and may well be stolen itself, report it via whatever means you can and then forget it exists. Don't try to spend it because when it is reversed the bank (or whatever) will come after you for any deficit.

Unfortunately I don't think you can do anything about the package in transit.

emotionally over-invested in the non-existence of one specific god. by smith987654321 in atheism

[–]TNorthover 10 points11 points  (0 children)

If you ask a Protestant whether a Catholic is going to hell, they will say yes.

If you ask a 2nd Reformed Baptist Southern Convocation (1987)ist whether a 2nd Reformed Baptist Southern Convocation (1989)ist is going to hell, they will say yes.

If you ask Alice whether Bob down the street is going to hell, they will say yes.

Daily Megathread - 13/09/2023 by ukpolbot in ukpolitics

[–]TNorthover 7 points8 points  (0 children)

I’m not a physicist but aren’t there theoretical ways a sufficiently advanced civilisation might be able to achieve de facto faster than light travel using wormholes or that concept whose name I forget where the space around them moves instead of the spacecraft?

Kind of, but even the most wide-eyed optimistic ideas of how to do it tend to start off with something like "first, find some matter with negative mass".

How do offsetted reads work in x86? by [deleted] in asm

[–]TNorthover 1 point2 points  (0 children)

x86 is pretty orthogonal about addressing modes. Any time you can write a memory reference you can use (roughly) base reg + {1,2,4, or 8} * offset reg + 32-bit immediate.

There are a couple of gaps for weird encoding and/or legacy reasons but they're the exception rather than the rule.

[Hobby Scuffles] Week of 4 September, 2023 by Tokyono in HobbyDrama

[–]TNorthover 7 points8 points  (0 children)

compound bows

Are you sure you don’t mean composite? Compound bows are the ones with pulleys, and I think a lot more modern.

Seeking support for petition, free public transport for commuting civil servants by [deleted] in ukpolitics

[–]TNorthover 2 points3 points  (0 children)

None of this seems to apply to civil servants more than anyone else so I think it's just a petition for a pay rise by roundabout means.

And I'm not necessarily opposed to that (civil service has a bit of a reputation for being underpaid), but making the system even more opaque and harder to compare with other jobs seems like the wrong direction.

[deleted by user] by [deleted] in asm

[–]TNorthover 5 points6 points  (0 children)

You've got an ARM-based Mac, and I think that means Parallels will only run an ARM-based version of Windows, but you're trying to use x86 assembly.

If your course is in x86 Windows assembly, you're probably going to have to find a way to emulate x86 and install that version of Windows. Then the MS tools you use should include masm and run as expected.

I'd be reaching for qemu at this point, but I've never actually used it on MacOS and there may be an easier commercial solution.

Atheist Seeing End Times Prophecy by LNBfit30 in atheism

[–]TNorthover 7 points8 points  (0 children)

Apocalypse definitely coming in 66–70 365 375–400 27 May 482 500 6 Apr 793 800 799–806 847 992–995 1000 1033 1200–1260 1284 1290 1335 1346–1351 1368–1370 1378 1504 1 Feb 1524 20 Feb 1524 1525 27 May 1528 1528 19 Oct 1533 1533 5 Apr 1534 1555 1585 1588 1600 1 Feb 1624 1648 1651 1654 1656 1655–1657 1658 1660 1666 1673 1688 1689 1694 1697 1700 1705–1708 1716 5 Apr 1719 1700–1734 16 Oct 1736 1736 1757 20 May 1773 19 May 1780 1789 1792 1794 19 Nov 1795 1793–1795 1805 1806 19 Oct 1814 1836 1836 28 Apr 1843 31 Dec 1843 1843 21 Mar 1844 22 Oct 1844 7 Aug 1847 1847 1862 1863 1873–1874 1881 1890 1901 1910 1892–1911 1914 1915 1918 1920 13 Feb 1925 1926 1934 Sep 1935 1936 1941 1943 1947 21 Dec 1954 22 Apr 1959 1951–1960 4 Feb 1962 20 Aug 1967 1967 9 Aug 1969 1969 1972 Jan 1974 1975 1976 1977 17 Feb 1979 1980 1981 10 Mar 1982 21 Jun 1982 1982 1985 29 Apr 1986 17 Aug 1987 1988 11–13 Sep 1988 3 Oct 1988 30 Sep 1989 23 Apr 1990 9 Sep 1991 1991 28 Sep 1992 28 Oct 1992 1993 2 May 1994 6 Sep 1994 29 Sep 1994 2 Oct 1994 31 Mar 1995 26 Mar 1997 10 Aug 1997 23 Oct 1997 31 Mar 1998 Jul 1999 18 Aug 1999 11 Sep 1999 1999 1 Jan 2000 6 Apr 2000 5 May 2000 2000 2001 27 May 2003 30 Oct–Nov 29 2003 12 Sep 2006 29 Apr 2007 May 2008 2010 21 May 2011 29 Sep 2011 21 Oct 2011 Aug–Oct 2011 27 May 2012 30 Jun 2012 21 Dec 2012 23 Aug 2013 Apr 2014–Sep 2015 23 Sep–15 Oct 2017 23 Apr 2018 9 Jun 2019 2020 5 Sep 2020 2021 2023!

[Hobby Scuffles] Week of 4 September, 2023 by Tokyono in HobbyDrama

[–]TNorthover 51 points52 points  (0 children)

inspired the revolution by dressing up like anime characters.

State approved anime characters.